Reference: multikeys
    Preparing search index...

    Class MKSet<K>

    Type Parameters

    • K = any
    Index

    Constructors

    • Creates a new MKSet object.

      Could be called with initial keys.

      const empty = new MKSet();
      const withKeys = new MKSet([
      ['key'],
      ['few', 'keys']
      ]);

      Type Parameters

      • K = any

      Parameters

      • Optionaliterable: Iterable<readonly K[], any, any>

      Returns MKSet<K>

    Accessors

    • get size(): number

      Returns the number of values in the MKSet object.

      Returns number

    Methods

    • Returns a new Iterator object that yields the keys for each element in the MKSet object.

      Returns IterableIterator<K[]>

    • Appends keys to the MKSet object.

      mkSet.add([1, 2, 3]);
      

      Parameters

      • keys: readonly K[]

      Returns void

    • Removes all elements from the MKSet object.

      Returns void

    • Removes the element associated to the keys and returns the value that MKSet.has(keys) would have previously returned. MKSet.has(keys) will return false afterwards.

      const mkSet = new MKSet([['foo']]);

      mkSet.delete(['foo']); // => true
      mkSet.delete(['foo']); // => false

      Parameters

      • keys: readonly K[]

      Returns boolean

    • Returns a new Iterator object that contains an array of [keys, keys] for each element in the MKSet object.

      Returns IterableIterator<[K[], K[]]>

    • Calls callbackFn once for each value present in the MKSet object.

      Parameters

      • callbackFn: (value: K[], key: K[], map: this) => void

      Returns void

    • Returns a boolean asserting whether an element is present with the given keys in the MKSet object or not.

      const mkSet = new MKSet([['foo']]);

      mkSet.has(['foo']); // => true
      mkSet.has(['bar']); // => false

      Parameters

      • keys: readonly K[]

      Returns boolean

    • Returns a new Iterator object that yields the keys for each element in the MKSet object. (this is the same as the values() method.)

      Returns IterableIterator<K[]>

    • Returns a new Iterator object that yields the keys for each element in the MKSet object. (this is the same as the keys() method.)

      Returns IterableIterator<K[]>