0.0.0 • Published 8 months ago

jptr v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

jptr

Make Jsonpointer(RFC 6901) from js object

Usage

import {toJsonPointer} from 'jptr'


const obj = {
    a: 1,
    b: {
      c: 2,
    },
    d: {
      e: [{ a: 3 }, { b: 4 }, { c: 5 }],
    },
    nullValue: null,
    undefinedValue: undefined,
    };
const ptrs = toJsonPointer(obj);

/*

ptrs == [
    "/a",
    "/b/c",
    "/d/e/0/a",
    "/d/e/1/b",
    "/d/e/2/c",
    "/nullValue",
    "/undefinedValue",
]
*/
0.0.0

8 months ago