Skip to content

Conversation

milahu
Copy link

@milahu milahu commented Aug 24, 2020

now users must append jsonMap.leaf_node to their keyList like

const jsonMap = require('json-source-map');
const result = jsonMap.parse('{"z":1,"a":{"z":1,"a":1}}');
const keyList = ['z', 'a']; // before this was ptr = '/z/a'
let pointer = result.pointers;
for (let key of keyList.concat([jsonMap.leaf_key])) {
  pointer = pointer[key];
}
const [a, b] = [pointer.value.pos, pointer.valueEnd.pos];

edit: forgot keyList = .... in commit message

edit: the constant should not be called leaf_key, rather loc_key

todo: tests ....

milahu added 4 commits August 24, 2020 13:59
now users must append `jsonMap.leaf_node` to their `keyList` like

```js
const jsonMap = require('json-source-map');
const result = jsonMap.parse('{"z":1,"a":{"z":1,"a":1}}');
let pointer = result.pointers;
for (let key of keyList.concat([jsonMap.leaf_key])) {
  pointer = pointer[key];
}
const [a, b] = [pointer.value.pos, pointer.valueEnd.pos];
```
@coveralls
Copy link

Coverage Status

Coverage decreased (-18.5%) to 81.495% when pulling 37dd775 on milahu:patch-1 into 3e58861 on epoberezkin:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants