flitbit / json-ptr

A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.
MIT License
91 stars 28 forks source link

Can't get basic example to work. #47

Closed reggi closed 2 years ago

reggi commented 2 years ago

For some reason this does not work:

const target = {}
JsonPointer.set(target, '/third', 'tenth')
console.log(target) // still empty {}
reggi commented 2 years ago

It seems to need existing values?

cerebralkungfu commented 2 years ago

As #44 pointed out, my documentation is broken, so it's a pain to figure out...

This link should help... there's one more argument, force, which indicates to build the missing path in the object graph.