recoil
Version:
Recoil - A state management library for React
31 lines (28 loc) • 1.16 kB
Flow
/**
* 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.
*
* @emails oncall+recoil
* @flow strict
* @format
*/
;
const isPromise = require('./Recoil_isPromise');
const TIME_WARNING_THRESHOLD_MS = 15;
type Options = $ReadOnly<{
allowFunctions?: boolean
}>;
declare function stringify(x: mixed, opt: Options, key?: string): string; // Utility similar to JSON.stringify() except:
// * Serialize built-in Sets as an Array
// * Serialize built-in Maps as an Object. Supports non-string keys.
// * Serialize other iterables as arrays
// * Sort the keys of Objects and Maps to have a stable order based on string conversion.
// This overrides their default insertion order.
// * Still uses toJSON() of any object to override serialization
// * Support Symbols (though don't guarantee uniqueness)
// * We could support BigInt, but Flow doesn't seem to like it.
// See Recoil_stableStringify-test.js for examples
declare function stableStringify(x: mixed, opt: Options): string;
module.exports = stableStringify;