Skip to content

Latest commit

 

History

History
232 lines (185 loc) · 7 KB

API.md

File metadata and controls

232 lines (185 loc) · 7 KB

###JGL JSON Graph Language

Members

####JGL.ERROR_KEY Default: '@error'
####JGL.LAST_RELATIVE_PATH The last path that was generated by isRelative. Useful for not having to re-compute the relative path after testing for relativity.

Type: Query
####JGL.REF_KEY Default: '@ref'
####JGL.del(graph, ...path) Params

  • graph Object
  • ...path Path

Returns: Array.<PathValue>
####JGL.equals(src, other) Compares two concrete paths to each other and returns true if they are the same

Params

Returns: Boolean
####JGL.errorToValue() Params

  • Error

Returns: Object
####JGL.explode(path) Expand a path into all possible variations

Params

Returns: Array.<Path>
Example
JGL.explode([[1, 2], [3, 4], 5]); //=> [ // [1, 3, 5], // [2, 3, 5], // [1, 4, 5], // [2, 4, 5] // ]

####JGL.get(graph, ...path) Params

  • graph Object - The source Object to pull values from
  • ...path Query - The Object paths to look up

Returns: Array.<PathValue>
####JGL.isRange(obj) Params

  • obj Object

Returns: Boolean
####JGL.isRelative(from, to) Params

Returns: Boolean
####JGL.pathValueIsError(pv) Params

  • pv module:OPE~PathValue

Returns: Boolean
####JGL.pathValueIsRef(pv) Params

Returns: Boolean
####JGL.rangeContains(rng, idx) Params

Returns: Boolean
####JGL.relative(from, to) Params

Returns: Query
####JGL.resolve(pathValues) Params

Returns: Array.<PathValue>
####JGL.segmentContains(segment, key) Params

Returns: Boolean
####JGL.segmentKeys(segment) Params

Returns: Array.<Integer,String>
####JGL.set(graph, ...pathValue) Params

Returns: Array.<PathValue> - The array of PathValue's that were set on the graph
####JGL.traverse(graph, path, [populate]) Params

  • graph Object - The object to traverse
  • path Path - The path to follow
  • [populate=false] Boolean - Whether or not to create objects along the path on the object if they are not already defined

Returns: Array.<PathValue>
####JGL.valueToError(value) Params

  • value Object

Returns: Error
####type: JGL~Range An object that can be expanded into a series of indices

Scope: inner typedef of JGL
Type: Object
####type: JGL~PathSegment The smallest part of a concrete path

Scope: inner typedef of JGL
Type: Integer | String
####type: JGL~QueryKey The smallest part of a complex query

Scope: inner typedef of JGL
Type: PathSegment | Range
####type: JGL~QuerySegment A query segment can contain one or more query keys

Scope: inner typedef of JGL
Type: QueryKey | Array.<QueryKey>
####type: JGL~Query A complex path query that can be expanded to get multiple concrete paths

Scope: inner typedef of JGL
Type: Array.<QuerySegment>
####type: JGL~Path A concrete path. i.e: One that can not be expanded further.

Scope: inner typedef of JGL
Type: Array.<PathSegment>
####type: JGL~PathValue Scope: inner typedef of JGL
Type: Object