@compute.ts/boolean
Version:
Provide boolean operators for the computeTS package
1 lines • 3.25 kB
JavaScript
function and(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0;n<r.length;n++){var o=r[n];if(void 0===o)throw Error("The "+n+"eme value is undefined");if(null===o)throw Error("The "+n+"eme value is null");if(!1===o)return!1}return!0}function equals(r,e){if(void 0===r)throw Error("The x value is undefined");if(null===r)throw Error("The x value is null");if(void 0===e)throw Error("The y value is undefined");if(null===e)throw Error("The y value is null");return r===e}function implies(r,e){if(void 0===r)throw Error("The x value is undefined");if(null===r)throw Error("The x value is null");if(void 0===e)throw Error("The y value is undefined");if(null===e)throw Error("The y value is null");return!0===r&&!0===e||(!0!==r||!1!==e)}function isFalse(r){return!1===r}function isTrue(r){return!0===r}function nand(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0;n<r.length;n++){var o=r[n];if(void 0===o)throw Error("The "+n+"eme value is undefined");if(null===o)throw Error("The "+n+"eme value is null");if(!o)return!0}return!1}function nor(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0;n<r.length;n++){var o=r[n];if(void 0===o)throw Error("The "+n+"eme value is undefined");if(null===o)throw Error("The "+n+"eme value is null");if(o)return!1}return!0}function not(r){if(void 0===r)throw Error("The value is undefined");if(null===r)throw Error("The value is null");return!r}function or(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0;n<r.length;n++){var o=r[n];if(void 0===o)throw Error("The "+n+"eme value is undefined");if(null===o)throw Error("The "+n+"eme value is null");if(o)return!0}return!1}function xand(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0,o=0,i=0;i<r.length;i++){var l=r[i];if(void 0===l)throw Error("The "+i+"eme value is undefined");if(null===l)throw Error("The "+i+"eme value is null");l?n++:o++}return n===r.length||o===r.length}function xnand(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0,o=0,i=0;i<r.length;i++){var l=r[i];if(void 0===l)throw Error("The "+i+"eme value is undefined");if(null===l)throw Error("The "+i+"eme value is null");l?n++:o++}return!(n===r.length||o===r.length)}function xnor(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0,o=0;o<r.length;o++){var i=r[o];if(void 0===i)throw Error("The "+o+"eme value is undefined");if(null===i)throw Error("The "+o+"eme value is null");i&&n++}return!(n%2!=0)}function xor(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var n=0,o=0;o<r.length;o++){var i=r[o];if(void 0===i)throw Error("The "+o+"eme value is undefined");if(null===i)throw Error("The "+o+"eme value is null");i&&n++}return n%2!=0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.xor=exports.xnor=exports.xnand=exports.xand=exports.or=exports.not=exports.nor=exports.nand=exports.isTrue=exports.isFalse=exports.implies=exports.equals=exports.and=void 0,exports.and=and,exports.equals=equals,exports.implies=implies,exports.isFalse=isFalse,exports.isTrue=isTrue,exports.nand=nand,exports.nor=nor,exports.not=not,exports.or=or,exports.xand=xand,exports.xnand=xnand,exports.xnor=xnor,exports.xor=xor;
;