Options
All
  • Public
  • Public/Protected
  • All
Menu

Package logic

@typed/logic

Composable logic operations

Index

Type aliases

Conditional

Conditional<A, B>: [Predicate<A>, (value: A) => B]
name

Conditional

Type parameters

  • A

  • B

Equals

Equals: { <A>(a: A, b: unknown): b is A; <A>(a: A): Is<A> }

Type declaration

    • <A>(a: A, b: unknown): b is A
    • <A>(a: A): Is<A>
    • Type parameters

      • A

      Parameters

      • a: A
      • b: unknown

      Returns b is A

    • Type parameters

      • A

      Parameters

      • a: A

      Returns Is<A>

JsonSerializable

JsonSerializable: JsonPrimitive | ReadonlyArray<JsonSerializable> | JsonSerializableRecord | ReadonlyMap<JsonSerializable, JsonSerializable> | ReadonlySet<JsonSerializable>

Variables

Const all

all: { <A>(predicate: Predicate<A>, value: ReadonlyArray<A>): boolean; <A>(predicate: Predicate<A>): Predicate<ReadonlyArray<A>> } = curry(__all)

Returns true if all values in a list match a predicate, false otherwise.

param

:: (a -> boolean)

param

:: [a]

returns

:: boolean

Type declaration

    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • value: ReadonlyArray<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns Predicate<ReadonlyArray<A>>

Const allPass

allPass: { <A>(predicates: ReadonlyArray<Predicate<A>>, value: A): boolean; <A>(predicates: ReadonlyArray<Predicate<A>>): Predicate<A> } = curry(__allPass) as {<A>(predicates: ReadonlyArray<Predicate<A>>, value: A): boolean<A>(predicates: ReadonlyArray<Predicate<A>>): Predicate<A>}

Returns true if value matches a list of predicates.

param

:: [(a -> boolean)]

param

:: a

returns

:: boolean

Type declaration

    • Type parameters

      • A

      Parameters

      • predicates: ReadonlyArray<Predicate<A>>
      • value: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns Predicate<A>

Const and

and: { <A, B>(predicate1: Is<A>, predicate2: Is<B>, value: unknown): value is A & B; <A, B>(predicate1: Is<A>, predicate2: Is<B>): (value: unknown) => value is A & B; <A>(predicate1: Is<A>): { <B>(predicate2: Is<B>, value: unknown): value is A & B; <B>(predicate2: Is<B>): (value: unknown) => value is A & B }; <A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean; <A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A>; <A>(predicate1: Predicate<A>): { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> } } = curry(__and) as {<C, A extends C, B extends C>(predicate1: Is<A>, predicate2: Is<B>, value: C): value is A & B<C, A extends C, B extends C>(predicate1: Is<A>, predicate2: Is<B>): (value: C) => value is A & B<C, A extends C>(predicate1: Is<A>): {<B extends C>(predicate2: Is<B>, value: C): value is A & B<B extends C>(predicate2: Is<B>): (value: C) => value is A & B}<A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean<A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A><A>(predicate1: Predicate<A>): {(predicate2: Predicate<A>, value: A): boolean(predicate2: Predicate<A>): Predicate<A>}}

Returns true if both predicates return true.

param

:: (a -> boolean)

param

:: (a -> boolean)

param

:: a

returns

:: boolean

Type declaration

    • <A, B>(predicate1: Is<A>, predicate2: Is<B>, value: unknown): value is A & B
    • <A, B>(predicate1: Is<A>, predicate2: Is<B>): (value: unknown) => value is A & B
    • <A>(predicate1: Is<A>): { <B>(predicate2: Is<B>, value: unknown): value is A & B; <B>(predicate2: Is<B>): (value: unknown) => value is A & B }
    • <A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean
    • <A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A>
    • <A>(predicate1: Predicate<A>): { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> }
    • Type parameters

      • A

      • B

      Parameters

      • predicate1: Is<A>
      • predicate2: Is<B>
      • value: unknown

      Returns value is A & B

    • Type parameters

      • A

      • B

      Parameters

      • predicate1: Is<A>
      • predicate2: Is<B>

      Returns (value: unknown) => value is A & B

        • (value: unknown): value is A & B
        • Parameters

          • value: unknown

          Returns value is A & B

    • Type parameters

      • A

      Parameters

      • predicate1: Is<A>

      Returns { <B>(predicate2: Is<B>, value: unknown): value is A & B; <B>(predicate2: Is<B>): (value: unknown) => value is A & B }

        • <B>(predicate2: Is<B>, value: unknown): value is A & B
        • <B>(predicate2: Is<B>): (value: unknown) => value is A & B
        • Type parameters

          • B

          Parameters

          • predicate2: Is<B>
          • value: unknown

          Returns value is A & B

        • Type parameters

          • B

          Parameters

          • predicate2: Is<B>

          Returns (value: unknown) => value is A & B

            • (value: unknown): value is A & B
            • Parameters

              • value: unknown

              Returns value is A & B

    • Type parameters

      • A

      Parameters

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns Predicate<A>

    • Type parameters

      • A

      Parameters

      Returns { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> }

Const any

any: { <A>(predicate: Predicate<A>, list: keyof A[]): boolean; <A>(predicate: Predicate<A>): (list: keyof A[]) => boolean } = curry(__any) as {<A>(predicate: Predicate<A>, list: readonly A[]): boolean<A>(predicate: Predicate<A>): (list: readonly A[]) => boolean}

Returns true if any values in a list pass the given predicate.

param

:: (a -> boolean)

param

:: [a]

returns

:: boolean

Type declaration

    • <A>(predicate: Predicate<A>, list: keyof A[]): boolean
    • <A>(predicate: Predicate<A>): (list: keyof A[]) => boolean
    • Type parameters

      • A

      Parameters

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns (list: keyof A[]) => boolean

        • (list: keyof A[]): boolean
        • Parameters

          • list: keyof A[]

          Returns boolean

Const anyPass

anyPass: { <A>(predicates: ReadonlyArray<Predicate<A>>, value: A): boolean; <A>(predicates: ReadonlyArray<Predicate<A>>): (value: A) => boolean } = curry(__anyPass) as {<A>(predicates: ReadonlyArray<Predicate<A>>, value: A): boolean<A>(predicates: ReadonlyArray<Predicate<A>>): (value: A) => boolean}

Returns true if value matches any predicates

param

:: [(a -> boolean)]

param

:: a

returns

:: boolean

Type declaration

    • <A>(predicates: ReadonlyArray<Predicate<A>>, value: A): boolean
    • <A>(predicates: ReadonlyArray<Predicate<A>>): (value: A) => boolean
    • Type parameters

      • A

      Parameters

      • predicates: ReadonlyArray<Predicate<A>>
      • value: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns (value: A) => boolean

        • (value: A): boolean
        • Parameters

          • value: A

          Returns boolean

Const cond

cond: { <A, B>(conditions: ReadonlyArray<Conditional<A, B>>, value: A): Maybe<B>; <A, B>(conditions: ReadonlyArray<Conditional<A, B>>): (value: A) => Maybe<B> } = curry(__cond) as {<A, B>(conditions: ReadonlyArray<Conditional<A, B>>, value: A): Maybe<B><A, B>(conditions: ReadonlyArray<Conditional<A, B>>): (value: A) => Maybe<B>}

Basic pattern matching

param

:: [((a -> boolean), (a -> b))]

param

:: a

returns

:: Maybe b

Type declaration

    • Type parameters

      • A

      • B

      Parameters

      • conditions: ReadonlyArray<Conditional<A, B>>
      • value: A

      Returns Maybe<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns (value: A) => Maybe<B>

        • Parameters

          • value: A

          Returns Maybe<B>

Const equals

equals: Equals = curry(<A>(a: A, b: A) => _equals(a, b, [], [])) as Equals

Check if two values have value-equality.

param

:: a

param

:: a

returns

:: boolean

Const equalsBy

equalsBy: { <A, B>(by: Arity1<A, B>, a: A, b: A): boolean; <A, B>(by: Arity1<A, B>, a: A): (b: A) => boolean; <A, B>(by: Arity1<A, B>): { (a: A, b: A): boolean; (a: A): (b: A) => boolean } } = curry(<A, B>(by: Arity1<A, B>, a: A, b: A): boolean => equals(by(a), by(b)))

Type declaration

    • <A, B>(by: Arity1<A, B>, a: A, b: A): boolean
    • <A, B>(by: Arity1<A, B>, a: A): (b: A) => boolean
    • <A, B>(by: Arity1<A, B>): { (a: A, b: A): boolean; (a: A): (b: A) => boolean }
    • Type parameters

      • A

      • B

      Parameters

      Returns boolean

    • Type parameters

      • A

      • B

      Parameters

      Returns (b: A) => boolean

        • (b: A): boolean
        • Parameters

          • b: A

          Returns boolean

    • Type parameters

      • A

      • B

      Parameters

      Returns { (a: A, b: A): boolean; (a: A): (b: A) => boolean }

        • (a: A, b: A): boolean
        • (a: A): (b: A) => boolean
        • Parameters

          • a: A
          • b: A

          Returns boolean

        • Parameters

          • a: A

          Returns (b: A) => boolean

            • (b: A): boolean
            • Parameters

              • b: A

              Returns boolean

Const greaterThan

greaterThan: { <A>(right: A, left: A): boolean; <A>(right: A): (left: A) => boolean } = curry(<A>(right: A, left: A) => left > right) as {<A>(right: A, left: A): boolean<A>(right: A): (left: A) => boolean}

Compares two values with >

param

:: a

param

:: b

returns

:: boolean

Type declaration

    • <A>(right: A, left: A): boolean
    • <A>(right: A): (left: A) => boolean
    • Type parameters

      • A

      Parameters

      • right: A
      • left: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      • right: A

      Returns (left: A) => boolean

        • (left: A): boolean
        • Parameters

          • left: A

          Returns boolean

Const greaterThanOrEqual

greaterThanOrEqual: { <A>(right: A, left: A): boolean; <A>(right: A): (left: A) => boolean } = curry(<A>(right: A, left: A) => left >= right) as {<A>(right: A, left: A): boolean<A>(right: A): (left: A) => boolean}

Compares two values with >=

param

:: a

param

:: b

returns

:: boolean

Type declaration

    • <A>(right: A, left: A): boolean
    • <A>(right: A): (left: A) => boolean
    • Type parameters

      • A

      Parameters

      • right: A
      • left: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      • right: A

      Returns (left: A) => boolean

        • (left: A): boolean
        • Parameters

          • left: A

          Returns boolean

Const ifElse

ifElse: IfElseFn = curry(__ifElse) as IfElseFn

If-else statement for functions.

param

:: (a -> boolean)

param

:: (a -> b)

param

:: (a -> b)

param

:: a

returns

:: b

Const isBoolean

isBoolean: Is<boolean> = or(isTrue, isFalse)

isFalse

isFalse: (value: unknown) => value is A

Type declaration

    • (value: unknown): value is A
    • Parameters

      • value: unknown

      Returns value is A

Const isJson

isJson: Is<Json> = or(isJsonPrimitive, or(isJsonArray, isJsonObject))

Const isJsonPrimitive

isJsonPrimitive: Is<JsonPrimitive> = or(isString, or(isNumber, or(isBoolean, isNull)))

Const isNotArray

isNotArray: <B>(value: A | B) => value is B = pipe2(isArray, not) as IsNot<ReadonlyArray<unknown>>

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

Const isNotArrayLike

isNotArrayLike: <B>(value: A | B) => value is B = complement(isArrayLike)

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

Const isNotBoolean

isNotBoolean: IsNot<boolean> = complement(isBoolean)

Const isNotDate

isNotDate: IsNot<Date> = complement(isDate)

isNotFalse

isNotFalse: <B>(value: A | B) => value is B

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

Const isNotFunction

isNotFunction: IsNot<Function> = complement(isFunction)

Const isNotGenerator

isNotGenerator: <B>(value: A | B) => value is B = complement(isGenerator)

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

Const isNotIterable

isNotIterable: IsNot<Iterable<unknown>> = complement(isIterable)

Const isNotIterator

isNotIterator: IsNot<Iterator<unknown>> = complement(isIterable)

Const isNotJson

isNotJson: IsNot<Json> = complement(isJson)

Const isNotJsonArray

isNotJsonArray: IsNot<JsonArray> = complement(isJsonArray)

Const isNotJsonObject

isNotJsonObject: IsNot<JsonObject> = complement(isJsonObject)

Const isNotJsonPrimitive

isNotJsonPrimitive: IsNot<JsonPrimitive> = complement(isJsonPrimitive)

Const isNotMap

isNotMap: IsNot<Map<unknown, unknown>> = complement(isMap)

isNotNull

isNotNull: <B>(value: A | B) => value is B

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

Const isNotNumber

isNotNumber: IsNot<number> = complement(isNumber)

Const isNotObject

isNotObject: IsNot<object> = complement(isObject)

Const isNotPromiseLie

isNotPromiseLie: IsNot<PromiseLike<unknown>> = complement(isPromiseLike)

Const isNotRecord

isNotRecord: IsNot<Readonly<Record<PropertyKey, unknown>>> = complement(isRecord)

Const isNotSet

isNotSet: IsNot<Set<unknown>> = complement(isSet)

Const isNotString

isNotString: IsNot<string> = complement(isString)

isNotTrue

isNotTrue: <B>(value: A | B) => value is B

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

isNotUndefined

isNotUndefined: <B>(value: A | B) => value is B

Type declaration

    • <B>(value: A | B): value is B
    • Type parameters

      • B: unknown

      Parameters

      • value: A | B

      Returns value is B

isNull

isNull: (value: unknown) => value is A

Type declaration

    • (value: unknown): value is A
    • Parameters

      • value: unknown

      Returns value is A

isTrue

isTrue: (value: unknown) => value is A

Type declaration

    • (value: unknown): value is A
    • Parameters

      • value: unknown

      Returns value is A

isUndefined

isUndefined: (value: unknown) => value is A

Type declaration

    • (value: unknown): value is A
    • Parameters

      • value: unknown

      Returns value is A

Const lessThan

lessThan: { <A>(right: A, left: A): boolean; <A>(right: A): (left: A) => boolean } = curry(<A>(right: A, left: A) => left < right) as {<A>(right: A, left: A): boolean<A>(right: A): (left: A) => boolean}

Compare two values using <

param

:: a

param

:: a

returns

:: boolean

Type declaration

    • <A>(right: A, left: A): boolean
    • <A>(right: A): (left: A) => boolean
    • Type parameters

      • A

      Parameters

      • right: A
      • left: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      • right: A

      Returns (left: A) => boolean

        • (left: A): boolean
        • Parameters

          • left: A

          Returns boolean

Const lessThanOrEqual

lessThanOrEqual: { <A>(right: A, left: A): boolean; <A>(right: A): (left: A) => boolean } = curry(<A>(right: A, left: A) => left <= right) as {<A>(right: A, left: A): boolean<A>(right: A): (left: A) => boolean}

Compare two values using <=

param

:: a

param

:: a

returns

:: boolean

Type declaration

    • <A>(right: A, left: A): boolean
    • <A>(right: A): (left: A) => boolean
    • Type parameters

      • A

      Parameters

      • right: A
      • left: A

      Returns boolean

    • Type parameters

      • A

      Parameters

      • right: A

      Returns (left: A) => boolean

        • (left: A): boolean
        • Parameters

          • left: A

          Returns boolean

Const or

or: { <A, B>(predicate1: Is<A>, predicate2: Is<B>, value: unknown): value is A | B; <A, B>(predicate1: Is<A>, predicate2: Is<B>): (value: unknown) => value is A | B; <A>(predicate1: Is<A>): { <B>(predicate2: Is<B>, value: unknown): value is A | B; <B>(predicate2: Is<B>): Is<A | B> }; <A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean; <A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A>; <A>(predicate1: Predicate<A>): { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> } } = curry(__or) as {<C, A extends C, B extends C>(predicate1: Is<A>, predicate2: Is<B>, value: C): value is A | B<C, A extends C, B extends C>(predicate1: Is<A>, predicate2: Is<B>): (value: C) => value is A | B<C, A extends C>(predicate1: Is<A>): {<B extends C>(predicate2: Is<B>, value: C): value is A | B<B extends C>(predicate2: Is<B>): (value: C) => value is A | B}<A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean<A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A><A>(predicate1: Predicate<A>): {(predicate2: Predicate<A>, value: A): boolean(predicate2: Predicate<A>): Predicate<A>}}

Returns true if either predicates return true.

param

:: (a -> boolean)

param

:: (a -> boolean)

param

:: a

returns

:: boolean

Type declaration

    • <A, B>(predicate1: Is<A>, predicate2: Is<B>, value: unknown): value is A | B
    • <A, B>(predicate1: Is<A>, predicate2: Is<B>): (value: unknown) => value is A | B
    • <A>(predicate1: Is<A>): { <B>(predicate2: Is<B>, value: unknown): value is A | B; <B>(predicate2: Is<B>): Is<A | B> }
    • <A>(predicate1: Predicate<A>, predicate2: Predicate<A>, value: A): boolean
    • <A>(predicate1: Predicate<A>, predicate2: Predicate<A>): Predicate<A>
    • <A>(predicate1: Predicate<A>): { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> }
    • Type parameters

      • A

      • B

      Parameters

      • predicate1: Is<A>
      • predicate2: Is<B>
      • value: unknown

      Returns value is A | B

    • Type parameters

      • A

      • B

      Parameters

      • predicate1: Is<A>
      • predicate2: Is<B>

      Returns (value: unknown) => value is A | B

        • (value: unknown): value is A | B
        • Parameters

          • value: unknown

          Returns value is A | B

    • Type parameters

      • A

      Parameters

      • predicate1: Is<A>

      Returns { <B>(predicate2: Is<B>, value: unknown): value is A | B; <B>(predicate2: Is<B>): Is<A | B> }

        • <B>(predicate2: Is<B>, value: unknown): value is A | B
        • <B>(predicate2: Is<B>): Is<A | B>
        • Type parameters

          • B

          Parameters

          • predicate2: Is<B>
          • value: unknown

          Returns value is A | B

        • Type parameters

          • B

          Parameters

          • predicate2: Is<B>

          Returns Is<A | B>

    • Type parameters

      • A

      Parameters

      Returns boolean

    • Type parameters

      • A

      Parameters

      Returns Predicate<A>

    • Type parameters

      • A

      Parameters

      Returns { (predicate2: Predicate<A>, value: A): boolean; (predicate2: Predicate<A>): Predicate<A> }

Const propEq

propEq: { <K, A, O>(key: K, value: A, object: O): boolean; <K, A>(key: K, value: A): <O>(object: O) => boolean; <K>(key: K): { <A, O>(value: A, object: O): boolean; <A>(value: A): <O>(object: O) => boolean } } = (curry(<O, K extends keyof O>(key: K, value: O[K], obj: O): boolean =>equals(obj[key], value),) as any) as {<K extends PropertyKey, A, O extends Readonly<Record<K, A>>>(key: K, value: A, object: O): boolean<K extends PropertyKey, A>(key: K, value: A): <O extends Readonly<Record<K, A>>>(object: O,) => boolean<K extends PropertyKey>(key: K): {<A, O extends Readonly<Record<K, A>>>(value: A, object: O): boolean<A>(value: A): <O extends Readonly<Record<K, A>>>(object: O) => boolean}}

Returns true if a property is equal to a given value

param

:: PropertyKey

param

:: a

param

:: { [PropertyKey]: a }

returns

:: boolean

Type declaration

    • <K, A, O>(key: K, value: A, object: O): boolean
    • <K, A>(key: K, value: A): <O>(object: O) => boolean
    • <K>(key: K): { <A, O>(value: A, object: O): boolean; <A>(value: A): <O>(object: O) => boolean }
    • Type parameters

      • K: PropertyKey

      • A

      • O: Readonly<Record<K, A>>

      Parameters

      • key: K
      • value: A
      • object: O

      Returns boolean

    • Type parameters

      • K: PropertyKey

      • A

      Parameters

      • key: K
      • value: A

      Returns <O>(object: O) => boolean

        • <O>(object: O): boolean
        • Type parameters

          Parameters

          • object: O

          Returns boolean

    • Type parameters

      • K: PropertyKey

      Parameters

      • key: K

      Returns { <A, O>(value: A, object: O): boolean; <A>(value: A): <O>(object: O) => boolean }

        • <A, O>(value: A, object: O): boolean
        • <A>(value: A): <O>(object: O) => boolean
        • Type parameters

          Parameters

          • value: A
          • object: O

          Returns boolean

        • Type parameters

          • A

          Parameters

          • value: A

          Returns <O>(object: O) => boolean

            • <O>(object: O): boolean
            • Type parameters

              Parameters

              • object: O

              Returns boolean

Const propOr

propOr: { <A, K>(defaultValue: A, key: K, obj: {}): A; <A, K>(defaultValue: A, key: K): (obj: {}) => A; <A>(defaultValue: A): { <K>(key: K, obj: {}): A; <K>(key: K): (obj: {}) => A } } = curry(__propOr) as {<A, K extends PropertyKey>(defaultValue: A, key: K, obj: { [Key in K]: A }): A<A, K extends PropertyKey>(defaultValue: A, key: K): (obj: { [Key in K]: A }) => A<A>(defaultValue: A): {<K extends PropertyKey>(key: K, obj: { [Key in K]: A }): A<K extends PropertyKey>(key: K): (obj: { [Key in K]: A }) => A}}

Get the value of a property if present or use default value.

param

:: a

param

:: PropertyKey

param

:: { [PropertyKey]?: a }

returns

:: a

Type declaration

    • <A, K>(defaultValue: A, key: K, obj: {}): A
    • <A, K>(defaultValue: A, key: K): (obj: {}) => A
    • <A>(defaultValue: A): { <K>(key: K, obj: {}): A; <K>(key: K): (obj: {}) => A }
    • Type parameters

      • A

      • K: PropertyKey

      Parameters

      • defaultValue: A
      • key: K
      • obj: {}

      Returns A

    • Type parameters

      • A

      • K: PropertyKey

      Parameters

      • defaultValue: A
      • key: K

      Returns (obj: {}) => A

        • (obj: {}): A
        • Parameters

          • obj: {}

          Returns A

    • Type parameters

      • A

      Parameters

      • defaultValue: A

      Returns { <K>(key: K, obj: {}): A; <K>(key: K): (obj: {}) => A }

        • <K>(key: K, obj: {}): A
        • <K>(key: K): (obj: {}) => A
        • Type parameters

          • K: PropertyKey

          Parameters

          • key: K
          • obj: {}

          Returns A

        • Type parameters

          • K: PropertyKey

          Parameters

          • key: K

          Returns (obj: {}) => A

            • (obj: {}): A
            • Parameters

              • obj: {}

              Returns A

Const test

test: Curry2<RegExp, string, boolean> = curry((regex: RegExp, str: string): boolean =>regex.test(str),)

Const toggleOrSet

toggleOrSet: { (bool: boolean | undefined, toggleableBoolean: boolean): boolean; (bool: boolean | undefined): (toggleableBoolean: boolean) => boolean } = curry((bool: boolean | undefined, toggleableBoolean: boolean): boolean =>bool === void 0 ? !toggleableBoolean : bool,) as {(bool: boolean | undefined, toggleableBoolean: boolean): boolean(bool: boolean | undefined): (toggleableBoolean: boolean) => boolean}

Toggle a boolean off/on if given boolean is undefined or sets the value if boolean is not undefined.

param

:: boolean | undefined

param

:: boolean

returns

:: boolean

Type declaration

    • (bool: boolean | undefined, toggleableBoolean: boolean): boolean
    • (bool: boolean | undefined): (toggleableBoolean: boolean) => boolean
    • Parameters

      • bool: boolean | undefined
      • toggleableBoolean: boolean

      Returns boolean

    • Parameters

      • bool: boolean | undefined

      Returns (toggleableBoolean: boolean) => boolean

        • (toggleableBoolean: boolean): boolean
        • Parameters

          • toggleableBoolean: boolean

          Returns boolean

Functions

Const complement

  • complement<A, B>(fn: Arity1<A, B>): any

Const exec

  • exec(regex: RegExp, str: string): Nothing | Just<RegExpExecArray>

fromJson

Const is

  • is<A>(value: A): Is<A>

Const isAndIsNot

  • isAndIsNot<A>(value: A): keyof [Is<A>, IsNot<A>]

isArray

  • isArray(x: unknown): x is unknown[]

Const isArrayLike

  • isArrayLike(x: unknown): x is ArrayLike<unknown>

Const isDate

  • isDate(u: unknown): u is Date

Const isGenerator

  • isGenerator(x: unknown): x is Generator<unknown, unknown, unknown>

isIterable

  • isIterable(x: unknown): x is Iterable<unknown>

isIterator

  • isIterator(x: unknown): x is Iterator<unknown>

Const isJsonArray

  • isJsonArray(x: unknown): x is JsonArray

Const isJsonObject

  • isJsonObject(x: unknown): x is JsonObject

Const isNot

  • isNot<A>(a: A): IsNot<A>

Const isNumber

  • isNumber(u: unknown): u is number

Const isObject

  • isObject(u: unknown): u is object

Const isPromiseLike

  • isPromiseLike(x: unknown): x is PromiseLike<unknown>

Const isRecord

  • isRecord(u: unknown): u is Readonly<Record<PropertyKey, unknown>>

Const isString

  • isString(u: unknown): u is string

Const jsonReplace

Const jsonRevive

  • jsonRevive(json: Json): jsonRevive

not

  • not<A>(x: A): boolean

oneOf

  • oneOf<A, B>(matches: ReadonlyArray<Match<A, B>>): Match<A, B>

toJson

  • toJson<A>(x: A, space?: string | number): string

Generated using TypeDoc