UNPKG

2.32 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
11export = get;
12
13declare function get<T>(obj: T): T;
14declare function get(obj: object, key: string | string[], options?: get.Options): any;
15
16declare namespace get {
17 interface Options {
18 /**
19 * The default value to return when get-value cannot result a value from the given object.
20 *
21 * default: `undefined`
22 */
23 default?: any;
24 /**
25 * If defined, this function is called on each resolved value.
26 * Useful if you want to do `.hasOwnProperty` or `Object.prototype.propertyIsEnumerable`.
27 */
28 isValid?: (<K extends string>(key: K, object: Record<K, any>) => boolean) | undefined;
29 /**
30 * Custom function to use for splitting the string into object path segments.
31 *
32 * default: `String.split`
33 */
34 split?: ((s: string) => string[]) | undefined;
35 /**
36 * The separator to use for spliting the string.
37 * (this is probably not needed when `options.split` is used).
38 *
39 * default: `"."`
40 */
41 separator?: string | RegExp | undefined;
42 /**
43 * Customize how the object path is created when iterating over path segments.
44 *
45 * default: `Array.join`
46 */
47 join?: ((segs: string[]) => string) | undefined;
48 /**
49 * The character to use when re-joining the string to check for keys
50 * with dots in them (this is probably not needed when `options.join` is used).
51 * This can be a different value than the separator, since the separator can be a string or regex.
52 *
53 * default: `"."`
54 */
55 joinChar?: string | undefined;
56 }
57}
58
59````
60
61### Additional Details
62 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
63 * Dependencies: none
64
65# Credits
66These definitions were written by [Daniel Rosenwasser](https://github.com/DanielRosenwasser).
67
\No newline at end of file