@wmfs/asl-choice-processor
Advanced tools
Comparing version 1.23.0 to 1.24.0
@@ -0,1 +1,15 @@ | ||
# [1.24.0](https://github.com/wmfs/asl-choice-processor/compare/v1.23.0...v1.24.0) (2022-09-15) | ||
### ✨ Features | ||
* IsBoolean operator ([b2ef9da](https://github.com/wmfs/asl-choice-processor/commit/b2ef9da9440fd8fd97f6ca413e6ac1947b31f546)) | ||
* IsString operator ([52fcedd](https://github.com/wmfs/asl-choice-processor/commit/52fcedd2df00c03027369882986f7d63c541a87c)) | ||
### 📦 Code Refactoring | ||
* tidy up IsNull and extend tests ([f5efe84](https://github.com/wmfs/asl-choice-processor/commit/f5efe84d1590c6d47dede3faeaa366c5012fbd0f)) | ||
* tidy up IsUndefined and extend tests ([00dea40](https://github.com/wmfs/asl-choice-processor/commit/00dea40f86d7bf5932841807d05ec6c73264941e)) | ||
# [1.23.0](https://github.com/wmfs/asl-choice-processor/compare/v1.22.0...v1.23.0) (2022-08-12) | ||
@@ -2,0 +16,0 @@ |
module.exports = { | ||
BooleanEquals: require('./boolean-equals'), | ||
Includes: require('./includes'), | ||
IsBoolean: require('./is-boolean'), | ||
IsUndefined: require('./is-undefined'), | ||
IsNull: require('./is-null'), | ||
IsPresent: require('./is-present'), | ||
IsString: require('./is-string'), | ||
NumericEquals: require('./numeric-equals'), | ||
@@ -8,0 +10,0 @@ NumericGreaterThan: require('./numeric-greater-than'), |
'use strict' | ||
module.exports = function isNullOperator (inputValue, comparisonValue, candidateStateName, cache) { | ||
let nextState | ||
const isNull = inputValue === null | ||
if (comparisonValue && inputValue === null) { | ||
nextState = candidateStateName | ||
} else if (!comparisonValue && inputValue !== null) { | ||
nextState = candidateStateName | ||
if (isNull && comparisonValue === true) { | ||
return candidateStateName | ||
} | ||
return nextState | ||
if (!isNull && comparisonValue !== true) { | ||
return candidateStateName | ||
} | ||
} |
'use strict' | ||
module.exports = function isUndefinedOperator (inputValue, comparisonValue, candidateStateName, cache) { | ||
let nextState | ||
if (comparisonValue === true) { | ||
if (inputValue === undefined) { | ||
nextState = candidateStateName | ||
} | ||
} else if (comparisonValue === false) { | ||
if (inputValue !== undefined) { | ||
nextState = candidateStateName | ||
} | ||
const isUndefined = inputValue === undefined | ||
if (isUndefined && comparisonValue === true) { | ||
return candidateStateName | ||
} | ||
return nextState | ||
if (!isUndefined && comparisonValue !== true) { | ||
return candidateStateName | ||
} | ||
} |
{ | ||
"name": "@wmfs/asl-choice-processor", | ||
"version": "1.23.0", | ||
"version": "1.24.0", | ||
"description": "For determining the next state given an Amazon States Language 'Choices' definition and a set of values.", | ||
@@ -5,0 +5,0 @@ "author": "West Midlands Fire Service", |
@@ -70,5 +70,46 @@ /* eslint-env mocha */ | ||
['HELLO_WORLD', false, 'NextState'], | ||
[undefined, false, 'NextState'], | ||
[0, false, 'NextState'], | ||
[false, false, 'NextState'], | ||
[null, false, 'DefaultState'], | ||
['HELLO_WORLD', true, 'DefaultState'] | ||
['HELLO_WORLD', true, 'DefaultState'], | ||
[undefined, true, 'DefaultState'], | ||
[0, true, 'DefaultState'], | ||
[false, true, 'DefaultState'] | ||
], | ||
IsUndefined: [ | ||
[undefined, true, 'NextState'], | ||
['HELLO_WORLD', false, 'NextState'], | ||
[null, false, 'NextState'], | ||
[0, false, 'NextState'], | ||
[false, false, 'NextState'], | ||
[undefined, false, 'DefaultState'], | ||
['HELLO_WORLD', true, 'DefaultState'], | ||
[null, true, 'DefaultState'], | ||
[0, true, 'DefaultState'], | ||
[false, true, 'DefaultState'] | ||
], | ||
IsBoolean: [ | ||
['nope', false, 'NextState'], | ||
[true, true, 'NextState'], | ||
[false, true, 'NextState'], | ||
['nope', true, 'DefaultState'], | ||
[true, false, 'DefaultState'], | ||
[false, false, 'DefaultState'] | ||
], | ||
IsString: [ | ||
['yep', true, 'NextState'], | ||
[0, false, 'NextState'], | ||
[true, false, 'NextState'], | ||
[undefined, false, 'NextState'], | ||
[null, false, 'NextState'], | ||
['yep', false, 'DefaultState'], | ||
[0, true, 'DefaultState'], | ||
[true, true, 'DefaultState'], | ||
[undefined, true, 'DefaultState'], | ||
[null, true, 'DefaultState'] | ||
] | ||
@@ -75,0 +116,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
66979
37
862