npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@compute.ts/boolean

v2.0.3

Published

Provide boolean operators for the computeTS package

Downloads

28

Readme

Presentation

The engine is based on incremental computation algorithms. When a calculation is submitted to the engine, all the computed values are memorized. So, if you change some variable and query an evaluation, the engine is able to compute the result very fast because it recomputes only what has changed.

compute.ts

Libraries

The project provides several libraries that each comes with dozens of operators. Please note the cross-compatibility of the libraries.

Imports

Typescript

import {/* required operators */} from '@compute.ts/boolean';

Javascript

const {/* required operators */} = require('@compute.ts/boolean');

Operators

boolean

boolean(value) ➜ xboolean

boolean() ➜ xboolean

The boolean operator allows you to create a boolean expression which evals to the given value. If no value is provided the expression is a variable of the model

import {boolean} from "@compute.ts/boolean";

const x0 = boolean(true);
x0.affect(false);

const x1 = boolean();
x1.affect(false);

True

True() ➜ xboolean

The True operator allows to create a boolean expression which evals to true

import {True} from "@compute.ts/boolean";

const x = True;
x.affect(false);

False

False() ➜ xboolean

The False operator allows to create a boolean expression which evals to false

import {False} from "@compute.ts/boolean";

const x = False;
x.affect(true);

isTrue

isTrue(xboolean) ➜ yboolean

xboolean.isTrue() ➜ yboolean

The isTrue operator allows to create a boolean expression which evals to true if the given boolean expression evals to true

import {boolean, isTrue} from "@compute.ts/boolean";

const x = boolean();  
const y = isTrue(x) | x.isTrue();

const value = y.eval();

isFalse

isFalse(xboolean) ➜ yboolean

xboolean.isFalse() ➜ yboolean

The isFalse operator allows to create a boolean expression which evals to true if the given boolean expression evals to false

import {boolean, isFalse} from "@compute.ts/boolean";

const x = boolean();  
const y = isFalse(x) | x.isFalse();

const value = y.eval();

not

not(xboolean) ➜ yboolean

xboolean.not() ➜ yboolean

The not operator allows to create a boolean expression which evals to true if the given boolean expression evals to false

import {boolean, not} from "@compute.ts/boolean";

const x = boolean();  
const y = not(x) | x.not();

const value = y.eval();

implies

implies(xboolean, yboolean) ➜ zboolean

xboolean.implies(yboolean) ➜ zboolean

The implies operator allows to create a boolean expression which evals to true if the given boolean expressions match the implies truth table

import {boolean, implies} from "@compute.ts/boolean";

const x = boolean();  
const y = boolean();  
const z = implies(x, y) | x.implies(y);

const value = z.eval();

equals

equals(xboolean, yboolean) ➜ zboolean

xboolean.equals(yboolean) ➜ zboolean

The equals operator allows you to create a boolean expression which evals to true if the given expressions evals to the same boolean value

import {boolean, equals} from "@compute.ts/boolean";

const x = boolean();  
const y = boolean();  
const z = equals(x, y) | x.equals(y);

const value = z.eval();

and

and(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.and(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The and operator allows to create a boolean expression which evals to true if the given boolean expressions match the AND truth table

import {boolean, and} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = and(x0, x1, ..., xn) | x0.and(x1, ..., xn);

const value = y.eval();

or

or(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.or(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The or operator allows to create a boolean expression which evals to true if the given boolean expressions match the OR truth table

import {boolean, or} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = or(x0, x1, ..., xn) | x0.or(x1, ..., xn);

const value = y.eval();

xand

or(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.or(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The xand operator allows to create a boolean expression which evals to true if the given boolean expressions match the XAND truth table

import {boolean, xand} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = xand(x0, x1, ..., xn) | x0.xand(x1, ..., xn);

const value = y.eval();

xor

xor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.xor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The xor operator allows to create a boolean expression which evals to true if the given boolean expressions match the XOR truth table

import {boolean, xor} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = xor(x0, x1, ..., xn) | x0.xor(x1, ..., xn);

const value = y.eval();

nand

nand(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.nand(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The nand operator allows to create a boolean expression which evals to true if the given boolean expressions match the NAND truth table

import {boolean, nand} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = nand(x0, x1, ..., xn) | x0.nand(x1, ..., xn);

const value = y.eval();

nor

nor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.nor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The nor operator allows to create a boolean expression which evals to true if the given boolean expressions match the NOR truth table

import {boolean, nor} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = nor(x0, x1, ..., xn) | x0.nor(x1, ..., xn);

const value = y.eval();

xnand

xnand(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.xnand(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The xnand operator allows to create a boolean expression which evals to true if the given boolean expressions match the XNAND truth table

import {boolean, xnand} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = xnand(x0, x1, ..., xn) `|` x0.xnand(x1, ..., xn);

const value = y.eval();

xnor

xnor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

xboolean.xnor(x0boolean, x1boolean, ..., xnboolean) ➜ yboolean

The xnor operator allows to create a boolean expression which evals to true if the given boolean expressions match the XNOR truth table

import {boolean, xnor} from "@compute.ts/boolean";

const x0 = boolean();  
const x1 = boolean();  
// ...  
const xn = boolean();

const y = xnor(x0, x1, ..., xn) | x0.xnor(x1, ..., xn);

const value = y.eval();

About the author

I am a software developer with 4 years of project specializing in the development of web solutions. Digital Nomad, I work while traveling. After 3 years into the french industry, I've started to work as a freelance software architect or fullstack developer.

Based on state-of-the-art web technologies, I offer you to architect & develop the best version of your project. My experience in the web app development assure you to build a nice looking, performant and stable product.

Minimalist, I like to travel, to meet people, learn new things and handmade stuff. Scuba & sky diving licenced. I like also hamburgers, Kinder chocolate and crepes. Karate black belt.

https://berthellemy.com/