Giter Club home page Giter Club logo

reftools's Introduction

reftools

Greenkeeper badge

Constants

util

TopoSort function is LICENSE: MIT, everything else is BSD-3-Clause

Functions

nop(obj)

a no-op placeholder which returns the given object unchanged useful for when a clone function needs to be passed but cloning is not required

clone(obj)

clones the given object using JSON.parse and JSON.stringify

shallowClone(obj)

clones the given object's properties shallowly, ignores properties from prototype

deepClone(obj)

clones the given object's properties deeply, ignores properties from prototype

fastClone(obj)

clones the given object's properties shallowly, using Object.assign

circularClone()

Source: stackoverflow http://bit.ly/2A1Kha6

dereference(o)

dereferences the given object

flatten(obj, callback)

flattens an object into an array of properties

jpescape(s)

escapes JSON Pointer using ~0 for ~ and ~1 for /

jpunescape(s)

unescapes JSON Pointer using ~0 for ~ and ~1 for /

jptr(obj, prop, newValue)

from obj, return the property with a JSON Pointer prop, optionally setting it to newValue

recurse(object, state, callback)

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(obj, options)

Simply modifies an object to have no self-references by replacing them with $ref pointers

objToGraph(obj, containerName)

Takes an object and creates a graph of JSON Pointer / References

visit(obj, comparison, callbacks)

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

Typedefs

ResultResult

Try to get a topological sorting out of directed graph.

util

TopoSort function is LICENSE: MIT, everything else is BSD-3-Clause

Kind: global constant

nop(obj) ⇒

a no-op placeholder which returns the given object unchanged useful for when a clone function needs to be passed but cloning is not required

Kind: global function
Returns: the input object, unchanged

Param Description
obj the input object

clone(obj) ⇒

clones the given object using JSON.parse and JSON.stringify

Kind: global function
Returns: the cloned object

Param Description
obj the object to clone

shallowClone(obj) ⇒

clones the given object's properties shallowly, ignores properties from prototype

Kind: global function
Returns: the cloned object

Param Description
obj the object to clone

deepClone(obj) ⇒

clones the given object's properties deeply, ignores properties from prototype

Kind: global function
Returns: the cloned object

Param Description
obj the object to clone

fastClone(obj) ⇒

clones the given object's properties shallowly, using Object.assign

Kind: global function
Returns: the cloned object

Param Description
obj the object to clone

circularClone()

Source: stackoverflow http://bit.ly/2A1Kha6

Kind: global function

dereference(o) ⇒

dereferences the given object

Kind: global function
Returns: the dereferenced object
Definitions: a source of definitions to reference
Options: optional settings (used recursively)

Param Description
o the object to dereference

flatten(obj, callback) ⇒

flattens an object into an array of properties

Kind: global function
Returns: the flattened object as an array of properties

Param Description
obj the object to flatten
callback a function which can mutate or filter the entries (by returning null)

jpescape(s) ⇒

escapes JSON Pointer using ~0 for ~ and ~1 for /

Kind: global function
Returns: the escaped string

Param Description
s the string to escape

jpunescape(s) ⇒

unescapes JSON Pointer using ~0 for ~ and ~1 for /

Kind: global function
Returns: the unescaped string

Param Description
s the string to unescape

jptr(obj, prop, newValue) ⇒

from obj, return the property with a JSON Pointer prop, optionally setting it to newValue

Kind: global function
Returns: the found property, or false

Param Description
obj the object to point into
prop the JSON Pointer or JSON Reference
newValue optional value to set the property to

recurse(object, state, callback)

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

Kind: global function

Param Description
object the object to recurse through
state optional starting state, can be set to null or
callback the function which receives object,key,state on each property

reref(obj, options) ⇒

Simply modifies an object to have no self-references by replacing them with $ref pointers

Kind: global function
Returns: the re-referenced object (mutated)

Param Description
obj the object to re-reference
options may contain a prefix property for the generated refs

objToGraph(obj, containerName) ⇒

Takes an object and creates a graph of JSON Pointer / References

Kind: global function
Returns: the graph suitable for passing to toposort()

Param Description
obj the object to convert
containerName the property containing definitions. Default: definitions

visit(obj, comparison, callbacks) ⇒

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
Returns: the possibly mutated object

Param Description
obj the object to visit
comparison optional object to compare to
callbacks object containing functions as above

Result ⇒ Result

Try to get a topological sorting out of directed graph.

Kind: global typedef

Param Type Description
nodes Object A list of nodes, including edges (see below).

Properties

Name Type Description
sort array the sort, empty if not found
nodesWithEdges, array will be empty unless a cycle is found

reftools's People

Contributors

mikeralphson avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

isabella232

reftools's Issues

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.