UNPKG

recoil

Version:

Recoil - A state management library for React

31 lines (25 loc) 1.14 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. * * Deep freeze values. Do not descend into React elements, Immutable structures, * or in general things that respond poorly to being frozen. Follows the * implementation of deepFreezeValue. * * @emails oncall+recoil * @flow strict-local * @format */ 'use strict'; const isArrayBufferView = require('./Recoil_isArrayBufferView'); const isNode = require('./Recoil_isNode'); const isPromise = require('./Recoil_isPromise'); const isSSR = typeof window === 'undefined'; const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative'; // eslint-disable-line fb-www/typeof-undefined declare function shouldNotBeFrozen(value: mixed): boolean; // Recursively freeze a value to enforce it is read-only. // This may also have minimal performance improvements for enumerating // objects (based on browser implementations, of course) declare function deepFreezeValue(value: mixed): any; module.exports = deepFreezeValue;