Skip to content

Commit 5d20cec

Browse files
committed
fix: dist/index.mjs missing in 4.0.0 #30 and
missing index.d.ts #28
1 parent 9f0735c commit 5d20cec

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

index.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
export = get;
2+
3+
declare function get<T>(obj: T): T;
4+
declare function get(obj: object, key: string | string[], options?: get.Options): any;
5+
6+
declare namespace get {
7+
interface Options {
8+
/**
9+
* The default value to return when get-value cannot result a value from the given object.
10+
*
11+
* default: `undefined`
12+
*/
13+
default?: any;
14+
/**
15+
* If defined, this function is called on each resolved value.
16+
* Useful if you want to do `.hasOwnProperty` or `Object.prototype.propertyIsEnumerable`.
17+
*/
18+
isValid?: (<K extends string>(key: K, object: Record<K, any>) => boolean) | undefined;
19+
/**
20+
* Custom function to use for splitting the string into object path segments.
21+
*
22+
* default: `String.split`
23+
*/
24+
split?: ((s: string) => string[]) | undefined;
25+
/**
26+
* The separator to use for spliting the string.
27+
* (this is probably not needed when `options.split` is used).
28+
*
29+
* default: `"."`
30+
*/
31+
separator?: string | RegExp | undefined;
32+
/**
33+
* Customize how the object path is created when iterating over path segments.
34+
*
35+
* default: `Array.join`
36+
*/
37+
join?: ((segs: string[]) => string) | undefined;
38+
/**
39+
* The character to use when re-joining the string to check for keys
40+
* with dots in them (this is probably not needed when `options.join` is used).
41+
* This can be a different value than the separator, since the separator can be a string or regex.
42+
*
43+
* default: `"."`
44+
*/
45+
joinChar?: string | undefined;
46+
}
47+
}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
"tsup": "npx tsup"
1818
},
1919
"files": [
20-
"dist/index.js"
20+
"dist/index.js",
21+
"dist/index.mjs",
22+
"index.d.ts"
2123
],
2224
"main": "dist/index.js",
2325
"module": "dist/index.mjs",
26+
"types": "index.d.ts",
2427
"exports": {
2528
".": {
29+
"types": "./index.d.ts",
2630
"import": "./dist/index.mjs",
2731
"require": "./dist/index.js"
2832
}

0 commit comments

Comments
 (0)