UNPKG

3.25 kBTypeScriptView Raw
1import * as React from 'react';
2/** @private is the value an empty array? */
3export declare const isEmptyArray: (value?: any) => boolean;
4/** @private is the given object a Function? */
5export declare const isFunction: (obj: any) => obj is Function;
6/** @private is the given object an Object? */
7export declare const isObject: (obj: any) => obj is Object;
8/** @private is the given object an integer? */
9export declare const isInteger: (obj: any) => boolean;
10/** @private is the given object a string? */
11export declare const isString: (obj: any) => obj is string;
12/** @private is the given object a NaN? */
13export declare const isNaN: (obj: any) => boolean;
14/** @private Does a React component have exactly 0 children? */
15export declare const isEmptyChildren: (children: any) => boolean;
16/** @private is the given object/value a promise? */
17export declare const isPromise: (value: any) => value is PromiseLike<any>;
18/** @private is the given object/value a type of synthetic event? */
19export declare const isInputEvent: (value: any) => value is React.SyntheticEvent<any, Event>;
20/**
21 * Same as document.activeElement but wraps in a try-catch block. In IE it is
22 * not safe to call document.activeElement if there is nothing focused.
23 *
24 * The activeElement will be null only if the document or document body is not
25 * yet defined.
26 *
27 * @param {?Document} doc Defaults to current document.
28 * @return {Element | null}
29 * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js
30 */
31export declare function getActiveElement(doc?: Document): Element | null;
32/**
33 * Deeply get a value from an object via its path.
34 */
35export declare function getIn(obj: any, key: string | string[], def?: any, p?: number): any;
36/**
37 * Deeply set a value from in object via it's path. If the value at `path`
38 * has changed, return a shallow copy of obj with `value` set at `path`.
39 * If `value` has not changed, return the original `obj`.
40 *
41 * Existing objects / arrays along `path` are also shallow copied. Sibling
42 * objects along path retain the same internal js reference. Since new
43 * objects / arrays are only created along `path`, we can test if anything
44 * changed in a nested structure by comparing the object's reference in
45 * the old and new object, similar to how russian doll cache invalidation
46 * works.
47 *
48 * In earlier versions of this function, which used cloneDeep, there were
49 * issues whereby settings a nested value would mutate the parent
50 * instead of creating a new object. `clone` avoids that bug making a
51 * shallow copy of the objects along the update path
52 * so no object is mutated in place.
53 *
54 * Before changing this function, please read through the following
55 * discussions.
56 *
57 * @see https://github.com/developit/linkstate
58 * @see https://github.com/jaredpalmer/formik/pull/123
59 */
60export declare function setIn(obj: any, path: string, value: any): any;
61/**
62 * Recursively a set the same value for all keys and arrays nested object, cloning
63 * @param object
64 * @param value
65 * @param visited
66 * @param response
67 */
68export declare function setNestedObjectValues<T>(object: any, value: any, visited?: any, response?: any): T;