Actual Type: Method
Note: Stripped to generate better documentation.
Creates a Dictionary.
Optionaliterable: Iterable<readonly [string, T]> | nullAn iterable that yields [key, value] entries which will
be used to create the initial state of the Dictionary. keys
must be strings and values must be Serializable.
If not provided, the Dictionary is constructed with no entries.
A Dictionary.
Actual Type: Method
Note: Stripped to generate better documentation.
Creates a Dictionary by grouping items according to the keys
returned by callback.
An iterable that yields the values that will be grouped by
callback.
Can only contain Serializable values
Called for each item of items, returns the group the
item belongs to.
A Dictionary containing the groups.
const { containers } = createFutureMachine(db);
const items: number[] = [0,1,2,3,4,5,6,7,8,9];
const groups = containers.dictionary.groupBy(items, (item) => {
return item % 2 === 0 ? 'even' : 'odd';
});
// groups is a Dictionary containing List components:
// 'even' -> List([0, 2, 4, 6, 8])
// 'odd' -> List([1, 3, 5, 7, 9])
The API for Dictionarys.
The Serializable equivalent of a vanilla JavaScript
Map.