• Jump To … +
    decodeToken.ts dereference.ts encodeToken.ts get.ts index.ts isPointer.ts set.ts
  • ¶

    JST - JSON Schema Toolkit Build Status

  • ¶
  • ¶

    A library for working with json schema.

  • ¶

    JST is a utility library for working with json schema. It provides functions for json pointers and json references.

  • ¶

    Interface

  • ¶

    dereference(schema: Object, resolve: (id) => Object)

  • ¶

    A generic dereferencer function to resolve all $ref tags in a schema and inline the results.

  • ¶
    • documentation
    import { dereference } from './dereference';
  • ¶

    get(object: Object, pointer: String)

  • ¶

    Retrieve a value from an object using a json pointer.

  • ¶
    • documentation
    import { get } from './get';
  • ¶

    set(object: Object, pointer: String, value: any)

  • ¶

    Set a value on an object using a json pointer.

  • ¶
    • documentation
    import { set } from './set';
  • ¶

    isPointer(string: string)

  • ¶

    Checks of a string is a valid json pointer.

  • ¶
    • documentation
    import { isPointer } from './isPointer';
  • ¶

    encodeToken(string: string) -> string

  • ¶

    encodes a string for safe use as a json pointer token.

  • ¶
    • documentation
    import { encodeToken } from './encodeToken';
  • ¶

    decodeToken(string: string) -> string

  • ¶

    decodes a json token unsecaping special character.

  • ¶
    • documentation
    import { decodeToken } from './decodeToken';
  • ¶

    Usage

  • ¶

    Install JST via npm.

    npm i --save @jdw/jst
    
  • ¶

    Then use it.

  • ¶
    import { get, set, isPointer, dereference } from '@jdw/jst'; // ES6
    
    var jst = require('@jdw/jst');                               // ES2015
    
    export {
      dereference,
      get,
      isPointer,
      encodeToken,
      decodeToken,
      set,
    };