theprogrammablemind_4wp
Advanced tools
Comparing version 7.7.0 to 7.8.0-beta.0
{ | ||
"devDependencies": { | ||
"eslint-plugin-import": "^2.23.4", | ||
"jest": "^26.6.3", | ||
"jest": "^29.7.0", | ||
"@typescript-eslint/parser": "^4.28.4", | ||
@@ -15,2 +15,3 @@ "@typescript-eslint/eslint-plugin": "^4.28.4", | ||
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json", | ||
"td": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json", | ||
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO23", | ||
@@ -68,4 +69,4 @@ "lint:fix": "eslint \"**/*.js\" --fix", | ||
}, | ||
"version": "7.7.0", | ||
"version": "7.8.0-beta.0", | ||
"license": "ISC" | ||
} |
@@ -172,3 +172,3 @@ const { args: contextArgs, normalizeGenerator } = require('./helpers') | ||
if (Array.isArray(context)) { | ||
return new Error("Expected a context not an array") | ||
throw new Error("Expected a context not an array") | ||
} | ||
@@ -183,3 +183,2 @@ if (typeof context !== 'object') { | ||
const response = args.response | ||
@@ -186,0 +185,0 @@ // args = { ...args, ...args.getAssumedScoped(assumed) } |
@@ -275,2 +275,4 @@ const deepEqual = require('deep-equal') | ||
return queryOrConfig | ||
} else if (typeof queryOrConfig == 'function') { | ||
return { apply: queryOrConfig.toString() } | ||
} else { | ||
@@ -338,2 +340,41 @@ const config = queryOrConfig | ||
const equalKey = (key1, key2) => { | ||
return key1[0] == key2[0] && key1[1] == key2[1] | ||
} | ||
// matches for { context: ..., [ordered], choose: ... } exactely OR | ||
// [ <id1>, <id2> ] - where id1 is chosen | ||
const subPriority = (sub, sup) => { | ||
if (Array.isArray(sub)) { | ||
const subChoosen = sub[0] | ||
const subOther = sub[1] | ||
const hasChoosen = sup.choose.find( (index) => equalKey(sup.context[index], subChoosen)) != undefined | ||
const hasOtherChosen = sup.choose.find( (index) => equalKey(sup.context[index], subOther)) != undefined | ||
const hasOther = sup.context.find( (other) => equalKey(other, subOther) ) !== undefined | ||
return !!(hasChoosen && hasOther) && !hasOtherChosen | ||
} | ||
if (!safeEquals([...sub.choose].sort(), [...sup.choose].sort())) { | ||
return false | ||
} | ||
const choose = (priority) => { | ||
const chosen = [] | ||
for (const i of priority.choose) { | ||
chosen.push(priority.context[i]) | ||
} | ||
return chosen | ||
} | ||
const chosen1 = choose(sub) | ||
const chosen2 = choose(sup) | ||
const sameId = (id1, id2) => id1[0] == id2[0] && id1[1] == id2[1] | ||
// same length so only need one way | ||
const missing1 = chosen1.find( (id1) => !chosen2.find( (id2) => sameId(id1, id2)) ) | ||
if (missing1) { | ||
return false | ||
} | ||
return true | ||
} | ||
module.exports = { | ||
@@ -359,3 +400,4 @@ ecatch, | ||
hashCode, | ||
sortJson | ||
sortJson, | ||
subPriority, | ||
} |
@@ -19,2 +19,5 @@ | ||
for (let properties of filter) { | ||
if (typeof properties == 'function') { | ||
properties = properties(object) | ||
} | ||
if (typeof properties == 'object') { | ||
@@ -21,0 +24,0 @@ if (properties.propertyLists) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
225897
6481
2