|
1 | | -# boolean |
| 1 | +# boolean.js |
| 2 | +Function for simplifying boolean expressions. Loosely based on boolean.py from bastikr. |
| 3 | + |
| 4 | +## Install |
| 5 | + |
| 6 | +Will hopefully be soon on npm ... |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +Currently defined tokens: |
| 11 | +* '+': AND |
| 12 | +* '-': NOT |
| 13 | +* '|', '/': OR |
| 14 | +* '(': Left bracket |
| 15 | +* ')': Right bracket |
| 16 | + |
| 17 | +``` |
| 18 | + import booljs from "boolean"; |
| 19 | + console.log(booljs("a+1+b|0"); |
| 20 | +``` |
| 21 | +## Open Tasks/Laws |
| 22 | +Currently not implemente laws from https://booleanpy.readthedocs.io/en/latest/concepts.html#laws: |
| 23 | +* Associativity: x|(y|z) = x|y|z |
| 24 | +* Distributivity: x+(y|z) = x+y|x+z, x|y+z = (x|y)+(x|z) |
| 25 | +* De-Morgan: -(x|y) = (-x)+(-y) |
| 26 | +* Elimination: x+y|x+(-y) = x, (x|y)+(x|(-y)) = x |
| 27 | + |
| 28 | +## License |
| 29 | +MIT License |
| 30 | + |
| 31 | +Copyright (c) 2020 bigbug |
| 32 | + |
| 33 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 34 | +of this software and associated documentation files (the "Software"), to deal |
| 35 | +in the Software without restriction, including without limitation the rights |
| 36 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 37 | +copies of the Software, and to permit persons to whom the Software is |
| 38 | +furnished to do so, subject to the following conditions: |
| 39 | + |
| 40 | +The above copyright notice and this permission notice shall be included in all |
| 41 | +copies or substantial portions of the Software. |
| 42 | + |
| 43 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 44 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 45 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 46 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 47 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 48 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 49 | +SOFTWARE. |
0 commit comments