luoji
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

luoji

luoji means logic in Chinese.

Install

npm i luoji

Usage

import {and, or, not, assert} from 'luoji'
 
and(
  true,
  [1, '==', 1]
)
// true
 
or(
  true,
  [1, '===', 2]
)
// true
 
not(false)
// true
 
 
// Mix it up!
and(
  not(false),
  or(
    assert([1, '===', 1]),
    false
  )
)
// true

API

with

Assertion = boolean | [left, Comparation, right]
 
enum Comparation {
  '==',
  '===',
  '!=',
  '!==',
  '<',
  '>',
  '<=',
  '>=',
}

and

and(Assertion, ...)

return true if all assertions are true, otherwise false.

or

or(Assertion, ...)

return false if all assertions are false, otherwise true.

not

not(Assertion)

return false if assertion is true, true if assertion is false

assert

assert(Assertion)

get the result of assertion

License

MIT

Package Sidebar

Install

npm i luoji

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

7.17 kB

Total Files

7

Last publish

Collaborators

  • exoticknight