Usage
Signature:
interface ImmutableKeySet<K>
Generic Parameters
Parameter Description K Type of Key
Typescript Import Format
//To use this interface, import as below.
import {ImmutableKeySet} from "ojs/ojkeyset";
For additional information visit:
Fields
-
(readonly) keys :{ all: true, keys?: never, deletedKeys: ImmutableKeySet.ImmutableSet<K>} | {all: false, keys: ImmutableKeySet.ImmutableSet<K>, deletedKeys?: never }
-
An object that contains either set of keys or set of deleted keys depending on whether or not this set represents all keys.
- Since:
- 14.0.0
Methods
-
add(keys: Set<K>|Array<K>): ImmutableKeySet<K>
-
Returns a new ImmutableKeySet based on this set with the specified keys included.
Parameters:
Name Type Description keys
Set | Array a set of keys to add to this set. - Since:
- 14.0.0
Returns:
a new ImmutableKeySet with the specified keys included, or the same instance if nothing was added.
- Type
- ImmutableKeySet
-
addAll(): ImmutableKeySet<K>
-
Returns a new ImmutableKeySet that represents all keys are included in this set.
- Since:
- 14.0.0
Returns:
a new ImmutableKeySet that represents all keys are included in this set, or the same instance if this set already include all keys.
- Type
- ImmutableKeySet
-
clear(): KeySet<K>
-
Returns a new ImmutableKeySet containing no keys, or the same instance if this set is already empty.
- Since:
- 14.0.0
Returns:
a new ImmutableKeySet with no keys.
- Type
- ImmutableKeySet
-
delete(keys: Set<K>|Array<K>): ImmutableKeySet<K>
-
Returns a new ImmutableKeySet based on this set with the specified keys excluded.
Parameters:
Name Type Description keys
Set | Array a set of keys to remove from this set. - Since:
- 14.0.0
Returns:
a new ImmutableKeySet with the specified keys excluded.
- Type
- KeySet
-
has(key) : {boolean}
-
Returns whether the specified key is contained in this set.
Parameters:
Name Type Description key
K the key to check whether it is contained in this set. - Since:
- 14.0.0
Returns:
true if the specified key is contained in this set, false otherwise.
- Type
- boolean
-
isAddAll : {boolean}
-
Returns whether this set should include all keys.
- Since:
- 14.0.0
Returns:
true if this set should include all keys, false otherwise.
- Type
- boolean