feat(core, cli): QA json.stringify and yaml property order determinism
Closed this issue · 1 comments
jjangga0214 commented
feat(core, cli): QA json.stringify and yaml property order determinism
jjangga0214 commented
Property order is preserved.
import yaml from 'yaml'
const a = {
foo: 'foo',
bar: 'bar',
}
const b = {
foo: 'foo',
bar: 'bar',
}
// {"foo":"foo","bar":"bar"}
console.log(JSON.stringify(a, undefined, 2))
// {"bar":"bar","foo":"foo"}
console.log(JSON.stringify(b, undefined, 2))
/*
* foo: foo
* bar: bar
*/
console.log(yaml.stringify(a))
/*
* bar: bar
* foo: foo
*/
console.log(yaml.stringify(b))