jjangga0214/haetae

feat(core, cli): QA json.stringify and yaml property order determinism

Closed this issue · 1 comments

feat(core, cli): QA json.stringify and yaml property order determinism

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))