node_modules updated, buefy add to lib folder
This commit is contained in:
-2
@@ -1,7 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4"
|
||||
- "5"
|
||||
- "6"
|
||||
|
||||
+8
@@ -1,3 +1,11 @@
|
||||
0.6.0 / 2019-05-01
|
||||
==================
|
||||
* feat: support setting dotted paths within nested arrays
|
||||
|
||||
0.5.2 / 2019-04-25
|
||||
==================
|
||||
* fix: avoid using subclassed array constructor when doing `map()`
|
||||
|
||||
0.5.1 / 2018-08-30
|
||||
==================
|
||||
* fix: prevent writing to constructor and prototype as well as __proto__
|
||||
|
||||
+24
-15
@@ -1,6 +1,3 @@
|
||||
// Make sure Map exists for old Node.js versions
|
||||
var Map = global.Map != null ? global.Map : function() {};
|
||||
|
||||
// These properties are special and can open client libraries to security
|
||||
// issues
|
||||
var ignoreProperties = ['__proto__', 'constructor', 'prototype'];
|
||||
@@ -66,7 +63,9 @@ exports.get = function (path, o, special, map) {
|
||||
// reading a property from the array items
|
||||
var paths = parts.slice(i);
|
||||
|
||||
return obj.map(function (item) {
|
||||
// Need to `concat()` to avoid `map()` calling a constructor of an array
|
||||
// subclass
|
||||
return [].concat(obj).map(function (item) {
|
||||
return item
|
||||
? exports.get(paths, item, special || lookup, map)
|
||||
: map(undefined);
|
||||
@@ -255,17 +254,7 @@ exports.set = function (path, val, o, special, map, _copying) {
|
||||
// set the value on the last branch
|
||||
if (Array.isArray(obj) && !/^\d+$/.test(part)) {
|
||||
if (!copy && Array.isArray(val)) {
|
||||
for (var item, j = 0; j < obj.length && j < val.length; ++j) {
|
||||
item = obj[j];
|
||||
if (item) {
|
||||
if (lookup) {
|
||||
lookup(item, part, map(val[j]));
|
||||
} else {
|
||||
if (item[special]) item = item[special];
|
||||
item[part] = map(val[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
_setArray(obj, val, part, lookup, special, map);
|
||||
} else {
|
||||
for (var j = 0; j < obj.length; ++j) {
|
||||
item = obj[j];
|
||||
@@ -290,6 +279,26 @@ exports.set = function (path, val, o, special, map, _copying) {
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Recursively set nested arrays
|
||||
*/
|
||||
|
||||
function _setArray(obj, val, part, lookup, special, map) {
|
||||
for (var item, j = 0; j < obj.length && j < val.length; ++j) {
|
||||
item = obj[j];
|
||||
if (Array.isArray(item) && Array.isArray(val[j])) {
|
||||
_setArray(item, val[j], part, lookup, special, map);
|
||||
} else if (item) {
|
||||
if (lookup) {
|
||||
lookup(item, part, map(val[j]));
|
||||
} else {
|
||||
if (item[special]) item = item[special];
|
||||
item[part] = map(val[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the value passed to it.
|
||||
*/
|
||||
|
||||
+12
-12
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "mpath@0.5.1",
|
||||
"_id": "mpath@0.5.1",
|
||||
"_from": "mpath@0.6.0",
|
||||
"_id": "mpath@0.6.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==",
|
||||
"_integrity": "sha512-i75qh79MJ5Xo/sbhxrDrPSEG0H/mr1kcZXJ8dH6URU5jD/knFxCVqVC/gVSW7GIXL/9hHWlT9haLbCXWOll3qw==",
|
||||
"_location": "/mpath",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "mpath@0.5.1",
|
||||
"raw": "mpath@0.6.0",
|
||||
"name": "mpath",
|
||||
"escapedName": "mpath",
|
||||
"rawSpec": "0.5.1",
|
||||
"rawSpec": "0.6.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.5.1"
|
||||
"fetchSpec": "0.6.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mongoose"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz",
|
||||
"_shasum": "17131501f1ff9e6e4fbc8ffa875aa7065b5775ab",
|
||||
"_spec": "mpath@0.5.1",
|
||||
"_where": "D:\\Gitterra\\om\\node_modules\\mongoose",
|
||||
"_resolved": "https://registry.npmjs.org/mpath/-/mpath-0.6.0.tgz",
|
||||
"_shasum": "aa922029fca4f0f641f360e74c5c1b6a4c47078e",
|
||||
"_spec": "mpath@0.6.0",
|
||||
"_where": "/home/erik/Documents/workspace_brackets/a1_BME_Project_Ohm/om/node_modules/mongoose",
|
||||
"author": {
|
||||
"name": "Aaron Heckmann",
|
||||
"email": "aaron.heckmann+github@gmail.com"
|
||||
@@ -34,7 +34,7 @@
|
||||
"description": "{G,S}et object values using MongoDB-like path notation",
|
||||
"devDependencies": {
|
||||
"benchmark": "~1.0.0",
|
||||
"mocha": "1.8.1"
|
||||
"mocha": "5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
@@ -56,5 +56,5 @@
|
||||
"scripts": {
|
||||
"test": "mocha test/*"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
"version": "0.6.0"
|
||||
}
|
||||
|
||||
+27
-5
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Test dependencies.
|
||||
@@ -1749,7 +1750,7 @@ describe('mpath', function(){
|
||||
];
|
||||
assert.deepEqual(t, o.array);
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
it('array.prop', function(done){
|
||||
mpath.set('comments.name', ['this', 'was', 'changed'], o);
|
||||
@@ -1773,9 +1774,15 @@ describe('mpath', function(){
|
||||
], o.comments);
|
||||
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
it('nested array', function(done) {
|
||||
const obj = { arr: [[{ test: 41 }]] };
|
||||
mpath.set('arr.test', [[42]], obj);
|
||||
assert.deepEqual(obj.arr, [[{ test: 42 }]]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple $ use', function(){
|
||||
var o = doc();
|
||||
@@ -1784,8 +1791,8 @@ describe('mpath', function(){
|
||||
mpath.set('arr.$.arr.$.a', 35, o);
|
||||
});
|
||||
done();
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('has', function(done) {
|
||||
assert.ok(mpath.has('a', { a: 1 }));
|
||||
@@ -1846,6 +1853,21 @@ describe('mpath', function(){
|
||||
done();
|
||||
});
|
||||
|
||||
it('get() underneath subclassed array', function(done) {
|
||||
class MyArray extends Array {}
|
||||
|
||||
const obj = {
|
||||
arr: new MyArray()
|
||||
};
|
||||
obj.arr.push({ test: 2 });
|
||||
|
||||
const arr = mpath.get('arr.test', obj);
|
||||
assert.equal(arr.constructor.name, 'Array');
|
||||
assert.ok(!(arr instanceof MyArray));
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('ignores setting a nested path that doesnt exist', function(done){
|
||||
var o = doc();
|
||||
assert.doesNotThrow(function(){
|
||||
|
||||
Reference in New Issue
Block a user