Closed KieronWiltshire closed 5 years ago
if you don't mind extending your schema, you could dictate that when a property's value is an object with a $ key, the value of the $ property is the "real" value and all other keys are meta information.
Your example above would generate something like...
'some-property':
comment: "blablabla"
$: undefined
All existing files would still have the same meaning as long as they have no $ keys. If there are any $ keys the conversion is relatively simple:
currencyStuff: $: "dollar sign"
# would be re-mapped to
currencyStuff: $: $: "dollar sign"
Alternatively, the CSON implementation could use Symbol('comment') to store comments in memory and then represent them with the usual # syntax. That might be simpler, assuming CSON doesn't allow Symbols. I didn't see any reference in source/index.coffee.
This seems a question for https://github.com/groupon/cson-parser
So I'd really love the ability to modify CSON objects directly, perhaps something like this: