object-rewrite
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -130,4 +130,3 @@ const assert = require('assert'); | ||
assert(fieldsToRequest.every(f => dataStoreFields.includes(f)), `Bad Field Requested: ${fieldsToRequest.filter(f => !dataStoreFields.includes(f))}`); | ||
const injectRewriter = (input, context) => objectScan(Object.keys(injectCbs), { | ||
const injectRewriter = objectScan(Object.keys(injectCbs), { | ||
useArraySelector: false, | ||
@@ -137,12 +136,12 @@ joined: false, | ||
matchedBy, | ||
parents | ||
parents, | ||
context | ||
}) => { | ||
matchedBy.forEach(m => { | ||
Object.assign(value, injectCbs[m].fn(key, value, parents, context)); | ||
Object.assign(value, injectCbs[m].fn(key, value, parents, context.context)); | ||
}); | ||
return true; | ||
} | ||
})(input); | ||
const filterRewriter = (input, context) => objectScan(Object.keys(filterCbs), { | ||
}); | ||
const filterRewriter = objectScan(Object.keys(filterCbs), { | ||
useArraySelector: false, | ||
@@ -152,8 +151,9 @@ joined: false, | ||
matchedBy, | ||
parents | ||
parents, | ||
context | ||
}) => { | ||
const result = matchedBy.some(m => filterCbs[m].fn(key, value, parents, context) === true); | ||
const result = matchedBy.some(m => filterCbs[m].fn(key, value, parents, context.context) === true); | ||
if (result === false) { | ||
const parent = key.length === 1 ? input : parents[0]; | ||
const parent = key.length === 1 ? context.input : parents[0]; | ||
@@ -169,41 +169,38 @@ if (Array.isArray(parent)) { | ||
} | ||
})(input); | ||
}); | ||
const sortRewriter = objectScan(Object.keys(sortCbs), { | ||
useArraySelector: false, | ||
joined: false, | ||
filterFn: (key, value, { | ||
matchedBy, | ||
parents, | ||
context | ||
}) => { | ||
assert(Array.isArray(parents[0]), 'Sort must be on "Array" type.'); | ||
const sortRewriter = (input, context) => { | ||
const lookups = []; | ||
return objectScan(Object.keys(sortCbs), { | ||
useArraySelector: false, | ||
joined: false, | ||
filterFn: (key, value, { | ||
matchedBy, | ||
parents | ||
}) => { | ||
assert(Array.isArray(parents[0]), 'Sort must be on "Array" type.'); | ||
if (context.lookups[key.length - 1] === undefined) { | ||
// eslint-disable-next-line no-param-reassign | ||
context.lookups[key.length - 1] = new Map(); | ||
} | ||
if (lookups[key.length - 1] === undefined) { | ||
lookups[key.length - 1] = new Map(); | ||
} | ||
const lookup = context.lookups[key.length - 1]; | ||
lookup.set(value, sortCbs[matchedBy[0]].fn(key, value, parents, context.context)); | ||
const lookup = lookups[key.length - 1]; | ||
lookup.set(value, sortCbs[matchedBy[0]].fn(key, value, parents, context)); | ||
if (key[key.length - 1] === 0) { | ||
parents[0].sort((a, b) => sortFn(lookup.get(a), lookup.get(b))); | ||
const limits = sortCbs[matchedBy[0]].plugins.filter(p => p.limit !== undefined).map(p => p.limit({ | ||
context: context.context | ||
})).filter(l => l !== undefined); | ||
if (key[key.length - 1] === 0) { | ||
parents[0].sort((a, b) => sortFn(lookup.get(a), lookup.get(b))); | ||
const limits = sortCbs[matchedBy[0]].plugins.filter(p => p.limit !== undefined).map(p => p.limit({ | ||
context | ||
})).filter(l => l !== undefined); | ||
if (limits.length !== 0) { | ||
assert(limits.every(l => Number.isInteger(l) && l >= 0)); | ||
parents[0].splice(Math.min(...limits)); | ||
} | ||
lookups.splice(key.length - 1); | ||
if (limits.length !== 0) { | ||
assert(limits.every(l => Number.isInteger(l) && l >= 0)); | ||
parents[0].splice(Math.min(...limits)); | ||
} | ||
return true; | ||
context.lookups.splice(key.length - 1); | ||
} | ||
})(input); | ||
}; | ||
return true; | ||
} | ||
}); | ||
return { | ||
@@ -213,5 +210,13 @@ fieldsToRequest, | ||
assert(context instanceof Object && !Array.isArray(context)); | ||
injectRewriter(input, context); | ||
filterRewriter(input, context); | ||
sortRewriter(input, context); | ||
injectRewriter(input, { | ||
context | ||
}); | ||
filterRewriter(input, { | ||
input, | ||
context | ||
}); | ||
sortRewriter(input, { | ||
lookups: [], | ||
context | ||
}); | ||
objectFields.retain(input, fields); | ||
@@ -223,2 +228,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2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ZC10ZXJuYXJ5XG4gICAgICBjb25zdCBrZXkgPSB0eXBlID09PSAnSU5KRUNUJ1xuICAgICAgICA/IHBsdWdpbi5wcmVmaXhcbiAgICAgICAgOiAocGx1Z2luLnRhcmdldC5lbmRzV2l0aCgnLicpID8gcGx1Z2luLnRhcmdldC5zbGljZSgwLCAtMSkgOiBwbHVnaW4udGFyZ2V0KTtcbiAgICAgIGlmIChwcmV2W2tleV0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBPYmplY3QuYXNzaWduKHByZXYsIHsgW2tleV06IFtdIH0pO1xuICAgICAgfVxuICAgICAgcHJldltrZXldLnB1c2gocGx1Z2luKTtcbiAgICAgIHJldHVybiBwcmV2O1xuICAgIH0sIHt9KTtcblxuICByZXR1cm4gT2JqZWN0XG4gICAgLmVudHJpZXModGFyZ2V0VG9QbHVnaW5zKVxuICAgIC5yZWR1Y2UoKHByZXYsIFt0YXJnZXQsIHBzXSkgPT4gT2JqZWN0LmFzc2lnbihwcmV2LCB7XG4gICAgICBbdGFyZ2V0XToge1xuICAgICAgICBmbjogKGtleSwgdmFsdWUsIHBhcmVudHMsIGNvbnRleHQpID0+IHtcbiAgICAgICAgICBjb25zdCBhcmdzID0ge1xuICAgICAgICAgICAga2V5LCB2YWx1ZSwgcGFyZW50cywgY29udGV4dFxuICAgICAgICAgIH07XG4gICAgICAgICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICAgICAgICBjYXNlICdJTkpFQ1QnOlxuICAgICAgICAgICAgICBwcy5mb3JFYWNoKChwKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gcC5mbihhcmdzKTtcbiAgICAgICAgICAgICAgICBhc3NlcnQocC5zY2hlbWEocmVzdWx0KSA9PT0gdHJ1ZSk7XG4gICAgICAgICAgICAgICAgc2V0KHZhbHVlLCBwLnRhcmdldFJlbCwgcmVzdWx0KTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIHJldHVybiB2YWx1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gbWF0Y2hlZEJ5LCBwYXJlbnRzIH0pID0+IHtcbiAgICAgICAgICBjb25zdCByZXN1bHQgPSBtYXRjaGVkQnkuc29tZSgobSkgPT4gZmlsdGVyQ2JzW21dLmZuKGtleSwgdmFsdWUsIHBhcmVudHMsIGNvbnRleHQpID09PSB0cnVlKTtcbiAgICAgICAgICBpZiAocmVzdWx0ID09PSBmYWxzZSkge1xuICAgICAgICAgICAgY29uc3QgcGFyZW50ID0ga2V5Lmxlbmd0aCA9PT0gMSA/IGlucHV0IDogcGFyZW50c1swXTtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHBhcmVudCkpIHtcbiAgICAgICAgICAgICAgcGFyZW50LnNwbGljZShrZXlba2V5Lmxlbmd0aCAtIDFdLCAxKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGRlbGV0ZSBwYXJlbnRba2V5W2tleS5sZW5ndGggLSAxXV07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH1cbiAgICAgIH0pKGlucHV0KTtcbiAgICAgIGNvbnN0IHNvcnRSZXdyaXRlciA9IChpbnB1dCwgY29udGV4dCkgPT4ge1xuICAgICAgICBjb25zdCBsb29rdXBzID0gW107XG4gICAgICAgIHJldHVybiBvYmplY3RTY2FuKE9iamVjdC5rZXlzKHNvcnRDYnMpLCB7XG4gICAgICAgICAgdXNlQXJyYXlTZWxlY3RvcjogZmFsc2UsXG4gICAgICAgICAgam9pbmVkOiBmYWxzZSxcbiAgICAgICAgICBmaWx0ZXJGbjogKGtleSwgdmFsdWUsIHsgbWF0Y2hlZEJ5LCBwYXJlbnRzIH0pID0+IHtcbiAgICAgICAgICAgIGFzc2VydChBcnJheS5pc0FycmF5KHBhcmVudHNbMF0pLCAnU29ydCBtdXN0IGJlIG9uIFwiQXJyYXlcIiB0eXBlLicpO1xuICAgICAgICAgICAgaWYgKGxvb2t1cHNba2V5Lmxlbmd0aCAtIDFdID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgbG9va3Vwc1trZXkubGVuZ3RoIC0gMV0gPSBuZXcgTWFwKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBsb29rdXAgPSBsb29rdXBzW2tleS5sZW5ndGggLSAxXTtcbiAgICAgICAgICAgIGxvb2t1cC5zZXQodmFsdWUsIHNvcnRDYnNbbWF0Y2hlZEJ5WzBdXS5mbihrZXksIHZhbHVlLCBwYXJlbnRzLCBjb250ZXh0KSk7XG4gICAgICAgICAgICBpZiAoa2V5W2tleS5sZW5ndGggLSAxXSA9PT0gMCkge1xuICAgICAgICAgICAgICBwYXJlbnRzWzBdLnNvcnQoKGEsIGIpID0+IHNvcnRGbihsb29rdXAuZ2V0KGEpLCBsb29rdXAuZ2V0KGIpKSk7XG4gICAgICAgICAgICAgIGNvbnN0IGxpbWl0cyA9IHNvcnRDYnNbbWF0Y2hlZEJ5WzBdXS5wbHVnaW5zXG4gICAgICAgICAgICAgICAgLmZpbHRlcigocCkgPT4gcC5saW1pdCAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgIC5tYXAoKHApID0+IHAubGltaXQoeyBjb250ZXh0IH0pKVxuICAgICAgICAgICAgICAgIC5maWx0ZXIoKGwpID0+IGwgIT09IHVuZGVmaW5lZCk7XG4gICAgICAgICAgICAgIGlmIChsaW1pdHMubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgYXNzZXJ0KGxpbWl0cy5ldmVyeSgobCkgPT4gTnVtYmVyLmlzSW50ZWdlcihsKSAmJiBsID49IDApKTtcbiAgICAgICAgICAgICAgICBwYXJlbnRzWzBdLnNwbGljZShNYXRoLm1pbiguLi5saW1pdHMpKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBsb29rdXBzLnNwbGljZShrZXkubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pKGlucHV0KTtcbiAgICAgIH07XG5cbiAgICAgIHJldHVybiB7XG4gICAgICAgIGZpZWxkc1RvUmVxdWVzdCxcbiAgICAgICAgcmV3cml0ZTogKGlucHV0LCBjb250ZXh0ID0ge30pID0+IHtcbiAgICAgICAgICBhc3NlcnQoY29udGV4dCBpbnN0YW5jZW9mIE9iamVjdCAmJiAhQXJyYXkuaXNBcnJheShjb250ZXh0KSk7XG4gICAgICAgICAgaW5qZWN0UmV3cml0ZXIoaW5wdXQsIGNvbnRleHQpO1xuICAgICAgICAgIGZpbHRlclJld3JpdGVyKGlucHV0LCBjb250ZXh0KTtcbiAgICAgICAgICBzb3J0UmV3cml0ZXIoaW5wdXQsIGNvbnRleHQpO1xuICAgICAgICAgIG9iamVjdEZpZWxkcy5yZXRhaW4oaW5wdXQsIGZpZWxkcyk7XG4gICAgICAgIH1cbiAgICAgIH07XG4gICAgfVxuICB9O1xufTtcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3Jld3JpdGVyLmpzIl0sIm5hbWVzIjpbImFzc2VydCIsInJlcXVpcmUiLCJzZXQiLCJvYmplY3RTY2FuIiwib2JqZWN0RmllbGRzIiwic29ydEZuIiwicGx1Z2luVHlwZXMiLCJjb21waWxlVGFyZ2V0VG9DYWxsYmFjayIsInR5cGUiLCJwbHVnaW5zIiwiZXZlcnkiLCJwIiwidGFyZ2V0VG9QbHVnaW5zIiwicmVkdWNlIiwicHJldiIsInBsdWdpbiIsImtleSIsInByZWZpeCIsInRhcmdldCIsImVuZHNXaXRoIiwic2xpY2UiLCJ1bmRlZmluZWQiLCJPYmplY3QiLCJhc3NpZ24iLCJwdXNoIiwiZW50cmllcyIsInBzIiwiZm4iLCJ2YWx1ZSIsInBhcmVudHMiLCJjb250ZXh0IiwiYXJncyIs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Ht9KTtcblxuICByZXR1cm4gT2JqZWN0XG4gICAgLmVudHJpZXModGFyZ2V0VG9QbHVnaW5zKVxuICAgIC5yZWR1Y2UoKHByZXYsIFt0YXJnZXQsIHBzXSkgPT4gT2JqZWN0LmFzc2lnbihwcmV2LCB7XG4gICAgICBbdGFyZ2V0XToge1xuICAgICAgICBmbjogKGtleSwgdmFsdWUsIHBhcmVudHMsIGNvbnRleHQpID0+IHtcbiAgICAgICAgICBjb25zdCBhcmdzID0ge1xuICAgICAgICAgICAga2V5LCB2YWx1ZSwgcGFyZW50cywgY29udGV4dFxuICAgICAgICAgIH07XG4gICAgICAgICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICAgICAgICBjYXNlICdJTkpFQ1QnOlxuICAgICAgICAgICAgICBwcy5mb3JFYWNoKChwKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gcC5mbihhcmdzKTtcbiAgICAgICAgICAgICAgICBhc3NlcnQocC5zY2hlbWEocmVzdWx0KSA9PT0gdHJ1ZSk7XG4gICAgICAgICAgICAgICAgc2V0KHZhbHVlLCBwLnRhcmdldFJlbCwgcmVzdWx0KTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgIGNhc2UgJ0ZJTFRFUic6XG4gICAgICAgICAgICAgIHJldHVybiBwcy5ldmVyeSgocCkgPT4gcC5mbihhcmdzKSk7XG4gICAgICAgICAgICBjYXNlICdTT1JUJzpcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgIHJldHVybiBwcy5tYXAoKHApID0+IHAuZm4oYXJncykpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcGx1Z2luczogcHNcbiAgICAgIH1cbiAgICB9KSwge30pO1xufTtcblxuY29uc3QgY29tcGlsZU1ldGEgPSAocGx1Z2lucywgZmllbGRzKSA9PiB7XG4gIGNvbnN0IHBsdWdpbnNCe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W2tleS5sZW5ndGggLSAxXSwgMSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBkZWxldGUgcGFyZW50W2tleVtrZXkubGVuZ3RoIC0gMV1dO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIGNvbnN0IHNvcnRSZXdyaXRlciA9IG9iamVjdFNjYW4oT2JqZWN0LmtleXMoc29ydENicyksIHtcbiAgICAgICAgdXNlQXJyYXlTZWxlY3RvcjogZmFsc2UsXG4gICAgICAgIGpvaW5lZDogZmFsc2UsXG4gICAgICAgIGZpbHRlckZuOiAoa2V5LCB2YWx1ZSwgeyBtYXRjaGVkQnksIHBhcmVudHMsIGNvbnRleHQgfSkgPT4ge1xuICAgICAgICAgIGFzc2VydChBcnJheS5pc0FycmF5KHBhcmVudHNbMF0pLCAnU29ydCBtdXN0IGJlIG9uIFwiQXJyYXlcIiB0eXBlLicpO1xuICAgICAgICAgIGlmIChjb250ZXh0Lmxvb2t1cHNba2V5Lmxlbmd0aCAtIDFdID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1wYXJhbS1yZWFzc2lnblxuICAgICAgICAgICAgY29udGV4dC5sb29rdXBzW2tleS5sZW5ndGggLSAxXSA9IG5ldyBNYXAoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29uc3QgbG9va3VwID0gY29udGV4dC5sb29rdXBzW2tleS5sZW5ndGggLSAxXTtcbiAgICAgICAgICBsb29rdXAuc2V0KHZhbHVlLCBzb3J0Q2JzW21hdGNoZWRCeVswXV0uZm4oa2V5LCB2YWx1ZSwgcGFyZW50cywgY29udGV4dC5jb250ZXh0KSk7XG4gICAgICAgICAgaWYgKGtleVtrZXkubGVuZ3RoIC0gMV0gPT09IDApIHtcbiAgICAgICAgICAgIHBhcmVudHNbMF0uc29ydCgoYSwgYikgPT4gc29ydEZuKGxvb2t1cC5nZXQoYSksIGxvb2t1cC5nZXQoYikpKTtcbiAgICAgICAgICAgIGNvbnN0IGxpbWl0cyA9IHNvcnRDYnNbbWF0Y2hlZEJ5WzBdXS5wbHVnaW5zXG4gICAgICAgICAgICAgIC5maWx0ZXIoKHApID0+IHAubGltaXQgIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgLm1hcCgocCkgPT4gcC5saW1pdCh7IGNvbnRleHQ6IGNvbnRleHQuY29udGV4dCB9KSlcbiAgICAgICAgICAgICAgLmZpbHRlcigobCkgPT4gbCAhPT0gdW5kZWZpbmVkKTtcbiAgICAgICAgICAgIGlmIChsaW1pdHMubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICAgIGFzc2VydChsaW1pdHMuZXZlcnkoKGwpID0+IE51bWJlci5pc0ludGVnZXIobCkgJiYgbCA+PSAwKSk7XG4gICAgICAgICAgICAgIHBhcmVudHNbMF0uc3BsaWNlKE1hdGgubWluKC4uLmxpbWl0cykpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29udGV4dC5sb29rdXBzLnNwbGljZShrZXkubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG4gICAgICB9KTtcblxuICAgICAgcmV0dXJuIHtcbiAgICAgICAgZmllbGRzVG9SZXF1ZXN0LFxuICAgICAgICByZXdyaXRlOiAoaW5wdXQsIGNvbnRleHQgPSB7fSkgPT4ge1xuICAgICAgICAgIGFzc2VydChjb250ZXh0IGluc3RhbmNlb2YgT2JqZWN0ICYmICFBcnJheS5pc0FycmF5KGNvbnRleHQpKTtcbiAgICAgICAgICBpbmplY3RSZXdyaXRlcihpbnB1dCwgeyBjb250ZXh0IH0pO1xuICAgICAgICAgIGZpbHRlclJld3JpdGVyKGlucHV0LCB7IGlucHV0LCBjb250ZXh0IH0pO1xuICAgICAgICAgIHNvcnRSZXdyaXRlcihpbnB1dCwgeyBsb29rdXBzOiBbXSwgY29udGV4dCB9KTtcbiAgICAgICAgICBvYmplY3RGaWVsZHMucmV0YWluKGlucHV0LCBmaWVsZHMpO1xuICAgICAgICB9XG4gICAgICB9O1xuICAgIH1cbiAgfTtcbn07XG4iXX0= |
{ | ||
"name": "object-rewrite", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Rewrite Object(s) in place using plugins.", | ||
@@ -13,3 +13,3 @@ "main": "lib/index.js", | ||
"object-fields": "1.3.32", | ||
"object-scan": "11.0.3" | ||
"object-scan": "11.1.0" | ||
}, | ||
@@ -32,5 +32,5 @@ "devDependencies": { | ||
"eslint-plugin-mocha": "6.3.0", | ||
"js-gardener": "2.0.146", | ||
"js-gardener": "2.0.148", | ||
"lodash.get": "4.4.2", | ||
"nyc": "15.0.0", | ||
"nyc": "15.0.1", | ||
"semantic-release": "17.0.4" | ||
@@ -37,0 +37,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53701
308
+ Addedobject-scan@11.1.0(transitive)
Updatedobject-scan@11.1.0