Module: lib/index

lib/index

Provides JS operators as curried functions.

Source:

Methods

<static> add()

Number → Number → Number

Addition.

Source:
Example
add(2)(3)          // => 2 + 3 => 5

<static> and()

Boolean → Boolean → Boolean

Logical conjunction.

Source:
Example
and(true, false)           // => true && false => false
and(true, true)            // => true && true => true

<static> bitAnd()

Int → Int → Int

Bitwise conjunction.

Source:
Example
bitAnd(0b110, 0b101)       // => 0b110 & 0b101 => 0b100

<static> bitNot()

Int → Int

Bitwise negation.

Source:
Example
bitNot(0b110)      // => ~0b110 => -0b111

<static> bitOr()

Int → Int → Int

Bitwise disjunction.

Source:
Example
bitOr(0b110, 0b101)        // => 0b110 | 0b101 => 0b111

<static> bitShiftLeft()

Int → Int → Int

Bitwise left shift.

Source:
Example
bitShiftLeft(0b10, 2)    // => 0b10 << 2   => 0b1000

<static> bitShiftRight()

Int → Int → Int

Sign-propagating bitwise right shift.

Source:
Example
bitShiftRight(0b1000, 2)   // => 0b1000 >> 2    => 0b10

<static> bitUnsignedShiftRight()

Int → Int → Int

Zero-fill bitwise right shift.

Source:
Example
bitUnsignedShiftRight(-0b1001, 2)  // => -0b1001 >>> 2     => 0b111111111111111111111111111101

<static> bitXor()

Int → Int → Int

Bitwise exclusive disjunction.

Source:
Example
bitXor(0b1000, 0b0110)     // => 0b1000 ^ 0b0110 => 0b1110
bitXor(0b110, 0b101)       // => 0b110 ^ 0b101 => 0b011

<static> classOf()

α → String

Returns the internal [[Class]] of the object.

Source:
Example
classOf('foo')     // => {}.toString.call('foo') => 'String'

<static> create()

(new(α₁, α₂, ..., αₙ) → β) → (α₁, α₂, ..., αₙ) → β

Constructs new objects.

Source:
Example
create(Array, 'foo')       // => new Array('foo')  => ['foo']

<static> decrement()

Number → Number

Decrement.

Source:
Example
decrement(2)       // => 1

<static> divide()

Number → Number → Number

Division.

Source:
Example
divide(4)(2)       // => 4 / 2 => 2

<static> equal()

α → α → Boolean

Strict equality.

Source:
Example
equal(1, '1')     // => 1 === '1' => false
equal(1, 1)       // => 1 === 1   => true

<static> get()

String → Object → α | Void

Property accessor.

Source:
Example
get('foo', { foo: 1 })     // => ({ foo: 1 })['foo'] => 1

<static> greaterOrEqualTo()

Number → Number → Boolean

Greater or equal to.

Source:
Example
greaterOrEqualTo(2, 2)     // => 2 >= 2 => true

<static> greaterThan()

Number → Number → Boolean

Greater than.

Source:
Example
greaterThan(2, 3)  // => 2 > 3 => false

<static> has()

String → Object → Boolean

Tests the existence of a property in an object.

Source:
Example
has('foo', { foo: 1 })  // => 'foo' in { foo: 1 } => true

<static> increment()

Number → Number

Increment.

Source:
Example
increment(1)       // => 2

<static> isInstance()

Function → Object → Boolean

Instance check.

Source:
Example
isInstance(Array, [1])     // => [1] instanceof Array => true

<static> lessOrEqualTo()

Number → Number → Boolean

Less or equal to.

Source:
Example
lessOrEqualTo(2, 3)        // => 2 <= 3 => true

<static> lessThan()

Number → Number → Boolean

Less than.

Source:
Example
lessThan(2, 3)             // => 2 < 3 => true

<static> modulus()

Number → Number → Number

Modulus.

Source:
Example
modulus(3)(2)      // => 3 % 2 => 1

<static> multiply()

Number → Number → Number

Multiplication.

Source:
Example
multiply(2)(3)     // => 2 * 3 => 6

<static> negate()

Number → Number

Negation.

Source:
Example
negate(1)          // => -1

<static> not()

Boolean → Boolean

Logical negation.

Source:
Example
not(false)         // => !false => true

<static> notEqual()

α → α → Boolean

Strict inequality.

Source:
Example
notEqual(1, '1')  // => 1 !== '1' => true
notEqual(1, 1)    // => 1 !== 1   => false

<static> or()

Boolean → Boolean → Boolean

Logical disjunction.

Source:
Example
or(true, false)            // => true || false => true
or(false, false)           // => false || false => false

<static> subtract()

Number → Number → Number

Subtraction.

Source:
Example
subtract(2)(3)     // => 2 - 3 => -1

<static> typeOf()

α → String

Returns the internal type of the object.

Source:
Example
typeOf('foo')        // => typeof 'foo' => 'string'