Comparing version 1.0.21 to 1.0.22
{ | ||
"name": "manyfest", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"description": "JSON Object Manifest for Data Description and Parsing", | ||
@@ -66,3 +66,2 @@ "main": "source/Manyfest.js", | ||
"dependencies": { | ||
"precedent": "^1.0.11" | ||
}, | ||
@@ -69,0 +68,0 @@ "author": "steven velozo <steven@velozo.com>", |
@@ -16,3 +16,3 @@ // When a boxed property is passed in, it should have quotes of some | ||
// TODO: Make a simple class include library with these | ||
let cleanWrapCharacters = (pCharacter, pString) => | ||
const cleanWrapCharacters = (pCharacter, pString) => | ||
{ | ||
@@ -19,0 +19,0 @@ if (pString.startsWith(pCharacter) && pString.endsWith(pCharacter)) |
@@ -5,4 +5,4 @@ /** | ||
let libSimpleLog = require('./Manyfest-LogToConsole.js'); | ||
let libPrecedent = require('precedent'); | ||
let fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js'); | ||
let fParseConditionals = require(`../source/Manyfest-ParseConditionals.js`) | ||
@@ -38,45 +38,2 @@ /** | ||
this.cleanWrapCharacters = fCleanWrapCharacters; | ||
this.precedent = new libPrecedent(); | ||
this.precedent.addPattern('<<~?', '?~>>', | ||
(pMagicSearchExpression, pData) => | ||
{ | ||
if (typeof(pMagicSearchExpression) !== 'string') | ||
{ | ||
return false; | ||
} | ||
// This expects a comma separated expression: | ||
// Some.Address.In.The.Object,==,Search Term to Match | ||
let tmpMagicComparisonPatternSet = pMagicSearchExpression.split(','); | ||
let tmpSearchAddress = tmpMagicComparisonPatternSet[0]; | ||
let tmpSearchComparator = tmpMagicComparisonPatternSet[1]; | ||
let tmpSearchValue = tmpMagicComparisonPatternSet[2]; | ||
switch(tmpSearchComparator) | ||
{ | ||
case '!=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) != tmpSearchValue); | ||
break; | ||
case '<': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) < tmpSearchValue); | ||
break; | ||
case '>': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) > tmpSearchValue); | ||
break; | ||
case '<=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) <= tmpSearchValue); | ||
break; | ||
case '>=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) >= tmpSearchValue); | ||
break; | ||
case '===': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) == tmpSearchValue); | ||
break; | ||
case '==': | ||
default: | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) == tmpSearchValue); | ||
break; | ||
} | ||
}); | ||
} | ||
@@ -87,21 +44,3 @@ | ||
{ | ||
let tmpPrecedent = new libPrecedent(); | ||
// If we don't copy the string, precedent takes it out for good. | ||
// TODO: Consider adding a "don't replace" option for precedent | ||
let tmpAddress = pAddress; | ||
// This allows the magic filtration with solver configuration | ||
// TODO: We could pass more state in (e.g. parent address, object, etc.) | ||
// TODO: Discuss this metaprogramming AT LENGTH | ||
let tmpFilterState = ( | ||
{ | ||
Record: pRecord, | ||
KeepRecord: true | ||
}); | ||
// This is about as complex as it gets. | ||
this.precedent.parseString(tmpAddress, tmpFilterState); | ||
return tmpFilterState.KeepRecord; | ||
return fParseConditionals(this, pAddress, pRecord); | ||
} | ||
@@ -108,0 +47,0 @@ |
@@ -5,4 +5,4 @@ /** | ||
let libSimpleLog = require('./Manyfest-LogToConsole.js'); | ||
let libPrecedent = require('precedent'); | ||
let fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js'); | ||
let fParseConditionals = require(`../source/Manyfest-ParseConditionals.js`) | ||
@@ -38,46 +38,2 @@ /** | ||
this.cleanWrapCharacters = fCleanWrapCharacters; | ||
this.precedent = new libPrecedent(); | ||
this.precedent.addPattern('<<~?', '?~>>', | ||
(pMagicSearchExpression, pData) => | ||
{ | ||
if (typeof(pMagicSearchExpression) !== 'string') | ||
{ | ||
return false; | ||
} | ||
// This expects a comma separated expression: | ||
// Some.Address.In.The.Object,==,Search Term to Match | ||
let tmpMagicComparisonPatternSet = pMagicSearchExpression.split(','); | ||
let tmpSearchAddress = tmpMagicComparisonPatternSet[0]; | ||
let tmpSearchComparator = tmpMagicComparisonPatternSet[1]; | ||
let tmpSearchValue = tmpMagicComparisonPatternSet[2]; | ||
switch(tmpSearchComparator) | ||
{ | ||
case '!=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) != tmpSearchValue); | ||
break; | ||
case '<': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) < tmpSearchValue); | ||
break; | ||
case '>': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) > tmpSearchValue); | ||
break; | ||
case '<=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) <= tmpSearchValue); | ||
break; | ||
case '>=': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) >= tmpSearchValue); | ||
break; | ||
case '===': | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) == tmpSearchValue); | ||
break; | ||
case '==': | ||
default: | ||
pData.KeepRecord = (this.getValueAtAddress(pData.Record, tmpSearchAddress) == tmpSearchValue); | ||
break; | ||
} | ||
}); | ||
} | ||
@@ -87,21 +43,3 @@ | ||
{ | ||
let tmpPrecedent = new libPrecedent(); | ||
// If we don't copy the string, precedent takes it out for good. | ||
// TODO: Consider adding a "don't replace" option for precedent | ||
let tmpAddress = pAddress; | ||
// This allows the magic filtration with configuration | ||
// TODO: We could pass more state in (e.g. parent address, object, etc.) | ||
// TODO: Discuss this metaprogramming AT LENGTH | ||
let tmpFilterState = ( | ||
{ | ||
Record: pRecord, | ||
KeepRecord: true | ||
}); | ||
// This is about as complex as it gets. | ||
this.precedent.parseString(tmpAddress, tmpFilterState); | ||
return tmpFilterState.KeepRecord; | ||
return fParseConditionals(this, pAddress, pRecord); | ||
} | ||
@@ -108,0 +46,0 @@ |
@@ -5,3 +5,2 @@ /** | ||
let libSimpleLog = require('./Manyfest-LogToConsole.js'); | ||
let libPrecedent = require('precedent'); | ||
let fCleanWrapCharacters = require('./Manyfest-CleanWrapCharacters.js'); | ||
@@ -8,0 +7,0 @@ |
@@ -6,4 +6,2 @@ /** | ||
let libPrecedent = require('precedent'); | ||
let libHashTranslation = require('./Manyfest-HashTranslation.js'); | ||
@@ -10,0 +8,0 @@ let libObjectAddressCheckAddressExists = require('./Manyfest-ObjectAddress-CheckAddressExists.js'); |
@@ -30,2 +30,22 @@ /** | ||
( | ||
'Underlying template processors should be able to filter sets.', | ||
(fTestComplete)=> | ||
{ | ||
let _Manyfest = new libManyfest(); | ||
let templateParser = require(`../source/Manyfest-ParseConditionals.js`); | ||
let tmpTestRecord = {Name:'Jimbo', Age:31, Pets:{Fido:'Dog',Spot:'Cat'}}; | ||
let tmpTestTemplate = 'Document.FormData.Parsable.Filters[]<<~?Name,==,Jimbo?~>>'; | ||
let tmpTestResult = templateParser(_Manyfest, tmpTestTemplate, tmpTestRecord); | ||
Expect(tmpTestResult).to.equal(true); | ||
return fTestComplete(); | ||
} | ||
) | ||
test | ||
( | ||
'Magic filters should be magic.', | ||
@@ -32,0 +52,0 @@ (fTestComplete)=> |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
0
55
248693
4461
9
- Removedprecedent@^1.0.11
- Removedprecedent@1.0.15(transitive)