boolean-json-brute-force
v3.0.1
Published
solve a boolean-json expression by brute force
Downloads
4
Maintainers
Readme
var solve = require('boolean-json-brute-force')
The package exports a function of one boolean-json argument. It returns an object map from variable name to boolean value.
var assert = require('assert')
assert.deepEqual(
solve({and: ['a', 'b', 'c', 'd']}),
{a: true, b: true, c: true, d: true}
)
assert.deepEqual(
solve({and: ['a', {not: 'b'}, 'c']}),
{a: true, b: false, c: true}
)
Or, if there is no solution, it returns undefined
.
assert.deepEqual(
solve({and: ['a', {not: 'a'}]}),
undefined
)