UNPKG

recoil

Version:

Recoil - A state management library for React

28 lines (27 loc) 1.04 kB
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * Utilities for working with built-in Maps and Sets without mutating them. * * @emails oncall+recoil * @flow strict * @format */ 'use strict'; declare function setByAddingToSet<V>(set: $ReadOnlySet<V>, v: V): Set<V>; declare function setByDeletingFromSet<V>(set: $ReadOnlySet<V>, v: V): Set<V>; declare function mapBySettingInMap<K, V>(map: $ReadOnlyMap<K, V>, k: K, v: V): Map<K, V>; declare function mapByUpdatingInMap<K, V>(map: $ReadOnlyMap<K, V>, k: K, updater: (V | void) => V): Map<K, V>; declare function mapByDeletingFromMap<K, V>(map: $ReadOnlyMap<K, V>, k: K): Map<K, V>; declare function mapByDeletingMultipleFromMap<K, V>(map: $ReadOnlyMap<K, V>, ks: Set<K>): Map<K, V>; module.exports = { setByAddingToSet, setByDeletingFromSet, mapBySettingInMap, mapByUpdatingInMap, mapByDeletingFromMap, mapByDeletingMultipleFromMap };