JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 169900
  • Score
    100M100P100Q187057F
  • License MIT

An RFC-6901 JSON Pointer implementation

Package Exports

  • @hyperjump/json-pointer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hyperjump/json-pointer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JSON Pointer

This is an implementation of RFC-6901 JSON Pointer. JSON Pointer is designed for referring to data values within a JSON document. It's designed to be URL friendly so I can be used as a URL fragment that points to a specific part of the JSON document.

Installation

npm install @hyperjump/json-pointer --save

Usage

import * as JsonPointer from "@hyperjump/json-pointer";

const value = {
  "foo": {
    "bar": 2
  }
};

JsonPointer.get(value, "/foo/bar"); // 2
JsonPointer.append("/foo", "bar"); // "/foo/bar"
JsonPointer.cons("foo", JsonPointer.nil); // "/foo"
JsonPointer.decons("/foo/bar"); // ["foo", "/bar"]

Contributing

Tests

Run the tests

npm test

Run the tests with a continuous test runner

npm test -- --watch