flitbit / json-ptr

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

Getting property from array #13

Closed AndreSteenveld closed 6 years ago

AndreSteenveld commented 6 years ago

Getting a property from a named property from an array doesn't seem to work. Example;

const
    jsonpointer = require( "jsonpointer" ),
    thing = Object.assign([ 1, 2, 3 ], { foo : "bar" } );

// What I would expect to happen
"bar" === jsonpointer.get( thing, "/foo" );

// But the result is
undefined === jsonpointer.get( thing, "/foo" );

Some background; I'm currently working with the wordpress api client for node which returns arrays extended with some properties.