utils-lib-js 1.4.1 → 1.4.2
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/common/object.js +2 -2
- package/dist/common/types.d.ts +1 -1
- package/dist/esm/object.js +2 -2
- package/dist/esm/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/common/object.js
CHANGED
|
@@ -166,11 +166,11 @@ var classDecorator = function (params) {
|
|
|
166
166
|
};
|
|
167
167
|
exports.classDecorator = classDecorator;
|
|
168
168
|
var stringToJson = function (target) {
|
|
169
|
-
if ((0, index_js_1.getType)(target) !== "string") return
|
|
169
|
+
if ((0, index_js_1.getType)(target) !== "string") return null;
|
|
170
170
|
try {
|
|
171
171
|
return JSON.parse(target);
|
|
172
172
|
} catch (error) {
|
|
173
|
-
return
|
|
173
|
+
return null;
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
exports.stringToJson = stringToJson;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare type ICreateObject = <T, U extends T>(source: T) => U;
|
|
|
26
26
|
export declare type IInherit = <T extends Function>(source: T, target?: Function) => Function;
|
|
27
27
|
export declare type IGetInstance = (classProto: IInstance<FunctionConstructor>, overwrite?: boolean, ...params: any[]) => Function;
|
|
28
28
|
export declare type IClassDecorator = (params: IObject<any>) => <TFunction extends Function>(target: TFunction) => void;
|
|
29
|
-
export declare type IStringToJson = (target: string) => IObject<any
|
|
29
|
+
export declare type IStringToJson = (target: string) => IObject<any> | null;
|
|
30
30
|
export declare type IJsonToString = (target: IObject<any>) => string;
|
|
31
31
|
export declare type IThrottle = (fn: Function, time: number) => (...args: any[]) => void;
|
|
32
32
|
export declare type IDebounce = (fn: Function, time: number) => (...args: any[]) => void;
|
package/dist/esm/object.js
CHANGED
|
@@ -151,11 +151,11 @@ export var classDecorator = function (params) {
|
|
|
151
151
|
};
|
|
152
152
|
};
|
|
153
153
|
export var stringToJson = function (target) {
|
|
154
|
-
if (getType(target) !== "string") return
|
|
154
|
+
if (getType(target) !== "string") return null;
|
|
155
155
|
try {
|
|
156
156
|
return JSON.parse(target);
|
|
157
157
|
} catch (error) {
|
|
158
|
-
return
|
|
158
|
+
return null;
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
export var jsonToString = function (target) {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare type ICreateObject = <T, U extends T>(source: T) => U;
|
|
|
26
26
|
export declare type IInherit = <T extends Function>(source: T, target?: Function) => Function;
|
|
27
27
|
export declare type IGetInstance = (classProto: IInstance<FunctionConstructor>, overwrite?: boolean, ...params: any[]) => Function;
|
|
28
28
|
export declare type IClassDecorator = (params: IObject<any>) => <TFunction extends Function>(target: TFunction) => void;
|
|
29
|
-
export declare type IStringToJson = (target: string) => IObject<any
|
|
29
|
+
export declare type IStringToJson = (target: string) => IObject<any> | null;
|
|
30
30
|
export declare type IJsonToString = (target: IObject<any>) => string;
|
|
31
31
|
export declare type IThrottle = (fn: Function, time: number) => (...args: any[]) => void;
|
|
32
32
|
export declare type IDebounce = (fn: Function, time: number) => (...args: any[]) => void;
|