UNPKG

2.73 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/get-value`
3
4# Summary
5This package contains type definitions for get-value (https://github.com/jonschlinkert/get-value).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/get-value.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/get-value/index.d.ts)
10````ts
11// Type definitions for get-value 3.0
12// Project: https://github.com/jonschlinkert/get-value
13// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
14// Mathew Allen <https://github.com/TheMallen>
15// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16// TypeScript Version: 2.4
17
18export = get;
19
20declare function get<T>(obj: T): T;
21declare function get(obj: object, key: string | string[], options?: get.Options): any;
22
23declare namespace get {
24 interface Options {
25 /**
26 * The default value to return when get-value cannot result a value from the given object.
27 *
28 * default: `undefined`
29 */
30 default?: any;
31 /**
32 * If defined, this function is called on each resolved value.
33 * Useful if you want to do `.hasOwnProperty` or `Object.prototype.propertyIsEnumerable`.
34 */
35 isValid?: (<K extends string>(key: K, object: Record<K, any>) => boolean) | undefined;
36 /**
37 * Custom function to use for splitting the string into object path segments.
38 *
39 * default: `String.split`
40 */
41 split?: ((s: string) => string[]) | undefined;
42 /**
43 * The separator to use for spliting the string.
44 * (this is probably not needed when `options.split` is used).
45 *
46 * default: `"."`
47 */
48 separator?: string | RegExp | undefined;
49 /**
50 * Customize how the object path is created when iterating over path segments.
51 *
52 * default: `Array.join`
53 */
54 join?: ((segs: string[]) => string) | undefined;
55 /**
56 * The character to use when re-joining the string to check for keys
57 * with dots in them (this is probably not needed when `options.join` is used).
58 * This can be a different value than the separator, since the separator can be a string or regex.
59 *
60 * default: `"."`
61 */
62 joinChar?: string | undefined;
63 }
64}
65
66````
67
68### Additional Details
69 * Last updated: Tue, 06 Jul 2021 20:33:04 GMT
70 * Dependencies: none
71 * Global values: none
72
73# Credits
74These definitions were written by [Daniel Rosenwasser](https://github.com/DanielRosenwasser), and [Mathew Allen](https://github.com/TheMallen).
75
\No newline at end of file