Upgrade bson to 4.x (latest)
This commit is contained in:
parent
0cf0fa95ff
commit
e834368502
|
@ -624,6 +624,12 @@ function createPromiseCallback() {
|
|||
return cb;
|
||||
}
|
||||
|
||||
function isBsonType(value) {
|
||||
// bson@1.x stores _bsontype on ObjectID instance, bson@4.x on prototype
|
||||
return value.hasOwnProperty('_bsontype') ||
|
||||
value.constructor.prototype.hasOwnProperty('_bsontype');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dedupe an array
|
||||
* @param {Array} an array
|
||||
|
@ -636,7 +642,7 @@ function uniq(a) {
|
|||
}
|
||||
assert(Array.isArray(a), 'array argument is required');
|
||||
var comparableA = a.map(
|
||||
item => item.hasOwnProperty('_bsontype') ? item.toString() : item
|
||||
item => isBsonType(item) ? item.toString() : item
|
||||
);
|
||||
for (var i = 0, n = comparableA.length; i < n; i++) {
|
||||
if (comparableA.indexOf(comparableA[i]) === i) {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"devDependencies": {
|
||||
"@types/node": "^10.0.8",
|
||||
"async-iterators": "^0.2.2",
|
||||
"bson": "^1.0.4",
|
||||
"bson": "^4.0.1",
|
||||
"coveralls": "^3.0.1",
|
||||
"eslint": "^5.1.0",
|
||||
"eslint-config-loopback": "^11.0.0",
|
||||
|
|
Loading…
Reference in New Issue