Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

graf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graf

some kind of graph thingy

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

graf

Run a bunch of async and sync functions in some kind of order.

Example

var graf = require('graf')
var crypto = require('crypto')

function a(x, y) { return x + y }
function add() {
	return Array.prototype.slice.call(arguments).reduce(a)
}

function m(x, y) { return x * y }
function multiply() {
	return Array.prototype.slice.call(arguments).reduce(m)
}

var g = graf(
	{
		input: ['a', 'b', 'x'],
		nodes: {
			sum: {
				input: ['a', 'b'],
				syncFn: add
			},
			multiply: {
				input: ['sum', 'sum', 'randomInt'],
				syncFn: multiply
			},
			randomBytes: {
				input: ['x'],
				fn: crypto.randomBytes
			},
			randomInt: {
				input: ['randomBytes'],
				syncFn: function (bytes) {
					return bytes.readUInt8(0)
				}
			},
			foo: {
				input: ['sum', 'randomInt'],
				syncFn: function (sum, int) {
					console.log("sum: %d int: %d", sum, int)
				}
			}
		},
		output: 'multiply'
	}
)

g(3, 2, 1, console.log)

Obviously not ready for prime time

license

BSD

FAQs

Package last updated on 29 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts