Options
All
  • Public
  • Public/Protected
  • All
Menu

A Collection of unique values with O(log32 N) adds and has.

When iterating a Set, the entries will be (value, value) pairs. Iteration order of a Set is undefined, however is stable. Multiple iterations of the same Set will iterate in the same order.

Set values, like Map keys, may be of any type. Equality is determined using Immutable.is, enabling Sets to uniquely include other Immutable collections, custom value types, and NaN.

Index

Functions

  • Set.fromKeys() creates a new immutable Set containing the keys from this Collection or JavaScript Object.

    Type parameters

    • T

    Parameters

    Returns <internal>.Set<T>

  • Parameters

    • obj: {}
      • [key: string]: unknown

    Returns <internal>.Set<string>

  • Set.intersect() creates a new immutable Set that is the intersection of a collection of other sets.

    const { Set } = require('immutable')
    const intersected = Set.intersect([
    Set([ 'a', 'b', 'c' ])
    Set([ 'c', 'a', 't' ])
    ])
    // Set [ "a", "c" ]

    Type parameters

    • T

    Parameters

    Returns <internal>.Set<T>

  • True if the provided value is a Set

    Parameters

    • maybeSet: unknown

    Returns maybeSet is <internal>.Set<unknown>

  • Creates a new Set containing values.

    Type parameters

    • T

    Parameters

    • Rest ...values: T[]

    Returns <internal>.Set<T>

  • Set.union() creates a new immutable Set that is the union of a collection of other sets.

    const { Set } = require('immutable')
    const unioned = Set.union([
    Set([ 'a', 'b', 'c' ])
    Set([ 'c', 'a', 't' ])
    ])
    // Set [ "a", "b", "c", "t" ]

    Type parameters

    • T

    Parameters

    Returns <internal>.Set<T>

Generated using TypeDoc