Skip to content

Instantly share code, notes, and snippets.

@pmstss
Created February 7, 2022 09:27
Show Gist options
  • Save pmstss/f0252768f037ed68863e457d79e52d2a to your computer and use it in GitHub Desktop.
Save pmstss/f0252768f037ed68863e457d79e52d2a to your computer and use it in GitHub Desktop.
References in js-yaml serializer output
const yaml = require('js-yaml');
const auxObj = {
x: 0,
y: 1
}
const obj = {
a: auxObj,
b: auxObj,
c: {
d: auxObj,
...auxObj
},
e: {
x: 0,
y: 1
}
};
// a: &ref_0
// x: 0
// 'y': 1
// b: *ref_0
// c:
// d: *ref_0
// x: 0
// 'y': 1
// e:
// x: 0
// 'y': 1
console.log(yaml.dump(obj));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment