Package Exports
- reftools/lib/clone.js
- reftools/lib/dereference.js
- reftools/lib/jptr.js
- reftools/lib/recurse
- reftools/lib/recurse.js
- reftools/lib/reref.js
- reftools/lib/visit.js
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 (reftools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
RefTools
Constants
- util
LICENSE: MIT Source: https://simplapi.wordpress.com/2015/08/19/detect-graph-cycle-in-javascript/ removed dependency on underscore, MER
Functions
- clone()
a collection of cloning functions
- flatten()
flattens an object into an array of properties, takes a callback which can mutate or filter the entries (by returning null)
- jptr()
from obj, return the property with a JSON Pointer prop, optionally setting it to newValue
- recurse()
recurses through the properties of an object, given an optional starting state anything you pass in state.payload is passed to the callback each time
- reref()
Simply creates an object without self-references by replacing them with $ref pointers
- toposort(nodes) ⇒
Array
|Null
Try to get a topological sorting out of directed graph.
- visit()
Given an expanded object and an optional object to compare to (e.g. its $ref'd form), will call the following functions: callbacks.before - lets you modify the initial starting state, must return it callbacks.where - lets you select a subset of properties, return a truthy value callbacks.filter - called for all selected properties, can mutate/remove (by setting to undefined) callbacks.compare - allowing the objects to be compared by path (i.e. for $ref reinstating) callbacks.identity - called on any object identity (previously seen) properties callbacks.selected - called for all selected/unfiltered properties, does not mutate directly callbacks.count - called at the end with the number of selected properties callbacks.finally - called at the end of the traversal
util
LICENSE: MIT Source: https://simplapi.wordpress.com/2015/08/19/detect-graph-cycle-in-javascript/ removed dependency on underscore, MER
clone()
a collection of cloning functions
flatten()
flattens an object into an array of properties, takes a callback which can mutate or filter the entries (by returning null)
jptr()
from obj, return the property with a JSON Pointer prop, optionally setting it to newValue
recurse()
recurses through the properties of an object, given an optional starting state anything you pass in state.payload is passed to the callback each time
reref()
Simply creates an object without self-references by replacing them with $ref pointers
toposort(nodes) ⇒ Array
| Null
Try to get a topological sorting out of directed graph.
Kind: global function
Returns: Array
| Null
- An array if the topological sort could succeed, null if there is any cycle somewhere.
Param | Type | Description |
---|---|---|
nodes | Object |
A list of nodes, including edges (see below). |
visit()
Given an expanded object and an optional object to compare to (e.g. its $ref'd form), will call the following functions: callbacks.before - lets you modify the initial starting state, must return it callbacks.where - lets you select a subset of properties, return a truthy value callbacks.filter - called for all selected properties, can mutate/remove (by setting to undefined) callbacks.compare - allowing the objects to be compared by path (i.e. for $ref reinstating) callbacks.identity - called on any object identity (previously seen) properties callbacks.selected - called for all selected/unfiltered properties, does not mutate directly callbacks.count - called at the end with the number of selected properties callbacks.finally - called at the end of the traversal
Kind: global function