Closed
Description
It appears that 'e' in a pointer path is interpreted as a number, which seems wrong since JS does not generally treat 'e' as a constant number and exponential notation requires a preceding digit ('1e7'). Adding an extra non-numeric character to the path, i.e. '/hi/eX', makes it behave as expected.
const { JsonPointer } = require('json-ptr');
// run `node index.js` in the terminal to repro
const obj = {};
const ptr = JsonPointer.create('/hi/e');
ptr.set(obj, 'hello', true);
console.log(`result`, obj);
// expected:
// { hi: {e: 'hello'} }
// got:
// { hi: [] }
Run it here:
https://stackblitz.com/edit/node-a9wd7r?file=index.js