boolean-json-bifurcate

boolean-json-bifurcate JS library on GitHub boolean-json-bifurcate JS library on npm Download boolean-json-bifurcate JS library

convert K-ary conjunctions and disjunctions to binary expressions

Version 0.1.2 License MIT
boolean-json-bifurcate has no homepage
boolean-json-bifurcate JS library on GitHub
boolean-json-bifurcate JS library on npm
Download boolean-json-bifurcate JS library
<script type="module"> import booleanJsonBifurcate from 'https://cdn.jsdelivr.net/npm/boolean-json-bifurcate@0.1.2/+esm' </script>
Learn more
var assert = require('assert')
var bifurcate = require('boolean-json-bifurcate')

assert.deepEqual(
  bifurcate({and: ['p', 'q']}),
  {and: ['p', 'q']}
)

assert.deepEqual(
  bifurcate({and: ['p', 'q', 'r', 's']}),
  {and: ['p', {and: ['q', {and: ['r', 's']}]}]}
)

assert.deepEqual(
  bifurcate({or: ['p', 'q', 'r', 's']}),
  {or: ['p', {or: ['q', {or: ['r', 's']}]}]}
)

assert.deepEqual(
  bifurcate({not: {or: [{not: 'p'}, 'q', 'r']}}),
  {not: {or: [{not: 'p'}, {or: ['q', 'r']}]}}
)