const fleece = require('golden-fleece');
const str = `{
string: 'hello',
number: 1,
array: [ 'a', 'b', 'c' ],
arrayWithoutSpaces: ['d', 'e', 'f'],
object: { foo: 99, "unnecessarilyQuotedProperty": null },
largerObject: {
// sometimes you need several lines
// for readability. Also, comments!
one: 'thing',
two: 'thing',
red: 'thing',
blue: 'thing'
}
}`;
const object = fleece.evaluate(str);
object.string = 'goodbye';
object.number = 42;
object.array = ['p', 'q', 'r'];
object.arrayWithoutSpaces = ['x', 'y', 'z'];
object.largerObject = {
three: 'potato',
four: 'potato',
one: 'potato',
two: 'potato'
};
fleece.patch(str, object);