Options
All
  • Public
  • Public/Protected
  • All
Menu

Package set

@typed/set

Functions for working with immutable ReadonlySets

Index

Variables

Const add

add: { <A>(value: A, set: ReadonlySet<A>): ReadonlySet<A>; <A>(value: A): (set: ReadonlySet<A>) => ReadonlySet<A> } = curry(__add)

Type declaration

    • <A>(value: A, set: ReadonlySet<A>): ReadonlySet<A>
    • <A>(value: A): (set: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • value: A
      • set: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (set: ReadonlySet<A>) => ReadonlySet<A>

        • (set: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<A>

Const ap

ap: { <A, B>(fn: ReadonlySet<Arity1<A, B>>, value: ReadonlySet<A>): ReadonlySet<B>; <A, B>(fn: ReadonlySet<Arity1<A, B>>): (value: ReadonlySet<A>) => ReadonlySet<B> } = curry(<A, B>(fn: ReadonlySet<Arity1<A, B>>, value: ReadonlySet<A>): ReadonlySet<B> =>chain((f) => map(f, value), fn),)

Type declaration

    • <A, B>(fn: ReadonlySet<Arity1<A, B>>, value: ReadonlySet<A>): ReadonlySet<B>
    • <A, B>(fn: ReadonlySet<Arity1<A, B>>): (value: ReadonlySet<A>) => ReadonlySet<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: ReadonlySet<Arity1<A, B>>
      • value: ReadonlySet<A>

      Returns ReadonlySet<B>

    • Type parameters

      • A

      • B

      Parameters

      • fn: ReadonlySet<Arity1<A, B>>

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

        • (value: ReadonlySet<A>): ReadonlySet<B>
        • Parameters

          • value: ReadonlySet<A>

          Returns ReadonlySet<B>

Const chain

chain: { <A, B>(fn: Arity1<A, ReadonlySet<B>>, set: ReadonlySet<A>): ReadonlySet<B>; <A, B>(fn: Arity1<A, ReadonlySet<B>>): (set: ReadonlySet<A>) => ReadonlySet<B> } = curry(<A, B>(fn: Arity1<A, ReadonlySet<B>>, set: ReadonlySet<A>): ReadonlySet<B> => {const bs = new Set<B>()set.forEach((a) => fn(a).forEach((b) => bs.add(b)))return bs},)

Type declaration

    • <A, B>(fn: Arity1<A, ReadonlySet<B>>, set: ReadonlySet<A>): ReadonlySet<B>
    • <A, B>(fn: Arity1<A, ReadonlySet<B>>): (set: ReadonlySet<A>) => ReadonlySet<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: Arity1<A, ReadonlySet<B>>
      • set: ReadonlySet<A>

      Returns ReadonlySet<B>

    • Type parameters

      • A

      • B

      Parameters

      • fn: Arity1<A, ReadonlySet<B>>

      Returns (set: ReadonlySet<A>) => ReadonlySet<B>

        • (set: ReadonlySet<A>): ReadonlySet<B>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<B>

Const concat

concat: { <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A>; <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => ReadonlySet<A> } = curry(<A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A> => {const set = new Set()a.forEach((x) => set.add(x))b.forEach((x) => set.add(x))return set as ReadonlySet<A>},)

Type declaration

    • <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A>
    • <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>
      • b: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>

      Returns (b: ReadonlySet<A>) => ReadonlySet<A>

        • (b: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • b: ReadonlySet<A>

          Returns ReadonlySet<A>

Const difference

difference: { <A>(a: ReadonlySet<A>, differenceOf: ReadonlySet<A>): ReadonlySet<A>; <A>(a: ReadonlySet<A>): (differenceOf: ReadonlySet<A>) => ReadonlySet<A> } = curry(<A>(a: ReadonlySet<A>, differenceOf: ReadonlySet<A>): ReadonlySet<A> =>withMutations((x) => x.forEach((y) => a.has(y) && x.delete(y)), differenceOf),)

Type declaration

    • <A>(a: ReadonlySet<A>, differenceOf: ReadonlySet<A>): ReadonlySet<A>
    • <A>(a: ReadonlySet<A>): (differenceOf: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>
      • differenceOf: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>

      Returns (differenceOf: ReadonlySet<A>) => ReadonlySet<A>

        • (differenceOf: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • differenceOf: ReadonlySet<A>

          Returns ReadonlySet<A>

Const filter

filter: { <A>(predicate: Predicate<A>, set: ReadonlySet<A>): ReadonlySet<A>; <A>(predicate: Predicate<A>): (set: ReadonlySet<A>) => ReadonlySet<A> } = curry(__filter)

Type declaration

    • <A>(predicate: Predicate<A>, set: ReadonlySet<A>): ReadonlySet<A>
    • <A>(predicate: Predicate<A>): (set: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • predicate: Predicate<A>
      • set: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      Returns (set: ReadonlySet<A>) => ReadonlySet<A>

        • (set: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<A>

Const forEach

forEach: { <A>(fn: Arity1<A>, set: ReadonlySet<A>): ReadonlySet<A>; <A>(fn: Arity1<A>): (set: ReadonlySet<A>) => ReadonlySet<A> } = curry(__forEach)

Type declaration

    • <A>(fn: Arity1<A>, set: ReadonlySet<A>): ReadonlySet<A>
    • <A>(fn: Arity1<A>): (set: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • fn: Arity1<A>
      • set: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      Returns (set: ReadonlySet<A>) => ReadonlySet<A>

        • (set: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<A>

Const has

has: { <A>(value: A, set: ReadonlySet<A>): boolean; <A>(value: A): (set: ReadonlySet<A>) => boolean } = curry(__has)

Type declaration

    • <A>(value: A, set: ReadonlySet<A>): boolean
    • <A>(value: A): (set: ReadonlySet<A>) => boolean
    • Type parameters

      • A

      Parameters

      • value: A
      • set: ReadonlySet<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (set: ReadonlySet<A>) => boolean

        • (set: ReadonlySet<A>): boolean
        • Parameters

          • set: ReadonlySet<A>

          Returns boolean

Const intersection

intersection: { <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A>; <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => ReadonlySet<A> } = curry(<A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A> =>withMutations((x) => x.forEach((y) => !b.has(y) && x.delete(y)), a),)

Type declaration

    • <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): ReadonlySet<A>
    • <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>
      • b: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>

      Returns (b: ReadonlySet<A>) => ReadonlySet<A>

        • (b: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • b: ReadonlySet<A>

          Returns ReadonlySet<A>

Const map

map: { <A, B>(fn: Arity1<A, B>, set: ReadonlySet<A>): ReadonlySet<B>; <A, B>(fn: Arity1<A, B>): (set: ReadonlySet<A>) => ReadonlySet<B> } = curry(<A, B>(fn: Arity1<A, B>, set: ReadonlySet<A>): ReadonlySet<B> => {const bs = new Set<B>()set.forEach((a) => bs.add(fn(a)))return bs},)

Type declaration

    • <A, B>(fn: Arity1<A, B>, set: ReadonlySet<A>): ReadonlySet<B>
    • <A, B>(fn: Arity1<A, B>): (set: ReadonlySet<A>) => ReadonlySet<B>
    • Type parameters

      • A

      • B

      Parameters

      • fn: Arity1<A, B>
      • set: ReadonlySet<A>

      Returns ReadonlySet<B>

    • Type parameters

      • A

      • B

      Parameters

      Returns (set: ReadonlySet<A>) => ReadonlySet<B>

        • (set: ReadonlySet<A>): ReadonlySet<B>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<B>

Const remove

remove: { <A>(value: A, set: ReadonlySet<A>): ReadonlySet<A>; <A>(value: A): (set: ReadonlySet<A>) => ReadonlySet<A> } = curry(__remove)

Type declaration

    • <A>(value: A, set: ReadonlySet<A>): ReadonlySet<A>
    • <A>(value: A): (set: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • value: A
      • set: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • value: A

      Returns (set: ReadonlySet<A>) => ReadonlySet<A>

        • (set: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<A>

Const subset

subset: { <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): boolean; <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => boolean } = curry(__subset)

Type declaration

    • <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): boolean
    • <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => boolean
    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>
      • b: ReadonlySet<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>

      Returns (b: ReadonlySet<A>) => boolean

        • (b: ReadonlySet<A>): boolean
        • Parameters

          • b: ReadonlySet<A>

          Returns boolean

Const subsetOf

subsetOf: { <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): boolean; <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => boolean } = curry(__subsetOf)

Type declaration

    • <A>(a: ReadonlySet<A>, b: ReadonlySet<A>): boolean
    • <A>(a: ReadonlySet<A>): (b: ReadonlySet<A>) => boolean
    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>
      • b: ReadonlySet<A>

      Returns boolean

    • Type parameters

      • A

      Parameters

      • a: ReadonlySet<A>

      Returns (b: ReadonlySet<A>) => boolean

        • (b: ReadonlySet<A>): boolean
        • Parameters

          • b: ReadonlySet<A>

          Returns boolean

Const withMutations

withMutations: { <A>(fn: (set: Set<A>) => void, set: ReadonlySet<A>): ReadonlySet<A>; <A>(fn: (set: Set<A>) => void): (set: ReadonlySet<A>) => ReadonlySet<A> } = curry(__withMutations)

Type declaration

    • <A>(fn: (set: Set<A>) => void, set: ReadonlySet<A>): ReadonlySet<A>
    • <A>(fn: (set: Set<A>) => void): (set: ReadonlySet<A>) => ReadonlySet<A>
    • Type parameters

      • A

      Parameters

      • fn: (set: Set<A>) => void
          • (set: Set<A>): void
          • Parameters

            Returns void

      • set: ReadonlySet<A>

      Returns ReadonlySet<A>

    • Type parameters

      • A

      Parameters

      • fn: (set: Set<A>) => void
          • (set: Set<A>): void
          • Parameters

            Returns void

      Returns (set: ReadonlySet<A>) => ReadonlySet<A>

        • (set: ReadonlySet<A>): ReadonlySet<A>
        • Parameters

          • set: ReadonlySet<A>

          Returns ReadonlySet<A>

Functions

Const entries

  • entries<A>(set: ReadonlySet<A>): IterableIterator<[A, A]>

Const size

  • size(set: ReadonlySet<unknown>): number

Const valuesOf

  • valuesOf<A>(set: ReadonlySet<A>): IterableIterator<A>

Generated using TypeDoc