jref
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

jref

Description

jref traverse and dereference JSON objects quickly.

  • Currently only support internal references.
  • No dependencies.

Installation

npm install jref

Example

var jref = require('jref');

var object = {
  a: {
    b: {
      c: {
        $ref: '#/alphabet/c'
      }
    }
  },
  alphabet: {
    c: {
      soundsLike: 'see',
      one: 'stroke',
      is: 'curved'
    }
  }
};

jref.traverse(object, '#/alphabet/c');
// {
//   soundsLike: 'see',
//   one: 'stroke',
//   is: 'curved'
// }

jref.dereference(object);
// {
//   a: {
//     b: {
//       c: {
//       soundsLike: 'see',
//       one: 'stroke',
//       is: 'curved'
//     }
//   },
//   alphabet: {
//     c: {
//       soundsLike: 'see',
//       one: 'stroke',
//       is: 'curved'
//     }
//   }
// }

Package Sidebar

Install

npm i jref

Weekly Downloads

4,690

Version

1.0.2

License

MIT

Unpacked Size

6.94 kB

Total Files

16

Last publish

Collaborators

  • left.rite