fix(core): update

This commit is contained in:
2019-12-15 19:05:20 +00:00
parent 62cf2fd262
commit fe9f9299fc
4 changed files with 347 additions and 146 deletions

View File

@ -6,7 +6,7 @@ export class Smartjson {
// ======
public static parse = JSON.parse;
public static stringify = (objArg: any, optionsArg: plugins.stableJson.Options) => {
public static stringify = (objArg: any, optionsArg: plugins.IStableJsonTypes['Options']) => {
return plugins.stableJson(objArg, optionsArg);
}

View File

@ -1,4 +1,18 @@
import lodashCloneDeep from 'lodash.clonedeep';
import stableJson from 'fast-json-stable-stringify';
import stableJson2 from 'fast-json-stable-stringify';
const stableJson = stableJson2 as any;
export { lodashCloneDeep, stableJson };
export interface IStableJsonTypes {
Comparator: (a: IStableJsonTypes['CompareDescriptor'], b: IStableJsonTypes['CompareDescriptor']) => number;
CompareDescriptor: {
key: string;
value: any;
};
Options: {
cmp?: (a: IStableJsonTypes['CompareDescriptor'], b: IStableJsonTypes['CompareDescriptor']) => number;
cycles?: boolean;
};
}