yaml.load(yaml.dump(obj, options)), so that I can pass in options like no-refs.
yaml.load(yaml.dump(obj, options))
no-refs
I also use this to hash objects (options.sortKeys + SparkMD5)
options.sortKeys
Another options is to use lodash.cloneDeep
This will preserve special objects, such as RegExp or Date object.
BTW, if you don't need special objects, and want to preserve typing in TypeScript, you can
export function clone<T>(a: T): T { return JSON.parse(JSON.stringify(a)); }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
yaml.load(yaml.dump(obj, options))
, so that I can pass in options likeno-refs
.I also use this to hash objects (
options.sortKeys
+ SparkMD5)Another options is to use lodash.cloneDeep
This will preserve special objects, such as RegExp or Date object.
BTW, if you don't need special objects, and want to preserve typing in TypeScript, you can