@noah-libjs/utils 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es.js +4 -2
- package/dist/helper.d.ts +1 -1
- package/dist/lib.js +4 -2
- package/dist/typing.d.ts +1 -1
- package/package.json +2 -2
package/dist/es.js
CHANGED
|
@@ -1356,10 +1356,12 @@ var trim = function trim(str) {
|
|
|
1356
1356
|
return str.replace(regex, "");
|
|
1357
1357
|
};
|
|
1358
1358
|
function get(value, path, defaultValue) {
|
|
1359
|
+
var _a;
|
|
1360
|
+
var safe_path = toString(path);
|
|
1359
1361
|
//@ts-ignore
|
|
1360
|
-
var direct_value = value === null || value === void 0 ? void 0 : value[
|
|
1362
|
+
var direct_value = value === null || value === void 0 ? void 0 : value[safe_path];
|
|
1361
1363
|
if (direct_value) return direct_value;
|
|
1362
|
-
return get$1(value,
|
|
1364
|
+
return (_a = get$1(value, safe_path, defaultValue)) !== null && _a !== void 0 ? _a : defaultValue;
|
|
1363
1365
|
}
|
|
1364
1366
|
function identity(value) {
|
|
1365
1367
|
return value;
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyObject } from "./type-utils";
|
|
2
2
|
export * from "radash";
|
|
3
|
-
export declare function get<T = any>(value: any, path:
|
|
3
|
+
export declare function get<T = any>(value: any, path: any, defaultValue?: T | undefined): T | undefined;
|
|
4
4
|
export declare function identity<T>(value: T): T;
|
|
5
5
|
export declare function isBoolean(value: any): value is boolean;
|
|
6
6
|
export declare function isObjectLike(value: any): boolean;
|
package/dist/lib.js
CHANGED
|
@@ -1366,10 +1366,12 @@ var trim = function trim(str) {
|
|
|
1366
1366
|
return str.replace(regex, "");
|
|
1367
1367
|
};
|
|
1368
1368
|
function get(value, path, defaultValue) {
|
|
1369
|
+
var _a;
|
|
1370
|
+
var safe_path = toString(path);
|
|
1369
1371
|
//@ts-ignore
|
|
1370
|
-
var direct_value = value === null || value === void 0 ? void 0 : value[
|
|
1372
|
+
var direct_value = value === null || value === void 0 ? void 0 : value[safe_path];
|
|
1371
1373
|
if (direct_value) return direct_value;
|
|
1372
|
-
return get$1(value,
|
|
1374
|
+
return (_a = get$1(value, safe_path, defaultValue)) !== null && _a !== void 0 ? _a : defaultValue;
|
|
1373
1375
|
}
|
|
1374
1376
|
function identity(value) {
|
|
1375
1377
|
return value;
|
package/dist/typing.d.ts
CHANGED
|
@@ -704,7 +704,7 @@ declare const isPromise: (value: any) => value is Promise<any>;
|
|
|
704
704
|
declare const isEmpty: (value: any) => boolean;
|
|
705
705
|
declare const isEqual: <TType>(x: TType, y: TType) => boolean;
|
|
706
706
|
|
|
707
|
-
declare function get<T = any>(value: any, path:
|
|
707
|
+
declare function get<T = any>(value: any, path: any, defaultValue?: T | undefined): T | undefined;
|
|
708
708
|
declare function identity<T>(value: T): T;
|
|
709
709
|
declare function isBoolean(value: any): value is boolean;
|
|
710
710
|
declare function isObjectLike(value: any): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noah-libjs/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"keywords": [],
|
|
35
35
|
"author": "",
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d15c128601ecd86bad2f5787ab455df59563b6b9"
|
|
38
38
|
}
|