Last active
December 21, 2015 13:29
-
-
Save thenikso/6312864 to your computer and use it in GitHub Desktop.
NoFlo for browser downloadable at http://noflojs.org/download/ is currently broken. This is an usable version of it usable with the instructions provided in the download page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(){ | |
/** | |
* Require the given path. | |
* | |
* @param {String} path | |
* @return {Object} exports | |
* @api public | |
*/ | |
function require(path, parent, orig) { | |
var resolved = require.resolve(path); | |
// lookup failed | |
if (null == resolved) { | |
orig = orig || path; | |
parent = parent || 'root'; | |
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); | |
err.path = orig; | |
err.parent = parent; | |
err.require = true; | |
throw err; | |
} | |
var module = require.modules[resolved]; | |
// perform real require() | |
// by invoking the module's | |
// registered function | |
if (!module.exports) { | |
module.exports = {}; | |
module.client = module.component = true; | |
module.call(this, module.exports, require.relative(resolved), module); | |
} | |
return module.exports; | |
} | |
/** | |
* Registered modules. | |
*/ | |
require.modules = {}; | |
/** | |
* Registered aliases. | |
*/ | |
require.aliases = {}; | |
/** | |
* Resolve `path`. | |
* | |
* Lookup: | |
* | |
* - PATH/index.js | |
* - PATH.js | |
* - PATH | |
* | |
* @param {String} path | |
* @return {String} path or null | |
* @api private | |
*/ | |
require.resolve = function(path) { | |
if (path.charAt(0) === '/') path = path.slice(1); | |
var paths = [ | |
path, | |
path + '.js', | |
path + '.json', | |
path + '/index.js', | |
path + '/index.json' | |
]; | |
for (var i = 0; i < paths.length; i++) { | |
var path = paths[i]; | |
if (require.modules.hasOwnProperty(path)) return path; | |
if (require.aliases.hasOwnProperty(path)) return require.aliases[path]; | |
} | |
}; | |
/** | |
* Normalize `path` relative to the current path. | |
* | |
* @param {String} curr | |
* @param {String} path | |
* @return {String} | |
* @api private | |
*/ | |
require.normalize = function(curr, path) { | |
var segs = []; | |
if ('.' != path.charAt(0)) return path; | |
curr = curr.split('/'); | |
path = path.split('/'); | |
for (var i = 0; i < path.length; ++i) { | |
if ('..' == path[i]) { | |
curr.pop(); | |
} else if ('.' != path[i] && '' != path[i]) { | |
segs.push(path[i]); | |
} | |
} | |
return curr.concat(segs).join('/'); | |
}; | |
/** | |
* Register module at `path` with callback `definition`. | |
* | |
* @param {String} path | |
* @param {Function} definition | |
* @api private | |
*/ | |
require.register = function(path, definition) { | |
require.modules[path] = definition; | |
}; | |
/** | |
* Alias a module definition. | |
* | |
* @param {String} from | |
* @param {String} to | |
* @api private | |
*/ | |
require.alias = function(from, to) { | |
if (!require.modules.hasOwnProperty(from)) { | |
throw new Error('Failed to alias "' + from + '", it does not exist'); | |
} | |
require.aliases[to] = from; | |
}; | |
/** | |
* Return a require function relative to the `parent` path. | |
* | |
* @param {String} parent | |
* @return {Function} | |
* @api private | |
*/ | |
require.relative = function(parent) { | |
var p = require.normalize(parent, '..'); | |
/** | |
* lastIndexOf helper. | |
*/ | |
function lastIndexOf(arr, obj) { | |
var i = arr.length; | |
while (i--) { | |
if (arr[i] === obj) return i; | |
} | |
return -1; | |
} | |
/** | |
* The relative require() itself. | |
*/ | |
function localRequire(path) { | |
var resolved = localRequire.resolve(path); | |
return require(resolved, parent, path); | |
} | |
/** | |
* Resolve relative to the parent. | |
*/ | |
localRequire.resolve = function(path) { | |
var c = path.charAt(0); | |
if ('/' == c) return path.slice(1); | |
if ('.' == c) return require.normalize(p, path); | |
// resolve deps by returning | |
// the dep in the nearest "deps" | |
// directory | |
var segs = parent.split('/'); | |
var i = lastIndexOf(segs, 'deps') + 1; | |
if (!i) i = 0; | |
path = segs.slice(0, i + 1).join('/') + '/deps/' + path; | |
return path; | |
}; | |
/** | |
* Check if module is defined at `path`. | |
*/ | |
localRequire.exists = function(path) { | |
return require.modules.hasOwnProperty(localRequire.resolve(path)); | |
}; | |
return localRequire; | |
}; | |
require.register("component-indexof/index.js", function(exports, require, module){ | |
module.exports = function(arr, obj){ | |
if (arr.indexOf) return arr.indexOf(obj); | |
for (var i = 0; i < arr.length; ++i) { | |
if (arr[i] === obj) return i; | |
} | |
return -1; | |
}; | |
}); | |
require.register("component-emitter/index.js", function(exports, require, module){ | |
/** | |
* Module dependencies. | |
*/ | |
var index = require('indexof'); | |
/** | |
* Expose `Emitter`. | |
*/ | |
module.exports = Emitter; | |
/** | |
* Initialize a new `Emitter`. | |
* | |
* @api public | |
*/ | |
function Emitter(obj) { | |
if (obj) return mixin(obj); | |
}; | |
/** | |
* Mixin the emitter properties. | |
* | |
* @param {Object} obj | |
* @return {Object} | |
* @api private | |
*/ | |
function mixin(obj) { | |
for (var key in Emitter.prototype) { | |
obj[key] = Emitter.prototype[key]; | |
} | |
return obj; | |
} | |
/** | |
* Listen on the given `event` with `fn`. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.on = function(event, fn){ | |
this._callbacks = this._callbacks || {}; | |
(this._callbacks[event] = this._callbacks[event] || []) | |
.push(fn); | |
return this; | |
}; | |
/** | |
* Adds an `event` listener that will be invoked a single | |
* time then automatically removed. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.once = function(event, fn){ | |
var self = this; | |
this._callbacks = this._callbacks || {}; | |
function on() { | |
self.off(event, on); | |
fn.apply(this, arguments); | |
} | |
fn._off = on; | |
this.on(event, on); | |
return this; | |
}; | |
/** | |
* Remove the given callback for `event` or all | |
* registered callbacks. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.off = | |
Emitter.prototype.removeListener = | |
Emitter.prototype.removeAllListeners = function(event, fn){ | |
this._callbacks = this._callbacks || {}; | |
// all | |
if (0 == arguments.length) { | |
this._callbacks = {}; | |
return this; | |
} | |
// specific event | |
var callbacks = this._callbacks[event]; | |
if (!callbacks) return this; | |
// remove all handlers | |
if (1 == arguments.length) { | |
delete this._callbacks[event]; | |
return this; | |
} | |
// remove specific handler | |
var i = index(callbacks, fn._off || fn); | |
if (~i) callbacks.splice(i, 1); | |
return this; | |
}; | |
/** | |
* Emit `event` with the given args. | |
* | |
* @param {String} event | |
* @param {Mixed} ... | |
* @return {Emitter} | |
*/ | |
Emitter.prototype.emit = function(event){ | |
this._callbacks = this._callbacks || {}; | |
var args = [].slice.call(arguments, 1) | |
, callbacks = this._callbacks[event]; | |
if (callbacks) { | |
callbacks = callbacks.slice(0); | |
for (var i = 0, len = callbacks.length; i < len; ++i) { | |
callbacks[i].apply(this, args); | |
} | |
} | |
return this; | |
}; | |
/** | |
* Return array of callbacks for `event`. | |
* | |
* @param {String} event | |
* @return {Array} | |
* @api public | |
*/ | |
Emitter.prototype.listeners = function(event){ | |
this._callbacks = this._callbacks || {}; | |
return this._callbacks[event] || []; | |
}; | |
/** | |
* Check if this emitter has `event` handlers. | |
* | |
* @param {String} event | |
* @return {Boolean} | |
* @api public | |
*/ | |
Emitter.prototype.hasListeners = function(event){ | |
return !! this.listeners(event).length; | |
}; | |
}); | |
require.register("component-underscore/index.js", function(exports, require, module){ | |
// Underscore.js 1.3.3 | |
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. | |
// Underscore is freely distributable under the MIT license. | |
// Portions of Underscore are inspired or borrowed from Prototype, | |
// Oliver Steele's Functional, and John Resig's Micro-Templating. | |
// For all details and documentation: | |
// http://documentcloud.github.com/underscore | |
(function() { | |
// Baseline setup | |
// -------------- | |
// Establish the root object, `window` in the browser, or `global` on the server. | |
var root = this; | |
// Save the previous value of the `_` variable. | |
var previousUnderscore = root._; | |
// Establish the object that gets returned to break out of a loop iteration. | |
var breaker = {}; | |
// Save bytes in the minified (but not gzipped) version: | |
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; | |
// Create quick reference variables for speed access to core prototypes. | |
var push = ArrayProto.push, | |
slice = ArrayProto.slice, | |
unshift = ArrayProto.unshift, | |
toString = ObjProto.toString, | |
hasOwnProperty = ObjProto.hasOwnProperty; | |
// All **ECMAScript 5** native function implementations that we hope to use | |
// are declared here. | |
var | |
nativeForEach = ArrayProto.forEach, | |
nativeMap = ArrayProto.map, | |
nativeReduce = ArrayProto.reduce, | |
nativeReduceRight = ArrayProto.reduceRight, | |
nativeFilter = ArrayProto.filter, | |
nativeEvery = ArrayProto.every, | |
nativeSome = ArrayProto.some, | |
nativeIndexOf = ArrayProto.indexOf, | |
nativeLastIndexOf = ArrayProto.lastIndexOf, | |
nativeIsArray = Array.isArray, | |
nativeKeys = Object.keys, | |
nativeBind = FuncProto.bind; | |
// Create a safe reference to the Underscore object for use below. | |
var _ = function(obj) { return new wrapper(obj); }; | |
// Export the Underscore object for **Node.js**, with | |
// backwards-compatibility for the old `require()` API. If we're in | |
// the browser, add `_` as a global object via a string identifier, | |
// for Closure Compiler "advanced" mode. | |
if (typeof exports !== 'undefined') { | |
if (typeof module !== 'undefined' && module.exports) { | |
exports = module.exports = _; | |
} | |
exports._ = _; | |
} else { | |
root['_'] = _; | |
} | |
// Current version. | |
_.VERSION = '1.3.3'; | |
// Collection Functions | |
// -------------------- | |
// The cornerstone, an `each` implementation, aka `forEach`. | |
// Handles objects with the built-in `forEach`, arrays, and raw objects. | |
// Delegates to **ECMAScript 5**'s native `forEach` if available. | |
var each = _.each = _.forEach = function(obj, iterator, context) { | |
if (obj == null) return; | |
if (nativeForEach && obj.forEach === nativeForEach) { | |
obj.forEach(iterator, context); | |
} else if (obj.length === +obj.length) { | |
for (var i = 0, l = obj.length; i < l; i++) { | |
if (iterator.call(context, obj[i], i, obj) === breaker) return; | |
} | |
} else { | |
for (var key in obj) { | |
if (_.has(obj, key)) { | |
if (iterator.call(context, obj[key], key, obj) === breaker) return; | |
} | |
} | |
} | |
}; | |
// Return the results of applying the iterator to each element. | |
// Delegates to **ECMAScript 5**'s native `map` if available. | |
_.map = _.collect = function(obj, iterator, context) { | |
var results = []; | |
if (obj == null) return results; | |
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); | |
each(obj, function(value, index, list) { | |
results[results.length] = iterator.call(context, value, index, list); | |
}); | |
return results; | |
}; | |
// **Reduce** builds up a single result from a list of values, aka `inject`, | |
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. | |
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { | |
var initial = arguments.length > 2; | |
if (obj == null) obj = []; | |
if (nativeReduce && obj.reduce === nativeReduce) { | |
if (context) iterator = _.bind(iterator, context); | |
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); | |
} | |
each(obj, function(value, index, list) { | |
if (!initial) { | |
memo = value; | |
initial = true; | |
} else { | |
memo = iterator.call(context, memo, value, index, list); | |
} | |
}); | |
if (!initial) throw new TypeError('Reduce of empty array with no initial value'); | |
return memo; | |
}; | |
// The right-associative version of reduce, also known as `foldr`. | |
// Delegates to **ECMAScript 5**'s native `reduceRight` if available. | |
_.reduceRight = _.foldr = function(obj, iterator, memo, context) { | |
var initial = arguments.length > 2; | |
if (obj == null) obj = []; | |
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { | |
if (context) iterator = _.bind(iterator, context); | |
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); | |
} | |
var reversed = _.toArray(obj).reverse(); | |
if (context && !initial) iterator = _.bind(iterator, context); | |
return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); | |
}; | |
// Return the first value which passes a truth test. Aliased as `detect`. | |
_.find = _.detect = function(obj, iterator, context) { | |
var result; | |
any(obj, function(value, index, list) { | |
if (iterator.call(context, value, index, list)) { | |
result = value; | |
return true; | |
} | |
}); | |
return result; | |
}; | |
// Return all the elements that pass a truth test. | |
// Delegates to **ECMAScript 5**'s native `filter` if available. | |
// Aliased as `select`. | |
_.filter = _.select = function(obj, iterator, context) { | |
var results = []; | |
if (obj == null) return results; | |
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); | |
each(obj, function(value, index, list) { | |
if (iterator.call(context, value, index, list)) results[results.length] = value; | |
}); | |
return results; | |
}; | |
// Return all the elements for which a truth test fails. | |
_.reject = function(obj, iterator, context) { | |
var results = []; | |
if (obj == null) return results; | |
each(obj, function(value, index, list) { | |
if (!iterator.call(context, value, index, list)) results[results.length] = value; | |
}); | |
return results; | |
}; | |
// Determine whether all of the elements match a truth test. | |
// Delegates to **ECMAScript 5**'s native `every` if available. | |
// Aliased as `all`. | |
_.every = _.all = function(obj, iterator, context) { | |
var result = true; | |
if (obj == null) return result; | |
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); | |
each(obj, function(value, index, list) { | |
if (!(result = result && iterator.call(context, value, index, list))) return breaker; | |
}); | |
return !!result; | |
}; | |
// Determine if at least one element in the object matches a truth test. | |
// Delegates to **ECMAScript 5**'s native `some` if available. | |
// Aliased as `any`. | |
var any = _.some = _.any = function(obj, iterator, context) { | |
iterator || (iterator = _.identity); | |
var result = false; | |
if (obj == null) return result; | |
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); | |
each(obj, function(value, index, list) { | |
if (result || (result = iterator.call(context, value, index, list))) return breaker; | |
}); | |
return !!result; | |
}; | |
// Determine if a given value is included in the array or object using `===`. | |
// Aliased as `contains`. | |
_.include = _.contains = function(obj, target) { | |
var found = false; | |
if (obj == null) return found; | |
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; | |
found = any(obj, function(value) { | |
return value === target; | |
}); | |
return found; | |
}; | |
// Invoke a method (with arguments) on every item in a collection. | |
_.invoke = function(obj, method) { | |
var args = slice.call(arguments, 2); | |
return _.map(obj, function(value) { | |
return (_.isFunction(method) ? method : value[method]).apply(value, args); | |
}); | |
}; | |
// Convenience version of a common use case of `map`: fetching a property. | |
_.pluck = function(obj, key) { | |
return _.map(obj, function(value){ return value[key]; }); | |
}; | |
// Return the maximum element or (element-based computation). | |
// Can't optimize arrays of integers longer than 65,535 elements. | |
// See: https://bugs.webkit.org/show_bug.cgi?id=80797 | |
_.max = function(obj, iterator, context) { | |
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { | |
return Math.max.apply(Math, obj); | |
} | |
if (!iterator && _.isEmpty(obj)) return -Infinity; | |
var result = {computed : -Infinity}; | |
each(obj, function(value, index, list) { | |
var computed = iterator ? iterator.call(context, value, index, list) : value; | |
computed >= result.computed && (result = {value : value, computed : computed}); | |
}); | |
return result.value; | |
}; | |
// Return the minimum element (or element-based computation). | |
_.min = function(obj, iterator, context) { | |
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { | |
return Math.min.apply(Math, obj); | |
} | |
if (!iterator && _.isEmpty(obj)) return Infinity; | |
var result = {computed : Infinity}; | |
each(obj, function(value, index, list) { | |
var computed = iterator ? iterator.call(context, value, index, list) : value; | |
computed < result.computed && (result = {value : value, computed : computed}); | |
}); | |
return result.value; | |
}; | |
// Shuffle an array. | |
_.shuffle = function(obj) { | |
var rand; | |
var index = 0; | |
var shuffled = []; | |
each(obj, function(value) { | |
rand = Math.floor(Math.random() * ++index); | |
shuffled[index - 1] = shuffled[rand]; | |
shuffled[rand] = value; | |
}); | |
return shuffled; | |
}; | |
// Sort the object's values by a criterion produced by an iterator. | |
_.sortBy = function(obj, val, context) { | |
var iterator = lookupIterator(obj, val); | |
return _.pluck(_.map(obj, function(value, index, list) { | |
return { | |
value : value, | |
criteria : iterator.call(context, value, index, list) | |
}; | |
}).sort(function(left, right) { | |
var a = left.criteria, b = right.criteria; | |
if (a === void 0) return 1; | |
if (b === void 0) return -1; | |
return a < b ? -1 : a > b ? 1 : 0; | |
}), 'value'); | |
}; | |
// An internal function to generate lookup iterators. | |
var lookupIterator = function(obj, val) { | |
return _.isFunction(val) ? val : function(obj) { return obj[val]; }; | |
}; | |
// An internal function used for aggregate "group by" operations. | |
var group = function(obj, val, behavior) { | |
var result = {}; | |
var iterator = lookupIterator(obj, val); | |
each(obj, function(value, index) { | |
var key = iterator(value, index); | |
behavior(result, key, value); | |
}); | |
return result; | |
}; | |
// Groups the object's values by a criterion. Pass either a string attribute | |
// to group by, or a function that returns the criterion. | |
_.groupBy = function(obj, val) { | |
return group(obj, val, function(result, key, value) { | |
(result[key] || (result[key] = [])).push(value); | |
}); | |
}; | |
// Counts instances of an object that group by a certain criterion. Pass | |
// either a string attribute to count by, or a function that returns the | |
// criterion. | |
_.countBy = function(obj, val) { | |
return group(obj, val, function(result, key, value) { | |
result[key] || (result[key] = 0); | |
result[key]++; | |
}); | |
}; | |
// Use a comparator function to figure out the smallest index at which | |
// an object should be inserted so as to maintain order. Uses binary search. | |
_.sortedIndex = function(array, obj, iterator) { | |
iterator || (iterator = _.identity); | |
var value = iterator(obj); | |
var low = 0, high = array.length; | |
while (low < high) { | |
var mid = (low + high) >> 1; | |
iterator(array[mid]) < value ? low = mid + 1 : high = mid; | |
} | |
return low; | |
}; | |
// Safely convert anything iterable into a real, live array. | |
_.toArray = function(obj) { | |
if (!obj) return []; | |
if (_.isArray(obj)) return slice.call(obj); | |
if (_.isArguments(obj)) return slice.call(obj); | |
if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray(); | |
return _.values(obj); | |
}; | |
// Return the number of elements in an object. | |
_.size = function(obj) { | |
return _.isArray(obj) ? obj.length : _.keys(obj).length; | |
}; | |
// Array Functions | |
// --------------- | |
// Get the first element of an array. Passing **n** will return the first N | |
// values in the array. Aliased as `head` and `take`. The **guard** check | |
// allows it to work with `_.map`. | |
_.first = _.head = _.take = function(array, n, guard) { | |
return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; | |
}; | |
// Returns everything but the last entry of the array. Especially useful on | |
// the arguments object. Passing **n** will return all the values in | |
// the array, excluding the last N. The **guard** check allows it to work with | |
// `_.map`. | |
_.initial = function(array, n, guard) { | |
return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); | |
}; | |
// Get the last element of an array. Passing **n** will return the last N | |
// values in the array. The **guard** check allows it to work with `_.map`. | |
_.last = function(array, n, guard) { | |
if ((n != null) && !guard) { | |
return slice.call(array, Math.max(array.length - n, 0)); | |
} else { | |
return array[array.length - 1]; | |
} | |
}; | |
// Returns everything but the first entry of the array. Aliased as `tail`. | |
// Especially useful on the arguments object. Passing an **index** will return | |
// the rest of the values in the array from that index onward. The **guard** | |
// check allows it to work with `_.map`. | |
_.rest = _.tail = function(array, index, guard) { | |
return slice.call(array, (index == null) || guard ? 1 : index); | |
}; | |
// Trim out all falsy values from an array. | |
_.compact = function(array) { | |
return _.filter(array, function(value){ return !!value; }); | |
}; | |
// Internal implementation of a recursive `flatten` function. | |
var flatten = function(input, shallow, output) { | |
each(input, function(value) { | |
if (_.isArray(value)) { | |
shallow ? push.apply(output, value) : flatten(value, shallow, output); | |
} else { | |
output.push(value); | |
} | |
}); | |
return output; | |
}; | |
// Return a completely flattened version of an array. | |
_.flatten = function(array, shallow) { | |
return flatten(array, shallow, []); | |
}; | |
// Return a version of the array that does not contain the specified value(s). | |
_.without = function(array) { | |
return _.difference(array, slice.call(arguments, 1)); | |
}; | |
// Produce a duplicate-free version of the array. If the array has already | |
// been sorted, you have the option of using a faster algorithm. | |
// Aliased as `unique`. | |
_.uniq = _.unique = function(array, isSorted, iterator) { | |
var initial = iterator ? _.map(array, iterator) : array; | |
var results = []; | |
_.reduce(initial, function(memo, value, index) { | |
if (isSorted ? (_.last(memo) !== value || !memo.length) : !_.include(memo, value)) { | |
memo.push(value); | |
results.push(array[index]); | |
} | |
return memo; | |
}, []); | |
return results; | |
}; | |
// Produce an array that contains the union: each distinct element from all of | |
// the passed-in arrays. | |
_.union = function() { | |
return _.uniq(flatten(arguments, true, [])); | |
}; | |
// Produce an array that contains every item shared between all the | |
// passed-in arrays. | |
_.intersection = function(array) { | |
var rest = slice.call(arguments, 1); | |
return _.filter(_.uniq(array), function(item) { | |
return _.every(rest, function(other) { | |
return _.indexOf(other, item) >= 0; | |
}); | |
}); | |
}; | |
// Take the difference between one array and a number of other arrays. | |
// Only the elements present in just the first array will remain. | |
_.difference = function(array) { | |
var rest = flatten(slice.call(arguments, 1), true, []); | |
return _.filter(array, function(value){ return !_.include(rest, value); }); | |
}; | |
// Zip together multiple lists into a single array -- elements that share | |
// an index go together. | |
_.zip = function() { | |
var args = slice.call(arguments); | |
var length = _.max(_.pluck(args, 'length')); | |
var results = new Array(length); | |
for (var i = 0; i < length; i++) { | |
results[i] = _.pluck(args, "" + i); | |
} | |
return results; | |
}; | |
// Zip together two arrays -- an array of keys and an array of values -- into | |
// a single object. | |
_.zipObject = function(keys, values) { | |
var result = {}; | |
for (var i = 0, l = keys.length; i < l; i++) { | |
result[keys[i]] = values[i]; | |
} | |
return result; | |
}; | |
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), | |
// we need this function. Return the position of the first occurrence of an | |
// item in an array, or -1 if the item is not included in the array. | |
// Delegates to **ECMAScript 5**'s native `indexOf` if available. | |
// If the array is large and already in sort order, pass `true` | |
// for **isSorted** to use binary search. | |
_.indexOf = function(array, item, isSorted) { | |
if (array == null) return -1; | |
var i, l; | |
if (isSorted) { | |
i = _.sortedIndex(array, item); | |
return array[i] === item ? i : -1; | |
} | |
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); | |
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i; | |
return -1; | |
}; | |
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. | |
_.lastIndexOf = function(array, item) { | |
if (array == null) return -1; | |
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); | |
var i = array.length; | |
while (i--) if (array[i] === item) return i; | |
return -1; | |
}; | |
// Generate an integer Array containing an arithmetic progression. A port of | |
// the native Python `range()` function. See | |
// [the Python documentation](http://docs.python.org/library/functions.html#range). | |
_.range = function(start, stop, step) { | |
if (arguments.length <= 1) { | |
stop = start || 0; | |
start = 0; | |
} | |
step = arguments[2] || 1; | |
var len = Math.max(Math.ceil((stop - start) / step), 0); | |
var idx = 0; | |
var range = new Array(len); | |
while(idx < len) { | |
range[idx++] = start; | |
start += step; | |
} | |
return range; | |
}; | |
// Function (ahem) Functions | |
// ------------------ | |
// Reusable constructor function for prototype setting. | |
var ctor = function(){}; | |
// Create a function bound to a given object (assigning `this`, and arguments, | |
// optionally). Binding with arguments is also known as `curry`. | |
// Delegates to **ECMAScript 5**'s native `Function.bind` if available. | |
// We check for `func.bind` first, to fail fast when `func` is undefined. | |
_.bind = function bind(func, context) { | |
var bound, args; | |
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); | |
if (!_.isFunction(func)) throw new TypeError; | |
args = slice.call(arguments, 2); | |
return bound = function() { | |
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); | |
ctor.prototype = func.prototype; | |
var self = new ctor; | |
var result = func.apply(self, args.concat(slice.call(arguments))); | |
if (Object(result) === result) return result; | |
return self; | |
}; | |
}; | |
// Bind all of an object's methods to that object. Useful for ensuring that | |
// all callbacks defined on an object belong to it. | |
_.bindAll = function(obj) { | |
var funcs = slice.call(arguments, 1); | |
if (funcs.length == 0) funcs = _.functions(obj); | |
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); | |
return obj; | |
}; | |
// Memoize an expensive function by storing its results. | |
_.memoize = function(func, hasher) { | |
var memo = {}; | |
hasher || (hasher = _.identity); | |
return function() { | |
var key = hasher.apply(this, arguments); | |
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); | |
}; | |
}; | |
// Delays a function for the given number of milliseconds, and then calls | |
// it with the arguments supplied. | |
_.delay = function(func, wait) { | |
var args = slice.call(arguments, 2); | |
return setTimeout(function(){ return func.apply(null, args); }, wait); | |
}; | |
// Defers a function, scheduling it to run after the current call stack has | |
// cleared. | |
_.defer = function(func) { | |
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); | |
}; | |
// Returns a function, that, when invoked, will only be triggered at most once | |
// during a given window of time. | |
_.throttle = function(func, wait) { | |
var context, args, timeout, throttling, more, result; | |
var whenDone = _.debounce(function(){ more = throttling = false; }, wait); | |
return function() { | |
context = this; args = arguments; | |
var later = function() { | |
timeout = null; | |
if (more) func.apply(context, args); | |
whenDone(); | |
}; | |
if (!timeout) timeout = setTimeout(later, wait); | |
if (throttling) { | |
more = true; | |
} else { | |
throttling = true; | |
result = func.apply(context, args); | |
} | |
whenDone(); | |
return result; | |
}; | |
}; | |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
_.debounce = function(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; | |
clearTimeout(timeout); | |
timeout = setTimeout(later, wait); | |
if (callNow) func.apply(context, args); | |
}; | |
}; | |
// Returns a function that will be executed at most one time, no matter how | |
// often you call it. Useful for lazy initialization. | |
_.once = function(func) { | |
var ran = false, memo; | |
return function() { | |
if (ran) return memo; | |
ran = true; | |
return memo = func.apply(this, arguments); | |
}; | |
}; | |
// Returns the first function passed as an argument to the second, | |
// allowing you to adjust arguments, run code before and after, and | |
// conditionally execute the original function. | |
_.wrap = function(func, wrapper) { | |
return function() { | |
var args = [func].concat(slice.call(arguments, 0)); | |
return wrapper.apply(this, args); | |
}; | |
}; | |
// Returns a function that is the composition of a list of functions, each | |
// consuming the return value of the function that follows. | |
_.compose = function() { | |
var funcs = arguments; | |
return function() { | |
var args = arguments; | |
for (var i = funcs.length - 1; i >= 0; i--) { | |
args = [funcs[i].apply(this, args)]; | |
} | |
return args[0]; | |
}; | |
}; | |
// Returns a function that will only be executed after being called N times. | |
_.after = function(times, func) { | |
if (times <= 0) return func(); | |
return function() { | |
if (--times < 1) { | |
return func.apply(this, arguments); | |
} | |
}; | |
}; | |
// Object Functions | |
// ---------------- | |
// Retrieve the names of an object's properties. | |
// Delegates to **ECMAScript 5**'s native `Object.keys` | |
_.keys = nativeKeys || function(obj) { | |
if (obj !== Object(obj)) throw new TypeError('Invalid object'); | |
var keys = []; | |
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; | |
return keys; | |
}; | |
// Retrieve the values of an object's properties. | |
_.values = function(obj) { | |
return _.map(obj, _.identity); | |
}; | |
// Return a sorted list of the function names available on the object. | |
// Aliased as `methods` | |
_.functions = _.methods = function(obj) { | |
var names = []; | |
for (var key in obj) { | |
if (_.isFunction(obj[key])) names.push(key); | |
} | |
return names.sort(); | |
}; | |
// Extend a given object with all the properties in passed-in object(s). | |
_.extend = function(obj) { | |
each(slice.call(arguments, 1), function(source) { | |
for (var prop in source) { | |
obj[prop] = source[prop]; | |
} | |
}); | |
return obj; | |
}; | |
// Return a copy of the object only containing the whitelisted properties. | |
_.pick = function(obj) { | |
var result = {}; | |
each(flatten(slice.call(arguments, 1), true, []), function(key) { | |
if (key in obj) result[key] = obj[key]; | |
}); | |
return result; | |
}; | |
// Fill in a given object with default properties. | |
_.defaults = function(obj) { | |
each(slice.call(arguments, 1), function(source) { | |
for (var prop in source) { | |
if (obj[prop] == null) obj[prop] = source[prop]; | |
} | |
}); | |
return obj; | |
}; | |
// Create a (shallow-cloned) duplicate of an object. | |
_.clone = function(obj) { | |
if (!_.isObject(obj)) return obj; | |
return _.isArray(obj) ? obj.slice() : _.extend({}, obj); | |
}; | |
// Invokes interceptor with the obj, and then returns obj. | |
// The primary purpose of this method is to "tap into" a method chain, in | |
// order to perform operations on intermediate results within the chain. | |
_.tap = function(obj, interceptor) { | |
interceptor(obj); | |
return obj; | |
}; | |
// Internal recursive comparison function for `isEqual`. | |
var eq = function(a, b, stack) { | |
// Identical objects are equal. `0 === -0`, but they aren't identical. | |
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. | |
if (a === b) return a !== 0 || 1 / a == 1 / b; | |
// A strict comparison is necessary because `null == undefined`. | |
if (a == null || b == null) return a === b; | |
// Unwrap any wrapped objects. | |
if (a._chain) a = a._wrapped; | |
if (b._chain) b = b._wrapped; | |
// Invoke a custom `isEqual` method if one is provided. | |
if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); | |
if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); | |
// Compare `[[Class]]` names. | |
var className = toString.call(a); | |
if (className != toString.call(b)) return false; | |
switch (className) { | |
// Strings, numbers, dates, and booleans are compared by value. | |
case '[object String]': | |
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is | |
// equivalent to `new String("5")`. | |
return a == String(b); | |
case '[object Number]': | |
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for | |
// other numeric values. | |
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); | |
case '[object Date]': | |
case '[object Boolean]': | |
// Coerce dates and booleans to numeric primitive values. Dates are compared by their | |
// millisecond representations. Note that invalid dates with millisecond representations | |
// of `NaN` are not equivalent. | |
return +a == +b; | |
// RegExps are compared by their source patterns and flags. | |
case '[object RegExp]': | |
return a.source == b.source && | |
a.global == b.global && | |
a.multiline == b.multiline && | |
a.ignoreCase == b.ignoreCase; | |
} | |
if (typeof a != 'object' || typeof b != 'object') return false; | |
// Assume equality for cyclic structures. The algorithm for detecting cyclic | |
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. | |
var length = stack.length; | |
while (length--) { | |
// Linear search. Performance is inversely proportional to the number of | |
// unique nested structures. | |
if (stack[length] == a) return true; | |
} | |
// Add the first object to the stack of traversed objects. | |
stack.push(a); | |
var size = 0, result = true; | |
// Recursively compare objects and arrays. | |
if (className == '[object Array]') { | |
// Compare array lengths to determine if a deep comparison is necessary. | |
size = a.length; | |
result = size == b.length; | |
if (result) { | |
// Deep compare the contents, ignoring non-numeric properties. | |
while (size--) { | |
// Ensure commutative equality for sparse arrays. | |
if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; | |
} | |
} | |
} else { | |
// Objects with different constructors are not equivalent. | |
if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; | |
// Deep compare objects. | |
for (var key in a) { | |
if (_.has(a, key)) { | |
// Count the expected number of properties. | |
size++; | |
// Deep compare each member. | |
if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; | |
} | |
} | |
// Ensure that both objects contain the same number of properties. | |
if (result) { | |
for (key in b) { | |
if (_.has(b, key) && !(size--)) break; | |
} | |
result = !size; | |
} | |
} | |
// Remove the first object from the stack of traversed objects. | |
stack.pop(); | |
return result; | |
}; | |
// Perform a deep comparison to check if two objects are equal. | |
_.isEqual = function(a, b) { | |
return eq(a, b, []); | |
}; | |
// Is a given array, string, or object empty? | |
// An "empty" object has no enumerable own-properties. | |
_.isEmpty = function(obj) { | |
if (obj == null) return true; | |
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; | |
for (var key in obj) if (_.has(obj, key)) return false; | |
return true; | |
}; | |
// Is a given value a DOM element? | |
_.isElement = function(obj) { | |
return !!(obj && obj.nodeType == 1); | |
}; | |
// Is a given value an array? | |
// Delegates to ECMA5's native Array.isArray | |
_.isArray = nativeIsArray || function(obj) { | |
return toString.call(obj) == '[object Array]'; | |
}; | |
// Is a given variable an object? | |
_.isObject = function(obj) { | |
return obj === Object(obj); | |
}; | |
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. | |
each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { | |
_['is' + name] = function(obj) { | |
return toString.call(obj) == '[object ' + name + ']'; | |
}; | |
}); | |
// Define a fallback version of the method in browsers (ahem, IE), where | |
// there isn't any inspectable "Arguments" type. | |
if (!_.isArguments(arguments)) { | |
_.isArguments = function(obj) { | |
return !!(obj && _.has(obj, 'callee')); | |
}; | |
} | |
// Is a given object a finite number? | |
_.isFinite = function(obj) { | |
return _.isNumber(obj) && isFinite(obj); | |
}; | |
// Is the given value `NaN`? | |
_.isNaN = function(obj) { | |
// `NaN` is the only value for which `===` is not reflexive. | |
return obj !== obj; | |
}; | |
// Is a given value a boolean? | |
_.isBoolean = function(obj) { | |
return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; | |
}; | |
// Is a given value equal to null? | |
_.isNull = function(obj) { | |
return obj === null; | |
}; | |
// Is a given variable undefined? | |
_.isUndefined = function(obj) { | |
return obj === void 0; | |
}; | |
// Shortcut function for checking if an object has a given property directly | |
// on itself (in other words, not on a prototype). | |
_.has = function(obj, key) { | |
return hasOwnProperty.call(obj, key); | |
}; | |
// Utility Functions | |
// ----------------- | |
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its | |
// previous owner. Returns a reference to the Underscore object. | |
_.noConflict = function() { | |
root._ = previousUnderscore; | |
return this; | |
}; | |
// Keep the identity function around for default iterators. | |
_.identity = function(value) { | |
return value; | |
}; | |
// Run a function **n** times. | |
_.times = function(n, iterator, context) { | |
for (var i = 0; i < n; i++) iterator.call(context, i); | |
}; | |
// List of HTML entities for escaping. | |
var htmlEscapes = { | |
'&': '&', | |
'<': '<', | |
'>': '>', | |
'"': '"', | |
"'": ''', | |
'/': '/' | |
}; | |
// Regex containing the keys listed immediately above. | |
var htmlEscaper = /[&<>"'\/]/g; | |
// Escape a string for HTML interpolation. | |
_.escape = function(string) { | |
return ('' + string).replace(htmlEscaper, function(match) { | |
return htmlEscapes[match]; | |
}); | |
}; | |
// If the value of the named property is a function then invoke it; | |
// otherwise, return it. | |
_.result = function(object, property) { | |
if (object == null) return null; | |
var value = object[property]; | |
return _.isFunction(value) ? value.call(object) : value; | |
}; | |
// Add your own custom functions to the Underscore object, ensuring that | |
// they're correctly added to the OOP wrapper as well. | |
_.mixin = function(obj) { | |
each(_.functions(obj), function(name){ | |
addToWrapper(name, _[name] = obj[name]); | |
}); | |
}; | |
// Generate a unique integer id (unique within the entire client session). | |
// Useful for temporary DOM ids. | |
var idCounter = 0; | |
_.uniqueId = function(prefix) { | |
var id = idCounter++; | |
return prefix ? prefix + id : id; | |
}; | |
// By default, Underscore uses ERB-style template delimiters, change the | |
// following template settings to use alternative delimiters. | |
_.templateSettings = { | |
evaluate : /<%([\s\S]+?)%>/g, | |
interpolate : /<%=([\s\S]+?)%>/g, | |
escape : /<%-([\s\S]+?)%>/g | |
}; | |
// When customizing `templateSettings`, if you don't want to define an | |
// interpolation, evaluation or escaping regex, we need one that is | |
// guaranteed not to match. | |
var noMatch = /.^/; | |
// Certain characters need to be escaped so that they can be put into a | |
// string literal. | |
var escapes = { | |
'\\': '\\', | |
"'": "'", | |
r: '\r', | |
n: '\n', | |
t: '\t', | |
u2028: '\u2028', | |
u2029: '\u2029' | |
}; | |
for (var key in escapes) escapes[escapes[key]] = key; | |
var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; | |
var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g; | |
// Within an interpolation, evaluation, or escaping, remove HTML escaping | |
// that had been previously added. | |
var unescape = function(code) { | |
return code.replace(unescaper, function(match, escape) { | |
return escapes[escape]; | |
}); | |
}; | |
// JavaScript micro-templating, similar to John Resig's implementation. | |
// Underscore templating handles arbitrary delimiters, preserves whitespace, | |
// and correctly escapes quotes within interpolated code. | |
_.template = function(text, data, settings) { | |
settings = _.defaults(settings || {}, _.templateSettings); | |
// Compile the template source, taking care to escape characters that | |
// cannot be included in a string literal and then unescape them in code | |
// blocks. | |
var source = "__p+='" + text | |
.replace(escaper, function(match) { | |
return '\\' + escapes[match]; | |
}) | |
.replace(settings.escape || noMatch, function(match, code) { | |
return "'+\n((__t=(" + unescape(code) + "))==null?'':_.escape(__t))+\n'"; | |
}) | |
.replace(settings.interpolate || noMatch, function(match, code) { | |
return "'+\n((__t=(" + unescape(code) + "))==null?'':__t)+\n'"; | |
}) | |
.replace(settings.evaluate || noMatch, function(match, code) { | |
return "';\n" + unescape(code) + "\n__p+='"; | |
}) + "';\n"; | |
// If a variable is not specified, place data values in local scope. | |
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; | |
source = "var __t,__p='',__j=Array.prototype.join," + | |
"print=function(){__p+=__j.call(arguments,'')};\n" + | |
source + "return __p;\n"; | |
var render = new Function(settings.variable || 'obj', '_', source); | |
if (data) return render(data, _); | |
var template = function(data) { | |
return render.call(this, data, _); | |
}; | |
// Provide the compiled function source as a convenience for precompilation. | |
template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; | |
return template; | |
}; | |
// Add a "chain" function, which will delegate to the wrapper. | |
_.chain = function(obj) { | |
return _(obj).chain(); | |
}; | |
// The OOP Wrapper | |
// --------------- | |
// If Underscore is called as a function, it returns a wrapped object that | |
// can be used OO-style. This wrapper holds altered versions of all the | |
// underscore functions. Wrapped objects may be chained. | |
var wrapper = function(obj) { this._wrapped = obj; }; | |
// Expose `wrapper.prototype` as `_.prototype` | |
_.prototype = wrapper.prototype; | |
// Helper function to continue chaining intermediate results. | |
var result = function(obj, chain) { | |
return chain ? _(obj).chain() : obj; | |
}; | |
// A method to easily add functions to the OOP wrapper. | |
var addToWrapper = function(name, func) { | |
wrapper.prototype[name] = function() { | |
var args = slice.call(arguments); | |
unshift.call(args, this._wrapped); | |
return result(func.apply(_, args), this._chain); | |
}; | |
}; | |
// Add all of the Underscore functions to the wrapper object. | |
_.mixin(_); | |
// Add all mutator Array functions to the wrapper. | |
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { | |
var method = ArrayProto[name]; | |
wrapper.prototype[name] = function() { | |
var obj = this._wrapped; | |
method.apply(obj, arguments); | |
if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; | |
return result(obj, this._chain); | |
}; | |
}); | |
// Add all accessor Array functions to the wrapper. | |
each(['concat', 'join', 'slice'], function(name) { | |
var method = ArrayProto[name]; | |
wrapper.prototype[name] = function() { | |
return result(method.apply(this._wrapped, arguments), this._chain); | |
}; | |
}); | |
// Start chaining a wrapped Underscore object. | |
wrapper.prototype.chain = function() { | |
this._chain = true; | |
return this; | |
}; | |
// Extracts the result from a wrapped and chained object. | |
wrapper.prototype.value = function() { | |
return this._wrapped; | |
}; | |
}).call(this); | |
}); | |
require.register("noflo-fbp/lib/fbp.js", function(exports, require, module){ | |
module.exports = (function(){ | |
/* | |
* Generated by PEG.js 0.7.0. | |
* | |
* http://pegjs.majda.cz/ | |
*/ | |
function quote(s) { | |
/* | |
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a | |
* string literal except for the closing quote character, backslash, | |
* carriage return, line separator, paragraph separator, and line feed. | |
* Any character may appear in the form of an escape sequence. | |
* | |
* For portability, we also escape escape all control and non-ASCII | |
* characters. Note that "\0" and "\v" escape sequences are not used | |
* because JSHint does not like the first and IE the second. | |
*/ | |
return '"' + s | |
.replace(/\\/g, '\\\\') // backslash | |
.replace(/"/g, '\\"') // closing quote character | |
.replace(/\x08/g, '\\b') // backspace | |
.replace(/\t/g, '\\t') // horizontal tab | |
.replace(/\n/g, '\\n') // line feed | |
.replace(/\f/g, '\\f') // form feed | |
.replace(/\r/g, '\\r') // carriage return | |
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) | |
+ '"'; | |
} | |
var result = { | |
/* | |
* Parses the input with a generated parser. If the parsing is successfull, | |
* returns a value explicitly or implicitly specified by the grammar from | |
* which the parser was generated (see |PEG.buildParser|). If the parsing is | |
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error. | |
*/ | |
parse: function(input, startRule) { | |
var parseFunctions = { | |
"start": parse_start, | |
"line": parse_line, | |
"LineTerminator": parse_LineTerminator, | |
"comment": parse_comment, | |
"connection": parse_connection, | |
"bridge": parse_bridge, | |
"leftlet": parse_leftlet, | |
"iip": parse_iip, | |
"rightlet": parse_rightlet, | |
"node": parse_node, | |
"component": parse_component, | |
"compMeta": parse_compMeta, | |
"port": parse_port, | |
"anychar": parse_anychar, | |
"_": parse__, | |
"__": parse___ | |
}; | |
if (startRule !== undefined) { | |
if (parseFunctions[startRule] === undefined) { | |
throw new Error("Invalid rule name: " + quote(startRule) + "."); | |
} | |
} else { | |
startRule = "start"; | |
} | |
var pos = 0; | |
var reportFailures = 0; | |
var rightmostFailuresPos = 0; | |
var rightmostFailuresExpected = []; | |
function padLeft(input, padding, length) { | |
var result = input; | |
var padLength = length - input.length; | |
for (var i = 0; i < padLength; i++) { | |
result = padding + result; | |
} | |
return result; | |
} | |
function escape(ch) { | |
var charCode = ch.charCodeAt(0); | |
var escapeChar; | |
var length; | |
if (charCode <= 0xFF) { | |
escapeChar = 'x'; | |
length = 2; | |
} else { | |
escapeChar = 'u'; | |
length = 4; | |
} | |
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); | |
} | |
function matchFailed(failure) { | |
if (pos < rightmostFailuresPos) { | |
return; | |
} | |
if (pos > rightmostFailuresPos) { | |
rightmostFailuresPos = pos; | |
rightmostFailuresExpected = []; | |
} | |
rightmostFailuresExpected.push(failure); | |
} | |
function parse_start() { | |
var result0, result1; | |
var pos0; | |
pos0 = pos; | |
result0 = []; | |
result1 = parse_line(); | |
while (result1 !== null) { | |
result0.push(result1); | |
result1 = parse_line(); | |
} | |
if (result0 !== null) { | |
result0 = (function(offset) { return parser.getResult(); })(pos0); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_line() { | |
var result0, result1, result2, result3, result4, result5, result6; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse__(); | |
if (result0 !== null) { | |
if (input.substr(pos, 7) === "EXPORT=") { | |
result1 = "EXPORT="; | |
pos += 7; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"EXPORT=\""); | |
} | |
} | |
if (result1 !== null) { | |
if (/^[A-Z.]/.test(input.charAt(pos))) { | |
result3 = input.charAt(pos); | |
pos++; | |
} else { | |
result3 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z.]"); | |
} | |
} | |
if (result3 !== null) { | |
result2 = []; | |
while (result3 !== null) { | |
result2.push(result3); | |
if (/^[A-Z.]/.test(input.charAt(pos))) { | |
result3 = input.charAt(pos); | |
pos++; | |
} else { | |
result3 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z.]"); | |
} | |
} | |
} | |
} else { | |
result2 = null; | |
} | |
if (result2 !== null) { | |
if (input.charCodeAt(pos) === 58) { | |
result3 = ":"; | |
pos++; | |
} else { | |
result3 = null; | |
if (reportFailures === 0) { | |
matchFailed("\":\""); | |
} | |
} | |
if (result3 !== null) { | |
if (/^[A-Z]/.test(input.charAt(pos))) { | |
result5 = input.charAt(pos); | |
pos++; | |
} else { | |
result5 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z]"); | |
} | |
} | |
if (result5 !== null) { | |
result4 = []; | |
while (result5 !== null) { | |
result4.push(result5); | |
if (/^[A-Z]/.test(input.charAt(pos))) { | |
result5 = input.charAt(pos); | |
pos++; | |
} else { | |
result5 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z]"); | |
} | |
} | |
} | |
} else { | |
result4 = null; | |
} | |
if (result4 !== null) { | |
result5 = parse__(); | |
if (result5 !== null) { | |
result6 = parse_LineTerminator(); | |
result6 = result6 !== null ? result6 : ""; | |
if (result6 !== null) { | |
result0 = [result0, result1, result2, result3, result4, result5, result6]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, priv, pub) {return parser.registerExports(priv.join(""),pub.join(""))})(pos0, result0[2], result0[4]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
if (result0 === null) { | |
pos0 = pos; | |
result0 = parse_comment(); | |
if (result0 !== null) { | |
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[\\n\\r\\u2028\\u2029]"); | |
} | |
} | |
result1 = result1 !== null ? result1 : ""; | |
if (result1 !== null) { | |
result0 = [result0, result1]; | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
if (result0 === null) { | |
pos0 = pos; | |
result0 = parse__(); | |
if (result0 !== null) { | |
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[\\n\\r\\u2028\\u2029]"); | |
} | |
} | |
if (result1 !== null) { | |
result0 = [result0, result1]; | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
if (result0 === null) { | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse__(); | |
if (result0 !== null) { | |
result1 = parse_connection(); | |
if (result1 !== null) { | |
result2 = parse__(); | |
if (result2 !== null) { | |
result3 = parse_LineTerminator(); | |
result3 = result3 !== null ? result3 : ""; | |
if (result3 !== null) { | |
result0 = [result0, result1, result2, result3]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, edges) {return parser.registerEdges(edges);})(pos0, result0[1]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
} | |
} | |
} | |
return result0; | |
} | |
function parse_LineTerminator() { | |
var result0, result1, result2, result3; | |
var pos0; | |
pos0 = pos; | |
result0 = parse__(); | |
if (result0 !== null) { | |
if (input.charCodeAt(pos) === 44) { | |
result1 = ","; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\",\""); | |
} | |
} | |
result1 = result1 !== null ? result1 : ""; | |
if (result1 !== null) { | |
result2 = parse_comment(); | |
result2 = result2 !== null ? result2 : ""; | |
if (result2 !== null) { | |
if (/^[\n\r\u2028\u2029]/.test(input.charAt(pos))) { | |
result3 = input.charAt(pos); | |
pos++; | |
} else { | |
result3 = null; | |
if (reportFailures === 0) { | |
matchFailed("[\\n\\r\\u2028\\u2029]"); | |
} | |
} | |
result3 = result3 !== null ? result3 : ""; | |
if (result3 !== null) { | |
result0 = [result0, result1, result2, result3]; | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_comment() { | |
var result0, result1, result2, result3; | |
var pos0; | |
pos0 = pos; | |
result0 = parse__(); | |
if (result0 !== null) { | |
if (input.charCodeAt(pos) === 35) { | |
result1 = "#"; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"#\""); | |
} | |
} | |
if (result1 !== null) { | |
result2 = []; | |
result3 = parse_anychar(); | |
while (result3 !== null) { | |
result2.push(result3); | |
result3 = parse_anychar(); | |
} | |
if (result2 !== null) { | |
result0 = [result0, result1, result2]; | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
} else { | |
result0 = null; | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_connection() { | |
var result0, result1, result2, result3, result4; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse_bridge(); | |
if (result0 !== null) { | |
result1 = parse__(); | |
if (result1 !== null) { | |
if (input.substr(pos, 2) === "->") { | |
result2 = "->"; | |
pos += 2; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"->\""); | |
} | |
} | |
if (result2 !== null) { | |
result3 = parse__(); | |
if (result3 !== null) { | |
result4 = parse_connection(); | |
if (result4 !== null) { | |
result0 = [result0, result1, result2, result3, result4]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, x, y) { return [x,y]; })(pos0, result0[0], result0[4]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
if (result0 === null) { | |
result0 = parse_bridge(); | |
} | |
return result0; | |
} | |
function parse_bridge() { | |
var result0, result1, result2, result3, result4; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse_port(); | |
if (result0 !== null) { | |
result1 = parse__(); | |
if (result1 !== null) { | |
result2 = parse_node(); | |
if (result2 !== null) { | |
result3 = parse__(); | |
if (result3 !== null) { | |
result4 = parse_port(); | |
if (result4 !== null) { | |
result0 = [result0, result1, result2, result3, result4]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, x, proc, y) { return [{"tgt":{process:proc, port:x}},{"src":{process:proc, port:y}}]; })(pos0, result0[0], result0[2], result0[4]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
if (result0 === null) { | |
result0 = parse_iip(); | |
if (result0 === null) { | |
result0 = parse_rightlet(); | |
if (result0 === null) { | |
result0 = parse_leftlet(); | |
} | |
} | |
} | |
return result0; | |
} | |
function parse_leftlet() { | |
var result0, result1, result2; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse_node(); | |
if (result0 !== null) { | |
result1 = parse__(); | |
if (result1 !== null) { | |
result2 = parse_port(); | |
if (result2 !== null) { | |
result0 = [result0, result1, result2]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, proc, port) { return {"src":{process:proc, port:port}} })(pos0, result0[0], result0[2]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_iip() { | |
var result0, result1, result2; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
if (input.charCodeAt(pos) === 39) { | |
result0 = "'"; | |
pos++; | |
} else { | |
result0 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"'\""); | |
} | |
} | |
if (result0 !== null) { | |
result1 = []; | |
result2 = parse_anychar(); | |
while (result2 !== null) { | |
result1.push(result2); | |
result2 = parse_anychar(); | |
} | |
if (result1 !== null) { | |
if (input.charCodeAt(pos) === 39) { | |
result2 = "'"; | |
pos++; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"'\""); | |
} | |
} | |
if (result2 !== null) { | |
result0 = [result0, result1, result2]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, iip) { return {"data":iip.join("")} })(pos0, result0[1]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_rightlet() { | |
var result0, result1, result2; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
result0 = parse_port(); | |
if (result0 !== null) { | |
result1 = parse__(); | |
if (result1 !== null) { | |
result2 = parse_node(); | |
if (result2 !== null) { | |
result0 = [result0, result1, result2]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, port, proc) { return {"tgt":{process:proc, port:port}} })(pos0, result0[0], result0[2]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_node() { | |
var result0, result1; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
if (/^[a-zA-Z]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z]"); | |
} | |
} | |
if (result1 !== null) { | |
result0 = []; | |
while (result1 !== null) { | |
result0.push(result1); | |
if (/^[a-zA-Z]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z]"); | |
} | |
} | |
} | |
} else { | |
result0 = null; | |
} | |
if (result0 !== null) { | |
result1 = parse_component(); | |
result1 = result1 !== null ? result1 : ""; | |
if (result1 !== null) { | |
result0 = [result0, result1]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, node, comp) { if(comp){parser.addNode(node.join(""),comp);}; return node.join("")})(pos0, result0[0], result0[1]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_component() { | |
var result0, result1, result2, result3; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
if (input.charCodeAt(pos) === 40) { | |
result0 = "("; | |
pos++; | |
} else { | |
result0 = null; | |
if (reportFailures === 0) { | |
matchFailed("\"(\""); | |
} | |
} | |
if (result0 !== null) { | |
if (/^[a-zA-Z\/\-]/.test(input.charAt(pos))) { | |
result2 = input.charAt(pos); | |
pos++; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z\\/\\-]"); | |
} | |
} | |
if (result2 !== null) { | |
result1 = []; | |
while (result2 !== null) { | |
result1.push(result2); | |
if (/^[a-zA-Z\/\-]/.test(input.charAt(pos))) { | |
result2 = input.charAt(pos); | |
pos++; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z\\/\\-]"); | |
} | |
} | |
} | |
} else { | |
result1 = null; | |
} | |
result1 = result1 !== null ? result1 : ""; | |
if (result1 !== null) { | |
result2 = parse_compMeta(); | |
result2 = result2 !== null ? result2 : ""; | |
if (result2 !== null) { | |
if (input.charCodeAt(pos) === 41) { | |
result3 = ")"; | |
pos++; | |
} else { | |
result3 = null; | |
if (reportFailures === 0) { | |
matchFailed("\")\""); | |
} | |
} | |
if (result3 !== null) { | |
result0 = [result0, result1, result2, result3]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, comp, meta) { var o = {}; comp ? o.comp = comp.join("") : o.comp = ''; meta ? o.meta = meta.join("").split(',') : null; return o; })(pos0, result0[1], result0[2]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_compMeta() { | |
var result0, result1, result2; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
if (input.charCodeAt(pos) === 58) { | |
result0 = ":"; | |
pos++; | |
} else { | |
result0 = null; | |
if (reportFailures === 0) { | |
matchFailed("\":\""); | |
} | |
} | |
if (result0 !== null) { | |
if (/^[a-zA-Z\/]/.test(input.charAt(pos))) { | |
result2 = input.charAt(pos); | |
pos++; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z\\/]"); | |
} | |
} | |
if (result2 !== null) { | |
result1 = []; | |
while (result2 !== null) { | |
result1.push(result2); | |
if (/^[a-zA-Z\/]/.test(input.charAt(pos))) { | |
result2 = input.charAt(pos); | |
pos++; | |
} else { | |
result2 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z\\/]"); | |
} | |
} | |
} | |
} else { | |
result1 = null; | |
} | |
if (result1 !== null) { | |
result0 = [result0, result1]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, meta) {return meta})(pos0, result0[1]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_port() { | |
var result0, result1; | |
var pos0, pos1; | |
pos0 = pos; | |
pos1 = pos; | |
if (/^[A-Z.0-9]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z.0-9]"); | |
} | |
} | |
if (result1 !== null) { | |
result0 = []; | |
while (result1 !== null) { | |
result0.push(result1); | |
if (/^[A-Z.0-9]/.test(input.charAt(pos))) { | |
result1 = input.charAt(pos); | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("[A-Z.0-9]"); | |
} | |
} | |
} | |
} else { | |
result0 = null; | |
} | |
if (result0 !== null) { | |
result1 = parse___(); | |
if (result1 !== null) { | |
result0 = [result0, result1]; | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
} else { | |
result0 = null; | |
pos = pos1; | |
} | |
if (result0 !== null) { | |
result0 = (function(offset, portname) {return portname.join("").toLowerCase()})(pos0, result0[0]); | |
} | |
if (result0 === null) { | |
pos = pos0; | |
} | |
return result0; | |
} | |
function parse_anychar() { | |
var result0; | |
if (/^[a-zA-Z0-9 .,#:{}@+?!^=()_\-$*\/\\[\]{}"&`%|]/.test(input.charAt(pos))) { | |
result0 = input.charAt(pos); | |
pos++; | |
} else { | |
result0 = null; | |
if (reportFailures === 0) { | |
matchFailed("[a-zA-Z0-9 .,#:{}@+?!^=()_\\-$*\\/\\\\[\\]{}\"&`%|]"); | |
} | |
} | |
return result0; | |
} | |
function parse__() { | |
var result0, result1; | |
result0 = []; | |
if (input.charCodeAt(pos) === 32) { | |
result1 = " "; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\" \""); | |
} | |
} | |
while (result1 !== null) { | |
result0.push(result1); | |
if (input.charCodeAt(pos) === 32) { | |
result1 = " "; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\" \""); | |
} | |
} | |
} | |
result0 = result0 !== null ? result0 : ""; | |
return result0; | |
} | |
function parse___() { | |
var result0, result1; | |
if (input.charCodeAt(pos) === 32) { | |
result1 = " "; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\" \""); | |
} | |
} | |
if (result1 !== null) { | |
result0 = []; | |
while (result1 !== null) { | |
result0.push(result1); | |
if (input.charCodeAt(pos) === 32) { | |
result1 = " "; | |
pos++; | |
} else { | |
result1 = null; | |
if (reportFailures === 0) { | |
matchFailed("\" \""); | |
} | |
} | |
} | |
} else { | |
result0 = null; | |
} | |
return result0; | |
} | |
function cleanupExpected(expected) { | |
expected.sort(); | |
var lastExpected = null; | |
var cleanExpected = []; | |
for (var i = 0; i < expected.length; i++) { | |
if (expected[i] !== lastExpected) { | |
cleanExpected.push(expected[i]); | |
lastExpected = expected[i]; | |
} | |
} | |
return cleanExpected; | |
} | |
function computeErrorPosition() { | |
/* | |
* The first idea was to use |String.split| to break the input up to the | |
* error position along newlines and derive the line and column from | |
* there. However IE's |split| implementation is so broken that it was | |
* enough to prevent it. | |
*/ | |
var line = 1; | |
var column = 1; | |
var seenCR = false; | |
for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) { | |
var ch = input.charAt(i); | |
if (ch === "\n") { | |
if (!seenCR) { line++; } | |
column = 1; | |
seenCR = false; | |
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | |
line++; | |
column = 1; | |
seenCR = true; | |
} else { | |
column++; | |
seenCR = false; | |
} | |
} | |
return { line: line, column: column }; | |
} | |
var parser, edges, nodes; | |
parser = this; | |
edges = parser.edges = []; | |
parser.exports = [] | |
nodes = {}; | |
parser.addNode = function (nodeName, comp) { | |
if (!nodes[nodeName]) { | |
nodes[nodeName] = {} | |
} | |
if (!!comp.comp) { | |
nodes[nodeName].component = comp.comp; | |
} | |
if (!!comp.meta) { | |
nodes[nodeName].metadata={routes:comp.meta}; | |
} | |
} | |
parser.getResult = function () { | |
return {processes:nodes, connections:parser.processEdges(), exports:parser.exports}; | |
} | |
var flatten = function (array, isShallow) { | |
var index = -1, | |
length = array ? array.length : 0, | |
result = []; | |
while (++index < length) { | |
var value = array[index]; | |
if (value instanceof Array) { | |
Array.prototype.push.apply(result, isShallow ? value : flatten(value)); | |
} | |
else { | |
result.push(value); | |
} | |
} | |
return result; | |
} | |
parser.registerExports = function (priv, pub) { | |
parser.exports.push({private:priv.toLowerCase(), public:pub.toLowerCase()}) | |
} | |
parser.registerEdges = function (edges) { | |
edges.forEach(function (o, i) { | |
parser.edges.push(o); | |
}); | |
} | |
parser.processEdges = function () { | |
var flats, grouped; | |
flats = flatten(parser.edges); | |
grouped = []; | |
var current = {}; | |
flats.forEach(function (o, i) { | |
if (i % 2 !== 0) { | |
var pair = grouped[grouped.length - 1]; | |
pair.tgt = o.tgt; | |
return; | |
} | |
grouped.push(o); | |
}); | |
return grouped; | |
} | |
var result = parseFunctions[startRule](); | |
/* | |
* The parser is now in one of the following three states: | |
* | |
* 1. The parser successfully parsed the whole input. | |
* | |
* - |result !== null| | |
* - |pos === input.length| | |
* - |rightmostFailuresExpected| may or may not contain something | |
* | |
* 2. The parser successfully parsed only a part of the input. | |
* | |
* - |result !== null| | |
* - |pos < input.length| | |
* - |rightmostFailuresExpected| may or may not contain something | |
* | |
* 3. The parser did not successfully parse any part of the input. | |
* | |
* - |result === null| | |
* - |pos === 0| | |
* - |rightmostFailuresExpected| contains at least one failure | |
* | |
* All code following this comment (including called functions) must | |
* handle these states. | |
*/ | |
if (result === null || pos !== input.length) { | |
var offset = Math.max(pos, rightmostFailuresPos); | |
var found = offset < input.length ? input.charAt(offset) : null; | |
var errorPosition = computeErrorPosition(); | |
throw new this.SyntaxError( | |
cleanupExpected(rightmostFailuresExpected), | |
found, | |
offset, | |
errorPosition.line, | |
errorPosition.column | |
); | |
} | |
return result; | |
}, | |
/* Returns the parser source code. */ | |
toSource: function() { return this._source; } | |
}; | |
/* Thrown when a parser encounters a syntax error. */ | |
result.SyntaxError = function(expected, found, offset, line, column) { | |
function buildMessage(expected, found) { | |
var expectedHumanized, foundHumanized; | |
switch (expected.length) { | |
case 0: | |
expectedHumanized = "end of input"; | |
break; | |
case 1: | |
expectedHumanized = expected[0]; | |
break; | |
default: | |
expectedHumanized = expected.slice(0, expected.length - 1).join(", ") | |
+ " or " | |
+ expected[expected.length - 1]; | |
} | |
foundHumanized = found ? quote(found) : "end of input"; | |
return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; | |
} | |
this.name = "SyntaxError"; | |
this.expected = expected; | |
this.found = found; | |
this.message = buildMessage(expected, found); | |
this.offset = offset; | |
this.line = line; | |
this.column = column; | |
}; | |
result.SyntaxError.prototype = Error.prototype; | |
return result; | |
})(); | |
}); | |
require.register("noflo-noflo/src/lib/Graph.js", function(exports, require, module){ | |
var EventEmitter, Graph, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
EventEmitter = require('events').EventEmitter; | |
} else { | |
EventEmitter = require('emitter'); | |
} | |
Graph = (function(_super) { | |
__extends(Graph, _super); | |
Graph.prototype.name = ''; | |
Graph.prototype.nodes = []; | |
Graph.prototype.edges = []; | |
Graph.prototype.initializers = []; | |
Graph.prototype.exports = []; | |
function Graph(name) { | |
this.name = name != null ? name : ''; | |
this.nodes = []; | |
this.edges = []; | |
this.initializers = []; | |
this.exports = []; | |
} | |
Graph.prototype.addExport = function(privatePort, publicPort) { | |
return this.exports.push({ | |
"private": privatePort.toLowerCase(), | |
"public": publicPort.toLowerCase() | |
}); | |
}; | |
Graph.prototype.addNode = function(id, component, metadata) { | |
var node; | |
if (!metadata) { | |
metadata = {}; | |
} | |
node = { | |
id: id, | |
component: component, | |
metadata: metadata | |
}; | |
this.nodes.push(node); | |
this.emit('addNode', node); | |
return node; | |
}; | |
Graph.prototype.removeNode = function(id) { | |
var edge, initializer, node, _i, _j, _len, _len1, _ref, _ref1; | |
node = this.getNode(id); | |
_ref = this.edges; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
edge = _ref[_i]; | |
if (!edge) { | |
continue; | |
} | |
if (edge.from.node === node.id) { | |
this.removeEdge(edge.from.node, edge.from.port); | |
} | |
if (edge.to.node === node.id) { | |
this.removeEdge(edge.to.node, edge.to.port); | |
} | |
} | |
_ref1 = this.initializers; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
initializer = _ref1[_j]; | |
if (!initializer) { | |
continue; | |
} | |
if (initializer.to.node === node.id) { | |
this.removeEdge(initializer.to.node, initializer.to.port); | |
} | |
} | |
this.emit('removeNode', node); | |
if (-1 !== this.nodes.indexOf(node)) { | |
return this.nodes.splice(this.nodes.indexOf(node), 1); | |
} | |
}; | |
Graph.prototype.getNode = function(id) { | |
var node, _i, _len, _ref; | |
_ref = this.nodes; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
node = _ref[_i]; | |
if (!node) { | |
continue; | |
} | |
if (node.id === id) { | |
return node; | |
} | |
} | |
return null; | |
}; | |
Graph.prototype.renameNode = function(oldId, newId) { | |
var edge, iip, node, _i, _j, _len, _len1, _ref, _ref1; | |
node = this.getNode(oldId); | |
if (!node) { | |
return; | |
} | |
node.id = newId; | |
_ref = this.edges; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
edge = _ref[_i]; | |
if (!edge) { | |
continue; | |
} | |
if (edge.from.node === oldId) { | |
edge.from.node = newId; | |
} | |
if (edge.to.node === oldId) { | |
edge.to.node = newId; | |
} | |
} | |
_ref1 = this.initializers; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
iip = _ref1[_j]; | |
if (!iip) { | |
continue; | |
} | |
if (iip.to.node === oldId) { | |
iip.to.node = newId; | |
} | |
} | |
return this.emit('renameNode', oldId, newId); | |
}; | |
Graph.prototype.addEdge = function(outNode, outPort, inNode, inPort, metadata) { | |
var edge; | |
if (!metadata) { | |
metadata = {}; | |
} | |
edge = { | |
from: { | |
node: outNode, | |
port: outPort | |
}, | |
to: { | |
node: inNode, | |
port: inPort | |
}, | |
metadata: metadata | |
}; | |
this.edges.push(edge); | |
this.emit('addEdge', edge); | |
return edge; | |
}; | |
Graph.prototype.removeEdge = function(node, port, node2, port2) { | |
var edge, index, _i, _len, _ref, _results; | |
_ref = this.edges; | |
_results = []; | |
for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { | |
edge = _ref[index]; | |
if (!edge) { | |
continue; | |
} | |
if (edge.from.node === node && edge.from.port === port) { | |
if (node2 && port2) { | |
if (!(edge.to.node === node2 && edge.to.port === port2)) { | |
continue; | |
} | |
} | |
this.emit('removeEdge', edge); | |
this.edges.splice(index, 1); | |
} | |
if (edge.to.node === node && edge.to.port === port) { | |
if (node2 && port2) { | |
if (!(edge.from.node === node2 && edge.from.port === port2)) { | |
continue; | |
} | |
} | |
this.emit('removeEdge', edge); | |
_results.push(this.edges.splice(index, 1)); | |
} else { | |
_results.push(void 0); | |
} | |
} | |
return _results; | |
}; | |
Graph.prototype.addInitial = function(data, node, port, metadata) { | |
var initializer; | |
initializer = { | |
from: { | |
data: data | |
}, | |
to: { | |
node: node, | |
port: port | |
}, | |
metadata: metadata | |
}; | |
this.initializers.push(initializer); | |
this.emit('addInitial', initializer); | |
return initializer; | |
}; | |
Graph.prototype.removeInitial = function(node, port) { | |
var edge, index, _i, _len, _ref, _results; | |
_ref = this.initializers; | |
_results = []; | |
for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { | |
edge = _ref[index]; | |
if (!edge) { | |
continue; | |
} | |
if (edge.to.node === node && edge.to.port === port) { | |
this.emit('removeInitial', edge); | |
_results.push(this.initializers.splice(index, 1)); | |
} else { | |
_results.push(void 0); | |
} | |
} | |
return _results; | |
}; | |
Graph.prototype.toDOT = function() { | |
var cleanID, cleanPort, dot, edge, id, initializer, node, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; | |
cleanID = function(id) { | |
return id.replace(/\s*/g, ""); | |
}; | |
cleanPort = function(port) { | |
return port.replace(/\./g, ""); | |
}; | |
dot = "digraph {\n"; | |
_ref = this.nodes; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
node = _ref[_i]; | |
dot += " " + (cleanID(node.id)) + " [label=" + node.id + " shape=box]\n"; | |
} | |
_ref1 = this.initializers; | |
for (id = _j = 0, _len1 = _ref1.length; _j < _len1; id = ++_j) { | |
initializer = _ref1[id]; | |
dot += " data" + id + " [label=\"'" + initializer.from.data + "'\" shape=plaintext]\n"; | |
dot += " data" + id + " -> " + (cleanID(initializer.to.node)) + "[headlabel=" + (cleanPort(initializer.to.port)) + " labelfontcolor=blue labelfontsize=8.0]\n"; | |
} | |
_ref2 = this.edges; | |
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | |
edge = _ref2[_k]; | |
dot += " " + (cleanID(edge.from.node)) + " -> " + (cleanID(edge.to.node)) + "[taillabel=" + (cleanPort(edge.from.port)) + " headlabel=" + (cleanPort(edge.to.port)) + " labelfontcolor=blue labelfontsize=8.0]\n"; | |
} | |
dot += "}"; | |
return dot; | |
}; | |
Graph.prototype.toYUML = function() { | |
var edge, initializer, yuml, _i, _j, _len, _len1, _ref, _ref1; | |
yuml = []; | |
_ref = this.initializers; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
initializer = _ref[_i]; | |
yuml.push("(start)[" + initializer.to.port + "]->(" + initializer.to.node + ")"); | |
} | |
_ref1 = this.edges; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
edge = _ref1[_j]; | |
yuml.push("(" + edge.from.node + ")[" + edge.from.port + "]->(" + edge.to.node + ")"); | |
} | |
return yuml.join(","); | |
}; | |
Graph.prototype.toJSON = function() { | |
var connection, edge, exported, initializer, json, node, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3; | |
json = { | |
properties: {}, | |
exports: [], | |
processes: {}, | |
connections: [] | |
}; | |
if (this.name) { | |
json.properties.name = this.name; | |
} | |
_ref = this.exports; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
exported = _ref[_i]; | |
json.exports.push({ | |
"private": exported["private"], | |
"public": exported["public"] | |
}); | |
} | |
_ref1 = this.nodes; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
node = _ref1[_j]; | |
json.processes[node.id] = { | |
component: node.component | |
}; | |
if (node.metadata) { | |
json.processes[node.id].metadata = node.metadata; | |
} | |
} | |
_ref2 = this.edges; | |
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | |
edge = _ref2[_k]; | |
connection = { | |
src: { | |
process: edge.from.node, | |
port: edge.from.port | |
}, | |
tgt: { | |
process: edge.to.node, | |
port: edge.to.port | |
} | |
}; | |
if (Object.keys(edge.metadata).length) { | |
connection.metadata = edge.metadata; | |
} | |
json.connections.push(connection); | |
} | |
_ref3 = this.initializers; | |
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | |
initializer = _ref3[_l]; | |
json.connections.push({ | |
data: initializer.from.data, | |
tgt: { | |
process: initializer.to.node, | |
port: initializer.to.port | |
} | |
}); | |
} | |
return json; | |
}; | |
Graph.prototype.save = function(file, success) { | |
var json; | |
json = JSON.stringify(this.toJSON(), null, 4); | |
return require('fs').writeFile("" + file + ".json", json, "utf-8", function(err, data) { | |
if (err) { | |
throw err; | |
} | |
return success(file); | |
}); | |
}; | |
return Graph; | |
})(EventEmitter); | |
exports.Graph = Graph; | |
exports.createGraph = function(name) { | |
return new Graph(name); | |
}; | |
exports.loadJSON = function(definition, success) { | |
var conn, def, exported, graph, id, metadata, _i, _j, _len, _len1, _ref, _ref1, _ref2; | |
if (!definition.properties) { | |
definition.properties = {}; | |
} | |
if (!definition.processes) { | |
definition.processes = {}; | |
} | |
if (!definition.connections) { | |
definition.connections = []; | |
} | |
graph = new Graph(definition.properties.name); | |
_ref = definition.processes; | |
for (id in _ref) { | |
def = _ref[id]; | |
if (!def.metadata) { | |
def.metadata = {}; | |
} | |
graph.addNode(id, def.component, def.metadata); | |
} | |
_ref1 = definition.connections; | |
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | |
conn = _ref1[_i]; | |
if (conn.data !== void 0) { | |
graph.addInitial(conn.data, conn.tgt.process, conn.tgt.port.toLowerCase()); | |
continue; | |
} | |
metadata = conn.metadata ? conn.metadata : {}; | |
graph.addEdge(conn.src.process, conn.src.port.toLowerCase(), conn.tgt.process, conn.tgt.port.toLowerCase(), metadata); | |
} | |
if (definition.exports) { | |
_ref2 = definition.exports; | |
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { | |
exported = _ref2[_j]; | |
graph.addExport(exported["private"], exported["public"]); | |
} | |
} | |
return success(graph); | |
}; | |
exports.loadFBP = function(fbpData, success) { | |
var definition; | |
definition = require('fbp').parse(fbpData); | |
return exports.loadJSON(definition, success); | |
}; | |
exports.loadFile = function(file, success) { | |
var definition, e; | |
if (!(typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1)) { | |
try { | |
definition = require(file); | |
exports.loadJSON(definition, success); | |
} catch (_error) { | |
e = _error; | |
throw new Error("Failed to load graph " + file + ": " + e.message); | |
} | |
return; | |
} | |
return require('fs').readFile(file, "utf-8", function(err, data) { | |
if (err) { | |
throw err; | |
} | |
if (file.split('.').pop() === 'fbp') { | |
return exports.loadFBP(data, success); | |
} | |
definition = JSON.parse(data); | |
return exports.loadJSON(definition, success); | |
}); | |
}; | |
}); | |
require.register("noflo-noflo/src/lib/InternalSocket.js", function(exports, require, module){ | |
var EventEmitter, InternalSocket, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
EventEmitter = require('events').EventEmitter; | |
} else { | |
EventEmitter = require('emitter'); | |
} | |
InternalSocket = (function(_super) { | |
__extends(InternalSocket, _super); | |
function InternalSocket() { | |
this.connected = false; | |
this.groups = []; | |
} | |
InternalSocket.prototype.connect = function() { | |
if (this.connected) { | |
return; | |
} | |
this.connected = true; | |
return this.emit('connect', this); | |
}; | |
InternalSocket.prototype.disconnect = function() { | |
if (!this.connected) { | |
return; | |
} | |
this.connected = false; | |
return this.emit('disconnect', this); | |
}; | |
InternalSocket.prototype.isConnected = function() { | |
return this.connected; | |
}; | |
InternalSocket.prototype.send = function(data) { | |
if (!this.connected) { | |
this.connect(); | |
} | |
return this.emit('data', data); | |
}; | |
InternalSocket.prototype.beginGroup = function(group) { | |
this.groups.push(group); | |
return this.emit('begingroup', group); | |
}; | |
InternalSocket.prototype.endGroup = function() { | |
return this.emit('endgroup', this.groups.pop()); | |
}; | |
InternalSocket.prototype.getId = function() { | |
var fromStr, toStr; | |
fromStr = function(from) { | |
return "" + from.process.id + "() " + (from.port.toUpperCase()); | |
}; | |
toStr = function(to) { | |
return "" + (to.port.toUpperCase()) + " " + to.process.id + "()"; | |
}; | |
if (!(this.from || this.to)) { | |
return "UNDEFINED"; | |
} | |
if (this.from && !this.to) { | |
return "" + (fromStr(this.from)) + " -> ANON"; | |
} | |
if (!this.from) { | |
return "DATA -> " + (toStr(this.to)); | |
} | |
return "" + (fromStr(this.from)) + " -> " + (toStr(this.to)); | |
}; | |
return InternalSocket; | |
})(EventEmitter); | |
exports.InternalSocket = InternalSocket; | |
exports.createSocket = function() { | |
return new InternalSocket; | |
}; | |
}); | |
require.register("noflo-noflo/src/lib/Port.js", function(exports, require, module){ | |
var EventEmitter, Port, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
EventEmitter = require('events').EventEmitter; | |
} else { | |
EventEmitter = require('emitter'); | |
} | |
Port = (function(_super) { | |
__extends(Port, _super); | |
function Port(type) { | |
this.type = type; | |
if (!this.type) { | |
this.type = 'all'; | |
} | |
this.socket = null; | |
this.from = null; | |
} | |
Port.prototype.attach = function(socket) { | |
if (this.isAttached()) { | |
throw new Error("" + this.name + ": Socket already attached " + (this.socket.getId()) + " - " + (socket.getId())); | |
} | |
this.socket = socket; | |
return this.attachSocket(socket); | |
}; | |
Port.prototype.attachSocket = function(socket, localId) { | |
var _this = this; | |
if (localId == null) { | |
localId = null; | |
} | |
this.emit("attach", socket); | |
this.from = socket.from; | |
if (socket.setMaxListeners) { | |
socket.setMaxListeners(0); | |
} | |
socket.on("connect", function() { | |
return _this.emit("connect", socket, localId); | |
}); | |
socket.on("begingroup", function(group) { | |
return _this.emit("begingroup", group, localId); | |
}); | |
socket.on("data", function(data) { | |
return _this.emit("data", data, localId); | |
}); | |
socket.on("endgroup", function(group) { | |
return _this.emit("endgroup", group, localId); | |
}); | |
return socket.on("disconnect", function() { | |
return _this.emit("disconnect", socket, localId); | |
}); | |
}; | |
Port.prototype.connect = function() { | |
if (!this.socket) { | |
throw new Error("No connection available"); | |
} | |
return this.socket.connect(); | |
}; | |
Port.prototype.beginGroup = function(group) { | |
var _this = this; | |
if (!this.socket) { | |
throw new Error("No connection available"); | |
} | |
if (this.isConnected()) { | |
return this.socket.beginGroup(group); | |
} | |
this.socket.once("connect", function() { | |
return _this.socket.beginGroup(group); | |
}); | |
return this.socket.connect(); | |
}; | |
Port.prototype.send = function(data) { | |
var _this = this; | |
if (!this.socket) { | |
throw new Error("No connection available"); | |
} | |
if (this.isConnected()) { | |
return this.socket.send(data); | |
} | |
this.socket.once("connect", function() { | |
return _this.socket.send(data); | |
}); | |
return this.socket.connect(); | |
}; | |
Port.prototype.endGroup = function() { | |
if (!this.socket) { | |
throw new Error("No connection available"); | |
} | |
return this.socket.endGroup(); | |
}; | |
Port.prototype.disconnect = function() { | |
if (!this.socket) { | |
throw new Error("No connection available"); | |
} | |
return this.socket.disconnect(); | |
}; | |
Port.prototype.detach = function(socket) { | |
if (!this.isAttached(socket)) { | |
return; | |
} | |
this.emit("detach", this.socket); | |
this.from = null; | |
return this.socket = null; | |
}; | |
Port.prototype.isConnected = function() { | |
if (!this.socket) { | |
return false; | |
} | |
return this.socket.isConnected(); | |
}; | |
Port.prototype.isAttached = function() { | |
return this.socket !== null; | |
}; | |
return Port; | |
})(EventEmitter); | |
exports.Port = Port; | |
}); | |
require.register("noflo-noflo/src/lib/ArrayPort.js", function(exports, require, module){ | |
var ArrayPort, port, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
port = require("./Port"); | |
ArrayPort = (function(_super) { | |
__extends(ArrayPort, _super); | |
function ArrayPort(type) { | |
this.type = type; | |
if (!this.type) { | |
this.type = 'all'; | |
} | |
this.sockets = []; | |
} | |
ArrayPort.prototype.attach = function(socket) { | |
this.sockets.push(socket); | |
return this.attachSocket(socket, this.sockets.length - 1); | |
}; | |
ArrayPort.prototype.connect = function(socketId) { | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
if (!this.sockets.length) { | |
throw new Error("No sockets available"); | |
} | |
this.sockets.forEach(function(socket) { | |
return socket.connect(); | |
}); | |
return; | |
} | |
if (!this.sockets[socketId]) { | |
throw new Error("No socket '" + socketId + "' available"); | |
} | |
return this.sockets[socketId].connect(); | |
}; | |
ArrayPort.prototype.beginGroup = function(group, socketId) { | |
var _this = this; | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
if (!this.sockets.length) { | |
throw new Error("No sockets available"); | |
} | |
this.sockets.forEach(function(socket, index) { | |
return _this.beginGroup(group, index); | |
}); | |
return; | |
} | |
if (!this.sockets[socketId]) { | |
throw new Error("No socket '" + socketId + "' available"); | |
} | |
if (this.isConnected(socketId)) { | |
return this.sockets[socketId].beginGroup(group); | |
} | |
this.sockets[socketId].once("connect", function() { | |
return _this.sockets[socketId].beginGroup(group); | |
}); | |
return this.sockets[socketId].connect(); | |
}; | |
ArrayPort.prototype.send = function(data, socketId) { | |
var _this = this; | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
if (!this.sockets.length) { | |
throw new Error("No sockets available"); | |
} | |
this.sockets.forEach(function(socket, index) { | |
return _this.send(data, index); | |
}); | |
return; | |
} | |
if (!this.sockets[socketId]) { | |
throw new Error("No socket '" + socketId + "' available"); | |
} | |
if (this.isConnected(socketId)) { | |
return this.sockets[socketId].send(data); | |
} | |
this.sockets[socketId].once("connect", function() { | |
return _this.sockets[socketId].send(data); | |
}); | |
return this.sockets[socketId].connect(); | |
}; | |
ArrayPort.prototype.endGroup = function(socketId) { | |
var _this = this; | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
if (!this.sockets.length) { | |
throw new Error("No sockets available"); | |
} | |
this.sockets.forEach(function(socket, index) { | |
return _this.endGroup(index); | |
}); | |
return; | |
} | |
if (!this.sockets[socketId]) { | |
throw new Error("No socket '" + socketId + "' available"); | |
} | |
return this.sockets[socketId].endGroup(); | |
}; | |
ArrayPort.prototype.disconnect = function(socketId) { | |
var socket, _i, _len, _ref; | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
if (!this.sockets.length) { | |
throw new Error("No sockets available"); | |
} | |
_ref = this.sockets; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
socket = _ref[_i]; | |
socket.disconnect(); | |
} | |
return; | |
} | |
if (!this.sockets[socketId]) { | |
return; | |
} | |
return this.sockets[socketId].disconnect(); | |
}; | |
ArrayPort.prototype.detach = function(socket) { | |
if (this.sockets.indexOf(socket) === -1) { | |
return; | |
} | |
this.sockets.splice(this.sockets.indexOf(socket), 1); | |
return this.emit("detach", socket); | |
}; | |
ArrayPort.prototype.isConnected = function(socketId) { | |
var connected, | |
_this = this; | |
if (socketId == null) { | |
socketId = null; | |
} | |
if (socketId === null) { | |
connected = false; | |
this.sockets.forEach(function(socket) { | |
if (socket.isConnected()) { | |
return connected = true; | |
} | |
}); | |
return connected; | |
} | |
if (!this.sockets[socketId]) { | |
return false; | |
} | |
return this.sockets[socketId].isConnected(); | |
}; | |
ArrayPort.prototype.isAttached = function(socketId) { | |
if (socketId === void 0) { | |
return false; | |
} | |
if (this.sockets[socketId]) { | |
return true; | |
} | |
return false; | |
}; | |
return ArrayPort; | |
})(port.Port); | |
exports.ArrayPort = ArrayPort; | |
}); | |
require.register("noflo-noflo/src/lib/Component.js", function(exports, require, module){ | |
var Component, EventEmitter, _ref, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
EventEmitter = require('events').EventEmitter; | |
} else { | |
EventEmitter = require('emitter'); | |
} | |
Component = (function(_super) { | |
__extends(Component, _super); | |
function Component() { | |
_ref = Component.__super__.constructor.apply(this, arguments); | |
return _ref; | |
} | |
Component.prototype.description = ""; | |
Component.prototype.getDescription = function() { | |
return this.description; | |
}; | |
Component.prototype.isReady = function() { | |
return true; | |
}; | |
Component.prototype.isSubgraph = function() { | |
return false; | |
}; | |
return Component; | |
})(EventEmitter); | |
exports.Component = Component; | |
}); | |
require.register("noflo-noflo/src/lib/AsyncComponent.js", function(exports, require, module){ | |
var AsyncComponent, component, port, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
port = require("./Port"); | |
component = require("./Component"); | |
AsyncComponent = (function(_super) { | |
__extends(AsyncComponent, _super); | |
function AsyncComponent(inPortName, outPortName, errPortName) { | |
var _this = this; | |
this.inPortName = inPortName != null ? inPortName : "in"; | |
this.outPortName = outPortName != null ? outPortName : "out"; | |
this.errPortName = errPortName != null ? errPortName : "error"; | |
if (!this.inPorts[this.inPortName]) { | |
throw new Error("no inPort named '" + this.inPortName + "'"); | |
} | |
if (!this.outPorts[this.outPortName]) { | |
throw new Error("no outPort named '" + this.outPortName + "'"); | |
} | |
this.load = 0; | |
this.q = []; | |
this.outPorts.load = new port.Port(); | |
this.inPorts[this.inPortName].on("begingroup", function(group) { | |
if (_this.load > 0) { | |
return _this.q.push({ | |
name: "begingroup", | |
data: group | |
}); | |
} | |
return _this.outPorts[_this.outPortName].beginGroup(group); | |
}); | |
this.inPorts[this.inPortName].on("endgroup", function() { | |
if (_this.load > 0) { | |
return _this.q.push({ | |
name: "endgroup" | |
}); | |
} | |
return _this.outPorts[_this.outPortName].endGroup(); | |
}); | |
this.inPorts[this.inPortName].on("disconnect", function() { | |
if (_this.load > 0) { | |
return _this.q.push({ | |
name: "disconnect" | |
}); | |
} | |
_this.outPorts[_this.outPortName].disconnect(); | |
if (_this.outPorts.load.isAttached()) { | |
return _this.outPorts.load.disconnect(); | |
} | |
}); | |
this.inPorts[this.inPortName].on("data", function(data) { | |
if (_this.q.length > 0) { | |
return _this.q.push({ | |
name: "data", | |
data: data | |
}); | |
} | |
return _this.processData(data); | |
}); | |
} | |
AsyncComponent.prototype.processData = function(data) { | |
var _this = this; | |
this.incrementLoad(); | |
return this.doAsync(data, function(err) { | |
if (err) { | |
if (_this.outPorts[_this.errPortName] && _this.outPorts[_this.errPortName].isAttached()) { | |
_this.outPorts[_this.errPortName].send(err); | |
_this.outPorts[_this.errPortName].disconnect(); | |
} else { | |
throw err; | |
} | |
} | |
return _this.decrementLoad(); | |
}); | |
}; | |
AsyncComponent.prototype.incrementLoad = function() { | |
this.load++; | |
if (this.outPorts.load.isAttached()) { | |
this.outPorts.load.send(this.load); | |
} | |
if (this.outPorts.load.isAttached()) { | |
return this.outPorts.load.disconnect(); | |
} | |
}; | |
AsyncComponent.prototype.doAsync = function(data, callback) { | |
return callback(new Error("AsyncComponents must implement doAsync")); | |
}; | |
AsyncComponent.prototype.decrementLoad = function() { | |
var _this = this; | |
if (this.load === 0) { | |
throw new Error("load cannot be negative"); | |
} | |
this.load--; | |
if (this.outPorts.load.isAttached()) { | |
this.outPorts.load.send(this.load); | |
} | |
if (this.outPorts.load.isAttached()) { | |
this.outPorts.load.disconnect(); | |
} | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
return process.nextTick(function() { | |
return _this.processQueue(); | |
}); | |
} else { | |
return setTimeout(function() { | |
return _this.processQueue(); | |
}, 0); | |
} | |
}; | |
AsyncComponent.prototype.processQueue = function() { | |
var event, processedData; | |
if (this.load > 0) { | |
return; | |
} | |
processedData = false; | |
while (this.q.length > 0) { | |
event = this.q[0]; | |
switch (event.name) { | |
case "begingroup": | |
if (processedData) { | |
return; | |
} | |
this.outPorts[this.outPortName].beginGroup(event.data); | |
this.q.shift(); | |
break; | |
case "endgroup": | |
if (processedData) { | |
return; | |
} | |
this.outPorts[this.outPortName].endGroup(); | |
this.q.shift(); | |
break; | |
case "disconnect": | |
if (processedData) { | |
return; | |
} | |
this.outPorts[this.outPortName].disconnect(); | |
if (this.outPorts.load.isAttached()) { | |
this.outPorts.load.disconnect(); | |
} | |
this.q.shift(); | |
break; | |
case "data": | |
this.processData(event.data); | |
this.q.shift(); | |
processedData = true; | |
} | |
} | |
}; | |
return AsyncComponent; | |
})(component.Component); | |
exports.AsyncComponent = AsyncComponent; | |
}); | |
require.register("noflo-noflo/src/lib/LoggingComponent.js", function(exports, require, module){ | |
var Component, Port, util, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
Component = require("./Component").Component; | |
Port = require("./Port").Port; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
util = require("util"); | |
} else { | |
util = { | |
inspect: function(data) { | |
return data; | |
} | |
}; | |
} | |
exports.LoggingComponent = (function(_super) { | |
__extends(LoggingComponent, _super); | |
function LoggingComponent() { | |
this.sendLog = __bind(this.sendLog, this); | |
this.outPorts = { | |
log: new Port() | |
}; | |
} | |
LoggingComponent.prototype.sendLog = function(message) { | |
if (typeof message === "object") { | |
message.when = new Date; | |
message.source = this.constructor.name; | |
if (this.nodeId != null) { | |
message.nodeID = this.nodeId; | |
} | |
} | |
if ((this.outPorts.log != null) && this.outPorts.log.isAttached()) { | |
return this.outPorts.log.send(message); | |
} else { | |
return console.log(util.inspect(message, 4, true, true)); | |
} | |
}; | |
return LoggingComponent; | |
})(Component); | |
}); | |
require.register("noflo-noflo/src/lib/ComponentLoader.js", function(exports, require, module){ | |
var ComponentLoader, internalSocket; | |
internalSocket = require('./InternalSocket'); | |
ComponentLoader = (function() { | |
function ComponentLoader(baseDir) { | |
this.baseDir = baseDir; | |
this.components = null; | |
this.checked = []; | |
this.revalidate = false; | |
} | |
ComponentLoader.prototype.getModulePrefix = function(name) { | |
if (!name) { | |
return ''; | |
} | |
if (name === 'noflo') { | |
return ''; | |
} | |
return name.replace('noflo-', ''); | |
}; | |
ComponentLoader.prototype.getModuleComponents = function(moduleName) { | |
var cPath, definition, dependency, e, name, prefix, _ref, _ref1, _results; | |
if (this.checked.indexOf(moduleName) !== -1) { | |
return; | |
} | |
this.checked.push(moduleName); | |
try { | |
definition = require("/" + moduleName + "/component.json"); | |
} catch (_error) { | |
e = _error; | |
return; | |
} | |
for (dependency in definition.dependencies) { | |
this.getModuleComponents(dependency.replace('/', '-')); | |
} | |
if (!definition.noflo) { | |
return; | |
} | |
prefix = this.getModulePrefix(definition.name); | |
if (moduleName[0] === '/') { | |
moduleName = moduleName.substr(1); | |
} | |
if (definition.noflo.components) { | |
_ref = definition.noflo.components; | |
for (name in _ref) { | |
cPath = _ref[name]; | |
this.registerComponent(prefix, name, "/" + moduleName + "/" + cPath); | |
} | |
} | |
if (definition.noflo.graphs) { | |
_ref1 = definition.noflo.graphs; | |
_results = []; | |
for (name in _ref1) { | |
cPath = _ref1[name]; | |
_results.push(this.registerComponent(prefix, name, "/" + moduleName + "/" + cPath)); | |
} | |
return _results; | |
} | |
}; | |
ComponentLoader.prototype.listComponents = function(callback) { | |
if (this.components !== null) { | |
return callback(this.components); | |
} | |
this.components = {}; | |
this.getModuleComponents(this.baseDir); | |
return callback(this.components); | |
}; | |
ComponentLoader.prototype.load = function(name, callback) { | |
var component, componentName, implementation, instance, | |
_this = this; | |
if (!this.components) { | |
this.listComponents(function(components) { | |
return _this.load(name, callback); | |
}); | |
return; | |
} | |
component = this.components[name]; | |
if (!component) { | |
for (componentName in this.components) { | |
if (componentName.split('/')[1] === name) { | |
component = this.components[componentName]; | |
break; | |
} | |
} | |
if (!component) { | |
throw new Error("Component " + name + " not available with base " + this.baseDir); | |
return; | |
} | |
} | |
if (this.isGraph(component)) { | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
process.nextTick(function() { | |
return _this.loadGraph(name, callback); | |
}); | |
} else { | |
setTimeout(function() { | |
return _this.loadGraph(name, callback); | |
}, 0); | |
} | |
return; | |
} | |
if (typeof component === 'function') { | |
implementation = component; | |
instance = new component; | |
} else { | |
implementation = require(component); | |
instance = implementation.getComponent(); | |
} | |
if (name === 'Graph') { | |
instance.baseDir = this.baseDir; | |
} | |
return callback(instance); | |
}; | |
ComponentLoader.prototype.isGraph = function(cPath) { | |
if (typeof cPath !== 'string') { | |
return false; | |
} | |
return cPath.indexOf('.fbp') !== -1 || cPath.indexOf('.json') !== -1; | |
}; | |
ComponentLoader.prototype.loadGraph = function(name, callback) { | |
var graph, graphImplementation, graphSocket; | |
graphImplementation = require(this.components['Graph']); | |
graphSocket = internalSocket.createSocket(); | |
graph = graphImplementation.getComponent(); | |
graph.baseDir = this.baseDir; | |
graph.inPorts.graph.attach(graphSocket); | |
graphSocket.send(this.components[name]); | |
graphSocket.disconnect(); | |
delete graph.inPorts.graph; | |
delete graph.inPorts.start; | |
return callback(graph); | |
}; | |
ComponentLoader.prototype.registerComponent = function(packageId, name, cPath, callback) { | |
var fullName, prefix; | |
prefix = this.getModulePrefix(packageId); | |
fullName = "" + prefix + "/" + name; | |
if (!packageId) { | |
fullName = name; | |
} | |
this.components[fullName] = cPath; | |
if (callback) { | |
return callback(); | |
} | |
}; | |
ComponentLoader.prototype.registerGraph = function(packageId, name, gPath, callback) { | |
return this.registerComponent(packageId, name, gPath, callback); | |
}; | |
ComponentLoader.prototype.clear = function() { | |
this.components = null; | |
this.checked = []; | |
return this.revalidate = true; | |
}; | |
return ComponentLoader; | |
})(); | |
exports.ComponentLoader = ComponentLoader; | |
}); | |
require.register("noflo-noflo/src/lib/NoFlo.js", function(exports, require, module){ | |
exports.graph = require('./Graph'); | |
exports.Graph = exports.graph.Graph; | |
exports.Network = require('./Network').Network; | |
exports.isBrowser = function() { | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
return false; | |
} | |
return true; | |
}; | |
if (!exports.isBrowser()) { | |
exports.ComponentLoader = require('./nodejs/ComponentLoader').ComponentLoader; | |
} else { | |
exports.ComponentLoader = require('./ComponentLoader').ComponentLoader; | |
} | |
exports.Component = require('./Component').Component; | |
exports.AsyncComponent = require('./AsyncComponent').AsyncComponent; | |
exports.LoggingComponent = require('./LoggingComponent').LoggingComponent; | |
exports.Port = require('./Port').Port; | |
exports.ArrayPort = require('./ArrayPort').ArrayPort; | |
exports.internalSocket = require('./InternalSocket'); | |
exports.createNetwork = function(graph, callback, delay) { | |
var network, networkReady; | |
network = new exports.Network(graph); | |
networkReady = function(network) { | |
if (callback != null) { | |
callback(network); | |
} | |
return network.sendInitials(); | |
}; | |
if (graph.nodes.length === 0) { | |
setTimeout(function() { | |
return networkReady(network); | |
}, 0); | |
return network; | |
} | |
network.loader.listComponents(function() { | |
if (delay) { | |
if (callback != null) { | |
callback(network); | |
} | |
return; | |
} | |
return network.connect(function() { | |
return networkReady(network); | |
}); | |
}); | |
return network; | |
}; | |
exports.loadFile = function(file, callback) { | |
return exports.graph.loadFile(file, function(net) { | |
return exports.createNetwork(net, callback); | |
}); | |
}; | |
exports.saveFile = function(graph, file, callback) { | |
return exports.graph.save(file, function() { | |
return callback(file); | |
}); | |
}; | |
}); | |
require.register("noflo-noflo/src/lib/Network.js", function(exports, require, module){ | |
var EventEmitter, Network, componentLoader, graph, internalSocket, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
_ = require("underscore"); | |
internalSocket = require("./InternalSocket"); | |
graph = require("./Graph"); | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
componentLoader = require("./nodejs/ComponentLoader"); | |
EventEmitter = require('events').EventEmitter; | |
} else { | |
componentLoader = require('./ComponentLoader'); | |
EventEmitter = require('emitter'); | |
} | |
Network = (function(_super) { | |
__extends(Network, _super); | |
Network.prototype.processes = {}; | |
Network.prototype.connections = []; | |
Network.prototype.initials = []; | |
Network.prototype.graph = null; | |
Network.prototype.startupDate = null; | |
Network.prototype.portBuffer = {}; | |
function Network(graph) { | |
var _this = this; | |
this.processes = {}; | |
this.connections = []; | |
this.initials = []; | |
this.graph = graph; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
this.baseDir = graph.baseDir || process.cwd(); | |
} else { | |
this.baseDir = graph.baseDir || '/'; | |
} | |
this.startupDate = new Date(); | |
this.handleStartEnd(); | |
this.graph.on('addNode', function(node) { | |
return _this.addNode(node); | |
}); | |
this.graph.on('removeNode', function(node) { | |
return _this.removeNode(node); | |
}); | |
this.graph.on('renameNode', function(oldId, newId) { | |
return _this.renameNode(oldId, newId); | |
}); | |
this.graph.on('addEdge', function(edge) { | |
return _this.addEdge(edge); | |
}); | |
this.graph.on('removeEdge', function(edge) { | |
return _this.removeEdge(edge); | |
}); | |
this.graph.on('addInitial', function(iip) { | |
return _this.addInitial(iip); | |
}); | |
this.graph.on('removeInitial', function(iip) { | |
return _this.removeInitial(iip); | |
}); | |
this.loader = new componentLoader.ComponentLoader(this.baseDir); | |
} | |
Network.prototype.uptime = function() { | |
return new Date() - this.startupDate; | |
}; | |
Network.prototype.handleStartEnd = function() { | |
var connections, ended, started, timeOut, | |
_this = this; | |
connections = 0; | |
started = false; | |
ended = false; | |
timeOut = null; | |
this.on('connect', function(data) { | |
if (!data.socket.from) { | |
return; | |
} | |
if (timeOut) { | |
clearTimeout(timeOut); | |
} | |
if (connections === 0 && !started) { | |
_this.emit('start', { | |
start: _this.startupDate | |
}); | |
started = true; | |
} | |
return connections++; | |
}); | |
return this.on('disconnect', function(data) { | |
if (!data.socket.from) { | |
return; | |
} | |
connections--; | |
if (!(connections <= 0)) { | |
return; | |
} | |
return timeOut = setTimeout(function() { | |
if (ended) { | |
return; | |
} | |
_this.emit('end', { | |
start: _this.startupDate, | |
end: new Date, | |
uptime: _this.uptime() | |
}); | |
started = false; | |
return ended = true; | |
}, 10); | |
}); | |
}; | |
Network.prototype.load = function(component, callback) { | |
if (typeof component === 'object') { | |
return callback(component); | |
} | |
return this.loader.load(component, callback); | |
}; | |
Network.prototype.addNode = function(node, callback) { | |
var process, | |
_this = this; | |
if (this.processes[node.id]) { | |
return; | |
} | |
process = { | |
id: node.id | |
}; | |
if (!node.component) { | |
this.processes[process.id] = process; | |
if (callback) { | |
callback(process); | |
} | |
return; | |
} | |
return this.load(node.component, function(instance) { | |
instance.nodeId = node.id; | |
process.component = instance; | |
if (instance.isSubgraph()) { | |
_this.subscribeSubgraph(node.id, instance); | |
} | |
_this.processes[process.id] = process; | |
if (callback) { | |
return callback(process); | |
} | |
}); | |
}; | |
Network.prototype.removeNode = function(node) { | |
if (!this.processes[node.id]) { | |
return; | |
} | |
return delete this.processes[node.id]; | |
}; | |
Network.prototype.renameNode = function(oldId, newId) { | |
var process; | |
process = this.getNode(oldId); | |
if (!process) { | |
return; | |
} | |
process.id = newId; | |
this.processes[newId] = process; | |
return delete this.processes[oldId]; | |
}; | |
Network.prototype.getNode = function(id) { | |
return this.processes[id]; | |
}; | |
Network.prototype.connect = function(done) { | |
var edges, initializers, nodes, serialize, | |
_this = this; | |
if (done == null) { | |
done = function() {}; | |
} | |
serialize = function(next, add) { | |
return function(type) { | |
return _this["add" + type](add, function() { | |
return next(type); | |
}); | |
}; | |
}; | |
initializers = _.reduceRight(this.graph.initializers, serialize, done); | |
edges = _.reduceRight(this.graph.edges, serialize, function() { | |
return initializers("Initial"); | |
}); | |
nodes = _.reduceRight(this.graph.nodes, serialize, function() { | |
return edges("Edge"); | |
}); | |
return nodes("Node"); | |
}; | |
Network.prototype.connectPort = function(socket, process, port, inbound) { | |
if (inbound) { | |
socket.to = { | |
process: process, | |
port: port | |
}; | |
if (!(process.component.inPorts && process.component.inPorts[port])) { | |
throw new Error("No inport '" + port + "' defined in process " + process.id + " (" + (socket.getId()) + ")"); | |
return; | |
} | |
return process.component.inPorts[port].attach(socket); | |
} | |
socket.from = { | |
process: process, | |
port: port | |
}; | |
if (!(process.component.outPorts && process.component.outPorts[port])) { | |
throw new Error("No outport '" + port + "' defined in process " + process.id + " (" + (socket.getId()) + ")"); | |
return; | |
} | |
return process.component.outPorts[port].attach(socket); | |
}; | |
Network.prototype.subscribeSubgraph = function(nodeName, process) { | |
var emitSub, | |
_this = this; | |
if (!process.isReady()) { | |
process.once('ready', function() { | |
_this.subscribeSubgraph(nodeName, process); | |
}); | |
} | |
if (!process.network) { | |
return; | |
} | |
emitSub = function(type, data) { | |
if (!data) { | |
data = {}; | |
} | |
if (data.subgraph) { | |
data.subgraph = "" + nodeName + ":" + data.subgraph; | |
} else { | |
data.subgraph = nodeName; | |
} | |
return _this.emit(type, data); | |
}; | |
process.network.on('connect', function(data) { | |
return emitSub('connect', data); | |
}); | |
process.network.on('begingroup', function(data) { | |
return emitSub('begingroup', data); | |
}); | |
process.network.on('data', function(data) { | |
return emitSub('data', data); | |
}); | |
process.network.on('endgroup', function(data) { | |
return emitSub('endgroup', data); | |
}); | |
return process.network.on('disconnect', function(data) { | |
return emitSub('disconnect', data); | |
}); | |
}; | |
Network.prototype.subscribeSocket = function(socket) { | |
var _this = this; | |
socket.on('connect', function() { | |
return _this.emit('connect', { | |
id: socket.getId(), | |
socket: socket | |
}); | |
}); | |
socket.on('begingroup', function(group) { | |
return _this.emit('begingroup', { | |
id: socket.getId(), | |
socket: socket, | |
group: group | |
}); | |
}); | |
socket.on('data', function(data) { | |
return _this.emit('data', { | |
id: socket.getId(), | |
socket: socket, | |
data: data | |
}); | |
}); | |
socket.on('endgroup', function(group) { | |
return _this.emit('endgroup', { | |
id: socket.getId(), | |
socket: socket, | |
group: group | |
}); | |
}); | |
return socket.on('disconnect', function() { | |
return _this.emit('disconnect', { | |
id: socket.getId(), | |
socket: socket | |
}); | |
}); | |
}; | |
Network.prototype.addEdge = function(edge, callback) { | |
var from, socket, to, | |
_this = this; | |
socket = internalSocket.createSocket(); | |
from = this.getNode(edge.from.node); | |
if (!from) { | |
throw new Error("No process defined for outbound node " + edge.from.node); | |
} | |
if (!from.component) { | |
throw new Error("No component defined for outbound node " + edge.from.node); | |
} | |
if (!from.component.isReady()) { | |
from.component.once("ready", function() { | |
return _this.addEdge(edge, callback); | |
}); | |
return; | |
} | |
to = this.getNode(edge.to.node); | |
if (!to) { | |
throw new Error("No process defined for inbound node " + edge.to.node); | |
} | |
if (!to.component) { | |
throw new Error("No component defined for inbound node " + edge.to.node); | |
} | |
if (!to.component.isReady()) { | |
to.component.once("ready", function() { | |
return _this.addEdge(edge, callback); | |
}); | |
return; | |
} | |
this.connectPort(socket, to, edge.to.port, true); | |
this.connectPort(socket, from, edge.from.port, false); | |
this.subscribeSocket(socket); | |
this.connections.push(socket); | |
if (callback) { | |
return callback(); | |
} | |
}; | |
Network.prototype.removeEdge = function(edge) { | |
var connection, _i, _len, _ref, _results; | |
_ref = this.connections; | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
connection = _ref[_i]; | |
if (!connection) { | |
continue; | |
} | |
if (!(edge.to.node === connection.to.process.id && edge.to.port === connection.to.port)) { | |
continue; | |
} | |
connection.to.process.component.inPorts[connection.to.port].detach(connection); | |
if (edge.from.node) { | |
if (connection.from && edge.from.node === connection.from.process.id && edge.from.port === connection.from.port) { | |
connection.from.process.component.outPorts[connection.from.port].detach(connection); | |
} | |
} | |
_results.push(this.connections.splice(this.connections.indexOf(connection), 1)); | |
} | |
return _results; | |
}; | |
Network.prototype.addInitial = function(initializer, callback) { | |
var socket, to, | |
_this = this; | |
socket = internalSocket.createSocket(); | |
this.subscribeSocket(socket); | |
to = this.getNode(initializer.to.node); | |
if (!to) { | |
throw new Error("No process defined for inbound node " + initializer.to.node); | |
} | |
if (!(to.component.isReady() || to.component.inPorts[initializer.to.port])) { | |
to.component.setMaxListeners(0); | |
to.component.once("ready", function() { | |
return _this.addInitial(initializer, callback); | |
}); | |
return; | |
} | |
this.connectPort(socket, to, initializer.to.port, true); | |
this.connections.push(socket); | |
this.initials.push({ | |
socket: socket, | |
data: initializer.from.data | |
}); | |
if (callback) { | |
return callback(); | |
} | |
}; | |
Network.prototype.removeInitial = function(initializer) { | |
var connection, _i, _len, _ref, _results; | |
_ref = this.connections; | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
connection = _ref[_i]; | |
if (!connection) { | |
continue; | |
} | |
if (!(initializer.to.node === connection.to.process.id && initializer.to.port === connection.to.port)) { | |
continue; | |
} | |
connection.to.process.component.inPorts[connection.to.port].detach(connection); | |
_results.push(this.connections.splice(this.connections.indexOf(connection), 1)); | |
} | |
return _results; | |
}; | |
Network.prototype.sendInitial = function(initial) { | |
initial.socket.connect(); | |
initial.socket.send(initial.data); | |
return initial.socket.disconnect(); | |
}; | |
Network.prototype.sendInitials = function() { | |
var send, | |
_this = this; | |
send = function() { | |
var initial, _i, _len, _ref; | |
_ref = _this.initials; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
initial = _ref[_i]; | |
_this.sendInitial(initial); | |
} | |
return _this.initials = []; | |
}; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
return process.nextTick(send); | |
} else { | |
return setTimeout(send, 0); | |
} | |
}; | |
return Network; | |
})(EventEmitter); | |
exports.Network = Network; | |
}); | |
require.register("noflo-noflo/src/components/Graph.js", function(exports, require, module){ | |
var Graph, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
noflo = require("../../lib/NoFlo"); | |
} else { | |
noflo = require('../lib/NoFlo'); | |
} | |
Graph = (function(_super) { | |
__extends(Graph, _super); | |
function Graph() { | |
var _this = this; | |
this.network = null; | |
this.ready = true; | |
this.started = false; | |
this.baseDir = null; | |
this.inPorts = { | |
graph: new noflo.Port('all'), | |
start: new noflo.Port('bang') | |
}; | |
this.outPorts = {}; | |
this.inPorts.graph.on("data", function(data) { | |
return _this.setGraph(data); | |
}); | |
this.inPorts.start.on("data", function() { | |
_this.started = true; | |
if (!_this.network) { | |
return; | |
} | |
return _this.network.connect(function() { | |
var name, notReady, process, _ref; | |
_this.network.sendInitials(); | |
notReady = false; | |
_ref = _this.network.processes; | |
for (name in _ref) { | |
process = _ref[name]; | |
if (!_this.checkComponent(name, process)) { | |
notReady = true; | |
} | |
} | |
if (!notReady) { | |
return _this.setToReady(); | |
} | |
}); | |
}); | |
} | |
Graph.prototype.setGraph = function(graph) { | |
var _this = this; | |
this.ready = false; | |
if (typeof graph === 'object') { | |
if (typeof graph.addNode === 'function') { | |
return this.createNetwork(graph); | |
} | |
noflo.graph.loadJSON(graph, function(instance) { | |
instance.baseDir = _this.baseDir; | |
return _this.createNetwork(instance); | |
}); | |
return; | |
} | |
if (graph.substr(0, 1) !== "/") { | |
graph = "" + (process.cwd()) + "/" + graph; | |
} | |
return graph = noflo.graph.loadFile(graph, function(instance) { | |
instance.baseDir = _this.baseDir; | |
return _this.createNetwork(instance); | |
}); | |
}; | |
Graph.prototype.createNetwork = function(graph) { | |
var _ref, | |
_this = this; | |
if (((_ref = this.inPorts.start) != null ? _ref.isAttached() : void 0) && !this.started) { | |
noflo.createNetwork(graph, function(network) { | |
_this.network = network; | |
return _this.emit('network', _this.network); | |
}, true); | |
return; | |
} | |
return noflo.createNetwork(graph, function(network) { | |
var name, notReady, process, _ref1; | |
_this.network = network; | |
_this.emit('network', _this.network); | |
notReady = false; | |
_ref1 = _this.network.processes; | |
for (name in _ref1) { | |
process = _ref1[name]; | |
if (!_this.checkComponent(name, process)) { | |
notReady = true; | |
} | |
} | |
if (!notReady) { | |
return _this.setToReady(); | |
} | |
}); | |
}; | |
Graph.prototype.checkComponent = function(name, process) { | |
var _this = this; | |
if (!process.component.isReady()) { | |
process.component.once("ready", function() { | |
_this.checkComponent(name, process); | |
return _this.setToReady(); | |
}); | |
return false; | |
} | |
this.findEdgePorts(name, process); | |
return true; | |
}; | |
Graph.prototype.portName = function(nodeName, portName) { | |
return "" + (nodeName.toLowerCase()) + "." + portName; | |
}; | |
Graph.prototype.isExported = function(port, nodeName, portName) { | |
var exported, newPort, _i, _len, _ref; | |
newPort = this.portName(nodeName, portName); | |
if (port.isAttached()) { | |
return false; | |
} | |
if (this.network.graph.exports.length === 0) { | |
return newPort; | |
} | |
_ref = this.network.graph.exports; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
exported = _ref[_i]; | |
if (exported["private"] === newPort) { | |
return exported["public"]; | |
} | |
} | |
return false; | |
}; | |
Graph.prototype.setToReady = function() { | |
var _this = this; | |
if (typeof process !== 'undefined' && process.execPath && process.execPath.indexOf('node') !== -1) { | |
return process.nextTick(function() { | |
_this.ready = true; | |
return _this.emit('ready'); | |
}); | |
} else { | |
return setTimeout(function() { | |
_this.ready = true; | |
return _this.emit('ready'); | |
}, 0); | |
} | |
}; | |
Graph.prototype.findEdgePorts = function(name, process) { | |
var port, portName, targetPortName, _ref, _ref1; | |
_ref = process.component.inPorts; | |
for (portName in _ref) { | |
port = _ref[portName]; | |
targetPortName = this.isExported(port, name, portName); | |
if (targetPortName === false) { | |
continue; | |
} | |
this.inPorts[targetPortName] = port; | |
} | |
_ref1 = process.component.outPorts; | |
for (portName in _ref1) { | |
port = _ref1[portName]; | |
targetPortName = this.isExported(port, name, portName); | |
if (targetPortName === false) { | |
continue; | |
} | |
this.outPorts[targetPortName] = port; | |
} | |
return true; | |
}; | |
Graph.prototype.isReady = function() { | |
return this.ready; | |
}; | |
Graph.prototype.isSubgraph = function() { | |
return true; | |
}; | |
return Graph; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Graph; | |
}; | |
}); | |
require.register("noflo-noflo/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo","description":"Flow-Based Programming environment for JavaScript","keywords":["fbp","workflow","flow"],"repo":"noflo/noflo","version":"0.4.0","dependencies":{"component/emitter":"*","component/underscore":"*","noflo/fbp":"*"},"development":{},"license":"MIT","main":"src/lib/NoFlo.js","scripts":["src/lib/Graph.js","src/lib/InternalSocket.js","src/lib/Port.js","src/lib/ArrayPort.js","src/lib/Component.js","src/lib/AsyncComponent.js","src/lib/LoggingComponent.js","src/lib/ComponentLoader.js","src/lib/NoFlo.js","src/lib/Network.js","src/components/Graph.js"],"json":["component.json"],"noflo":{"components":{"Graph":"src/components/Graph.js"}}}'); | |
}); | |
require.register("noflo-noflo-core/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features of core. | |
* | |
* The library features can be made available as CommonJS modules that the | |
* components in this project utilize. | |
*/ | |
}); | |
require.register("noflo-noflo-core/components/Callback.js", function(exports, require, module){ | |
var Callback, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
_ = require('underscore')._; | |
Callback = (function(_super) { | |
__extends(Callback, _super); | |
Callback.prototype.description = 'This component calls a given callback function for each\ | |
IP it receives. The Callback component is typically used to connect\ | |
NoFlo with external Node.js code.'; | |
function Callback() { | |
var _this = this; | |
this.callback = null; | |
this.inPorts = { | |
"in": new noflo.Port('all'), | |
callback: new noflo.Port('function') | |
}; | |
this.outPorts = { | |
error: new noflo.Port('object') | |
}; | |
this.inPorts.callback.on('data', function(data) { | |
if (!_.isFunction(data)) { | |
_this.error('The provided callback must be a function'); | |
return; | |
} | |
return _this.callback = data; | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
if (!_this.callback) { | |
_this.error('No callback provided'); | |
return; | |
} | |
return _this.callback(data); | |
}); | |
} | |
Callback.prototype.error = function(msg) { | |
if (this.outPorts.error.isAttached()) { | |
this.outPorts.error.send(new Error(msg)); | |
this.outPorts.error.disconnect(); | |
return; | |
} | |
throw new Error(msg); | |
}; | |
return Callback; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Callback; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Drop.js", function(exports, require, module){ | |
var Drop, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Drop = (function(_super) { | |
__extends(Drop, _super); | |
Drop.prototype.description = 'This component drops every packet it receives with no\ | |
action'; | |
function Drop() { | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = {}; | |
} | |
return Drop; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Drop; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Group.js", function(exports, require, module){ | |
var Group, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Group = (function(_super) { | |
__extends(Group, _super); | |
function Group() { | |
var _this = this; | |
this.groups = []; | |
this.newGroups = []; | |
this.threshold = null; | |
this.inPorts = { | |
"in": new noflo.ArrayPort, | |
group: new noflo.ArrayPort, | |
threshold: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on('connect', function() { | |
var group, _i, _len, _ref, _results; | |
_ref = _this.newGroups; | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
group = _ref[_i]; | |
_results.push(_this.outPorts.out.beginGroup(group)); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
var group, _i, _len, _ref; | |
_ref = _this.newGroups; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
group = _ref[_i]; | |
_this.outPorts.out.endGroup(); | |
} | |
_this.outPorts.out.disconnect(); | |
return _this.groups = []; | |
}); | |
this.inPorts.group.on('data', function(data) { | |
var diff; | |
if (_this.threshold) { | |
diff = _this.newGroups.length - _this.threshold + 1; | |
if (diff > 0) { | |
_this.newGroups = _this.newGroups.slice(diff); | |
} | |
} | |
return _this.newGroups.push(data); | |
}); | |
this.inPorts.threshold.on('data', function(threshold) { | |
_this.threshold = threshold; | |
}); | |
} | |
return Group; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Group; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Kick.js", function(exports, require, module){ | |
var Kick, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Kick = (function(_super) { | |
__extends(Kick, _super); | |
Kick.prototype.description = 'This component generates a single packet and sends it to\ | |
the output port. Mostly usable for debugging, but can also be useful\ | |
for starting up networks.'; | |
function Kick() { | |
var _this = this; | |
this.data = { | |
packet: null, | |
group: [] | |
}; | |
this.groups = []; | |
this.inPorts = { | |
"in": new noflo.Port(), | |
data: new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.ArrayPort() | |
}; | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.groups.push(group); | |
}); | |
this.inPorts["in"].on('data', function() { | |
return _this.data.group = _this.groups.slice(0); | |
}); | |
this.inPorts["in"].on('endgroup', function(group) { | |
return _this.groups.pop(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
_this.sendKick(_this.data); | |
return _this.groups = []; | |
}); | |
this.inPorts.data.on('data', function(data) { | |
return _this.data.packet = data; | |
}); | |
} | |
Kick.prototype.sendKick = function(kick) { | |
var group, _i, _j, _len, _len1, _ref, _ref1; | |
_ref = kick.group; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
group = _ref[_i]; | |
this.outPorts.out.beginGroup(group); | |
} | |
this.outPorts.out.send(kick.packet); | |
_ref1 = kick.group; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
group = _ref1[_j]; | |
this.outPorts.out.endGroup(); | |
} | |
return this.outPorts.out.disconnect(); | |
}; | |
return Kick; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Kick; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Merge.js", function(exports, require, module){ | |
var Merge, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Merge = (function(_super) { | |
__extends(Merge, _super); | |
Merge.prototype.description = 'This component receives data on multiple input ports and\ | |
sends the same data out to the connected output port'; | |
function Merge() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.ArrayPort() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts["in"].on('connect', function() { | |
return _this.outPorts.out.connect(); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
var socket, _i, _len, _ref; | |
_ref = _this.inPorts["in"].sockets; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
socket = _ref[_i]; | |
if (socket.connected) { | |
return; | |
} | |
} | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Merge; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Merge; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Output.js", function(exports, require, module){ | |
var Output, noflo, util, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
if (!noflo.isBrowser()) { | |
util = require('util'); | |
} else { | |
util = { | |
inspect: function(data) { | |
return data; | |
} | |
}; | |
} | |
Output = (function(_super) { | |
__extends(Output, _super); | |
Output.prototype.description = 'This component receives input on a single inport, and\ | |
sends the data items directly to console.log'; | |
function Output() { | |
var _this = this; | |
this.options = { | |
showHidden: false, | |
depth: 2, | |
colors: false | |
}; | |
this.inPorts = { | |
"in": new noflo.ArrayPort, | |
options: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on('data', function(data) { | |
_this.log(data); | |
if (_this.outPorts.out.isAttached()) { | |
return _this.outPorts.out.send(data); | |
} | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
if (_this.outPorts.out.isAttached()) { | |
return _this.outPorts.out.disconnect(); | |
} | |
}); | |
this.inPorts.options.on('data', function(data) { | |
return _this.setOptions(data); | |
}); | |
} | |
Output.prototype.setOptions = function(options) { | |
var key, value, _results; | |
if (typeof options !== 'object') { | |
throw new Error('Options is not an object'); | |
} | |
_results = []; | |
for (key in options) { | |
if (!__hasProp.call(options, key)) continue; | |
value = options[key]; | |
_results.push(this.options[key] = value); | |
} | |
return _results; | |
}; | |
Output.prototype.log = function(data) { | |
return console.log(util.inspect(data, this.options.showHidden, this.options.depth, this.options.colors)); | |
}; | |
return Output; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Output(); | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Repeat.js", function(exports, require, module){ | |
var Repeat, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Repeat = (function(_super) { | |
__extends(Repeat, _super); | |
function Repeat() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts["in"].on('connect', function() { | |
return _this.outPorts.out.connect(); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Repeat; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Repeat(); | |
}; | |
}); | |
require.register("noflo-noflo-core/components/RepeatAsync.js", function(exports, require, module){ | |
var RepeatAsync, noflo, util, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
if (!noflo.isBrowser()) { | |
util = require('util'); | |
} else { | |
util = { | |
inspect: function(data) { | |
return data; | |
} | |
}; | |
} | |
RepeatAsync = (function(_super) { | |
__extends(RepeatAsync, _super); | |
RepeatAsync.prototype.description = "Like 'Repeat', except repeat on next tick"; | |
function RepeatAsync() { | |
var _this = this; | |
this.groups = []; | |
this.inPorts = { | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.groups.push(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
var groups, later; | |
groups = _this.groups; | |
later = function() { | |
var group, _i, _j, _len, _len1; | |
for (_i = 0, _len = groups.length; _i < _len; _i++) { | |
group = groups[_i]; | |
_this.outPorts.out.beginGroup(group); | |
} | |
_this.outPorts.out.send(data); | |
for (_j = 0, _len1 = groups.length; _j < _len1; _j++) { | |
group = groups[_j]; | |
_this.outPorts.out.endGroup(); | |
} | |
return _this.outPorts.out.disconnect(); | |
}; | |
return setTimeout(later, 0); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.groups = []; | |
}); | |
} | |
return RepeatAsync; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new RepeatAsync; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/Split.js", function(exports, require, module){ | |
var Split, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Split = (function(_super) { | |
__extends(Split, _super); | |
Split.prototype.description = 'This component receives data on a single input port and\ | |
sends the same data out to all connected output ports'; | |
function Split() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port('all') | |
}; | |
this.outPorts = { | |
out: new noflo.ArrayPort('all') | |
}; | |
this.inPorts["in"].on('connect', function() { | |
return _this.outPorts.out.connect(); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Split; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Split; | |
}; | |
}); | |
require.register("noflo-noflo-core/components/RunInterval.js", function(exports, require, module){ | |
var RunInterval, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
RunInterval = (function(_super) { | |
__extends(RunInterval, _super); | |
RunInterval.prototype.description = 'Send a packet at the given interval'; | |
function RunInterval() { | |
var _this = this; | |
this.interval = null; | |
this.inPorts = { | |
interval: new noflo.Port('number'), | |
stop: new noflo.Port('bang') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('bang') | |
}; | |
this.inPorts.interval.on('data', function(interval) { | |
if (_this.interval) { | |
clearInterval(_this.interval); | |
} | |
_this.outPorts.out.connect(); | |
return _this.interval = setInterval(function() { | |
return _this.outPorts.out.send(true); | |
}, interval); | |
}); | |
this.inPorts.stop.on('data', function() { | |
if (!_this.interval) { | |
return; | |
} | |
clearInterval(_this.interval); | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return RunInterval; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new RunInterval; | |
}; | |
}); | |
require.register("noflo-noflo-core/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-core","description":"NoFlo Essentials","repo":"noflo/noflo-core","version":"0.1.0","author":{"name":"Henri Bergius","email":"[email protected]"},"contributors":[{"name":"Kenneth Kan","email":"[email protected]"},{"name":"Ryan Shaw","email":"[email protected]"}],"keywords":[],"dependencies":{"noflo/noflo":"*","component/underscore":"*"},"scripts":["components/Callback.js","components/Drop.js","components/Group.js","components/Kick.js","components/Merge.js","components/Output.js","components/Repeat.js","components/RepeatAsync.js","components/Split.js","components/RunInterval.js","index.js"],"json":["component.json"],"noflo":{"components":{"Callback":"components/Callback.js","Drop":"components/Drop.js","Group":"components/Group.js","Kick":"components/Kick.js","Merge":"components/Merge.js","Output":"components/Output.js","Repeat":"components/Repeat.js","RepeatAsync":"components/RepeatAsync.js","Split":"components/Split.js","RunInterval":"components/RunInterval.js"}}}'); | |
}); | |
require.register("noflo-noflo-dom/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features that are exposed as CommonJS modules | |
* that the components then utilize | |
*/ | |
}); | |
require.register("noflo-noflo-dom/components/GetElement.js", function(exports, require, module){ | |
var GetElement, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
GetElement = (function(_super) { | |
__extends(GetElement, _super); | |
GetElement.prototype.description = 'Get a DOM element matching a query'; | |
function GetElement() { | |
var _this = this; | |
this.container = null; | |
this.inPorts = { | |
"in": new noflo.Port('object'), | |
selector: new noflo.Port('string') | |
}; | |
this.outPorts = { | |
element: new noflo.Port('object'), | |
error: new noflo.Port('object') | |
}; | |
this.inPorts["in"].on('data', function(data) { | |
if (typeof data.querySelector !== 'function') { | |
_this.error('Given container doesn\'t support querySelectors'); | |
return; | |
} | |
return _this.container = data; | |
}); | |
this.inPorts.selector.on('data', function(data) { | |
return _this.select(data); | |
}); | |
} | |
GetElement.prototype.select = function(selector) { | |
var el, element, _i, _len; | |
if (this.container) { | |
el = this.container.querySelectorAll(selector); | |
} else { | |
el = document.querySelectorAll(selector); | |
} | |
if (!el.length) { | |
this.error("No element matching '" + selector + "' found"); | |
return; | |
} | |
for (_i = 0, _len = el.length; _i < _len; _i++) { | |
element = el[_i]; | |
this.outPorts.element.send(element); | |
} | |
return this.outPorts.element.disconnect(); | |
}; | |
GetElement.prototype.error = function(msg) { | |
if (this.outPorts.error.isAttached()) { | |
this.outPorts.error.send(new Error(msg)); | |
this.outPorts.error.disconnect(); | |
return; | |
} | |
throw new Error(msg); | |
}; | |
return GetElement; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new GetElement; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/ListenDrag.js", function(exports, require, module){ | |
var ListenDrag, noflo, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
ListenDrag = (function(_super) { | |
__extends(ListenDrag, _super); | |
ListenDrag.prototype.description = 'Listen to drag events on a DOM element'; | |
function ListenDrag() { | |
this.dragend = __bind(this.dragend, this); | |
this.dragmove = __bind(this.dragmove, this); | |
this.dragstart = __bind(this.dragstart, this); | |
var _this = this; | |
this.inPorts = { | |
element: new noflo.Port('object') | |
}; | |
this.outPorts = { | |
start: new noflo.ArrayPort('object'), | |
movex: new noflo.ArrayPort('number'), | |
movey: new noflo.ArrayPort('number'), | |
end: new noflo.ArrayPort('object') | |
}; | |
this.inPorts.element.on('data', function(element) { | |
return _this.subscribe(element); | |
}); | |
} | |
ListenDrag.prototype.subscribe = function(element) { | |
element.addEventListener('dragstart', this.dragstart, false); | |
element.addEventListener('drag', this.dragmove, false); | |
return element.addEventListener('dragend', this.dragend, false); | |
}; | |
ListenDrag.prototype.dragstart = function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
this.outPorts.start.send(event); | |
return this.outPorts.start.disconnect(); | |
}; | |
ListenDrag.prototype.dragmove = function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
this.outPorts.movex.send(event.clientX); | |
return this.outPorts.movey.send(event.clientY); | |
}; | |
ListenDrag.prototype.dragend = function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
if (this.outPorts.movex.isConnected()) { | |
this.outPorts.movex.disconnect(); | |
} | |
if (this.outPorts.movey.isConnected()) { | |
this.outPorts.movey.disconnect(); | |
} | |
this.outPorts.end.send(event); | |
return this.outPorts.end.disconnect(); | |
}; | |
return ListenDrag; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ListenDrag; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/ListenMouse.js", function(exports, require, module){ | |
var ListenMouse, noflo, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
ListenMouse = (function(_super) { | |
__extends(ListenMouse, _super); | |
ListenMouse.prototype.description = 'Listen to mouse events on a DOM element'; | |
function ListenMouse() { | |
this.click = __bind(this.click, this); | |
var _this = this; | |
this.inPorts = { | |
element: new noflo.Port('object') | |
}; | |
this.outPorts = { | |
click: new noflo.ArrayPort('object') | |
}; | |
this.inPorts.element.on('data', function(element) { | |
return _this.subscribe(element); | |
}); | |
} | |
ListenMouse.prototype.subscribe = function(element) { | |
return element.addEventListener('click', this.click, false); | |
}; | |
ListenMouse.prototype.click = function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
this.outPorts.click.send(event); | |
return this.outPorts.click.disconnect(); | |
}; | |
return ListenMouse; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ListenMouse; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/ListenScroll.js", function(exports, require, module){ | |
var ListenScroll, noflo, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
ListenScroll = (function(_super) { | |
__extends(ListenScroll, _super); | |
ListenScroll.prototype.description = 'Listen to scroll events'; | |
function ListenScroll() { | |
this.scroll = __bind(this.scroll, this); | |
var _this = this; | |
this.inPorts = { | |
start: new noflo.Port | |
}; | |
this.outPorts = { | |
top: new noflo.Port('number'), | |
bottom: new noflo.Port('number'), | |
left: new noflo.Port('number'), | |
right: new noflo.Port('number') | |
}; | |
this.inPorts.start.on('data', function() { | |
return _this.subscribe(); | |
}); | |
} | |
ListenScroll.prototype.subscribe = function() { | |
return window.addEventListener('scroll', this.scroll, false); | |
}; | |
ListenScroll.prototype.scroll = function(event) { | |
var bottom, left, right, top; | |
top = window.scrollY; | |
left = window.scrollX; | |
if (this.outPorts.top.isAttached()) { | |
this.outPorts.top.send(top); | |
this.outPorts.top.disconnect(); | |
} | |
if (this.outPorts.bottom.isAttached()) { | |
bottom = top + window.innerHeight; | |
this.outPorts.bottom.send(bottom); | |
this.outPorts.bottom.disconnect(); | |
} | |
if (this.outPorts.left.isAttached()) { | |
this.outPorts.left.send(left); | |
this.outPorts.left.disconnect(); | |
} | |
if (this.outPorts.right.isAttached()) { | |
right = left + window.innerWidth; | |
this.outPorts.right.send(right); | |
return this.outPorts.right.disconnect(); | |
} | |
}; | |
return ListenScroll; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ListenScroll; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/ListenTouch.js", function(exports, require, module){ | |
var ListenTouch, noflo, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
ListenTouch = (function(_super) { | |
__extends(ListenTouch, _super); | |
ListenTouch.prototype.description = 'Listen to touch events on a DOM element'; | |
function ListenTouch() { | |
this.touchend = __bind(this.touchend, this); | |
this.touchmove = __bind(this.touchmove, this); | |
this.touchstart = __bind(this.touchstart, this); | |
var _this = this; | |
this.inPorts = { | |
element: new noflo.Port('object') | |
}; | |
this.outPorts = { | |
start: new noflo.ArrayPort('object'), | |
movex: new noflo.ArrayPort('number'), | |
movey: new noflo.ArrayPort('number'), | |
end: new noflo.ArrayPort('object') | |
}; | |
this.inPorts.element.on('data', function(element) { | |
return _this.subscribe(element); | |
}); | |
} | |
ListenTouch.prototype.subscribe = function(element) { | |
element.addEventListener('touchstart', this.touchstart, false); | |
element.addEventListener('touchmove', this.touchmove, false); | |
return element.addEventListener('touchend', this.touchend, false); | |
}; | |
ListenTouch.prototype.touchstart = function(event) { | |
var idx, touch, _i, _len, _ref; | |
event.preventDefault(); | |
event.stopPropagation(); | |
if (!event.changedTouches) { | |
return; | |
} | |
if (!event.changedTouches.length) { | |
return; | |
} | |
_ref = event.changedTouches; | |
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) { | |
touch = _ref[idx]; | |
this.outPorts.start.beginGroup(idx); | |
this.outPorts.start.send(event); | |
this.outPorts.start.endGroup(); | |
} | |
return this.outPorts.start.disconnect(); | |
}; | |
ListenTouch.prototype.touchmove = function(event) { | |
var idx, touch, _i, _len, _ref, _results; | |
event.preventDefault(); | |
event.stopPropagation(); | |
if (!event.changedTouches) { | |
return; | |
} | |
if (!event.changedTouches.length) { | |
return; | |
} | |
_ref = event.changedTouches; | |
_results = []; | |
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) { | |
touch = _ref[idx]; | |
this.outPorts.movex.beginGroup(idx); | |
this.outPorts.movex.send(touch.pageX); | |
this.outPorts.movex.endGroup(); | |
this.outPorts.movey.beginGroup(idx); | |
this.outPorts.movey.send(touch.pageY); | |
_results.push(this.outPorts.movey.endGroup()); | |
} | |
return _results; | |
}; | |
ListenTouch.prototype.touchend = function(event) { | |
var idx, touch, _i, _len, _ref; | |
event.preventDefault(); | |
event.stopPropagation(); | |
if (!event.changedTouches) { | |
return; | |
} | |
if (!event.changedTouches.length) { | |
return; | |
} | |
if (this.outPorts.movex.isConnected()) { | |
this.outPorts.movex.disconnect(); | |
} | |
if (this.outPorts.movey.isConnected()) { | |
this.outPorts.movey.disconnect(); | |
} | |
_ref = event.changedTouches; | |
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) { | |
touch = _ref[idx]; | |
this.outPorts.end.beginGroup(idx); | |
this.outPorts.end.send(event); | |
this.outPorts.end.endGroup(); | |
} | |
return this.outPorts.end.disconnect(); | |
}; | |
return ListenTouch; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ListenTouch; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/MoveElement.js", function(exports, require, module){ | |
var MoveElement, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
MoveElement = (function(_super) { | |
__extends(MoveElement, _super); | |
MoveElement.prototype.description = 'Change the coordinates of a DOM element'; | |
function MoveElement() { | |
var _this = this; | |
this.element = null; | |
this.inPorts = { | |
element: new noflo.Port('object'), | |
x: new noflo.Port('number'), | |
y: new noflo.Port('number'), | |
z: new noflo.Port('number') | |
}; | |
this.inPorts.element.on('data', function(element) { | |
return _this.element = element; | |
}); | |
this.inPorts.x.on('data', function(x) { | |
return _this.setPosition('left', "" + x + "px"); | |
}); | |
this.inPorts.y.on('data', function(y) { | |
return _this.setPosition('top', "" + y + "px"); | |
}); | |
this.inPorts.z.on('data', function(z) { | |
return _this.setPosition('zIndex', z); | |
}); | |
} | |
MoveElement.prototype.setPosition = function(attr, value) { | |
this.element.style.position = 'absolute'; | |
return this.element.style[attr] = value; | |
}; | |
return MoveElement; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new MoveElement; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/ReadHtml.js", function(exports, require, module){ | |
var ReadHtml, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
ReadHtml = (function(_super) { | |
__extends(ReadHtml, _super); | |
ReadHtml.prototype.description = 'Write HTML inside an existing element'; | |
function ReadHtml() { | |
var _this = this; | |
this.inPorts = { | |
container: new noflo.Port('object') | |
}; | |
this.outPorts = { | |
html: new noflo.Port('string') | |
}; | |
this.inPorts.container.on('data', function(data) { | |
_this.outPorts.html.send(data.innerHTML); | |
return _this.outPorts.html.disconnect(); | |
}); | |
} | |
return ReadHtml; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ReadHtml; | |
}; | |
}); | |
require.register("noflo-noflo-dom/components/WriteHtml.js", function(exports, require, module){ | |
var WriteHtml, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
WriteHtml = (function(_super) { | |
__extends(WriteHtml, _super); | |
WriteHtml.prototype.description = 'Write HTML inside an existing element'; | |
function WriteHtml() { | |
var _this = this; | |
this.container = null; | |
this.html = null; | |
this.inPorts = { | |
html: new noflo.Port('string'), | |
container: new noflo.Port('object') | |
}; | |
this.outPorts = {}; | |
this.inPorts.html.on('data', function(data) { | |
_this.html = data; | |
if (_this.container) { | |
return _this.writeHtml(); | |
} | |
}); | |
this.inPorts.container.on('data', function(data) { | |
_this.container = data; | |
if (_this.html) { | |
return _this.writeHtml(); | |
} | |
}); | |
} | |
WriteHtml.prototype.writeHtml = function() { | |
this.container.innerHTML = this.html; | |
return this.html = null; | |
}; | |
return WriteHtml; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new WriteHtml; | |
}; | |
}); | |
require.register("noflo-noflo-dom/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-dom","description":"Document Object Model components for NoFlo","author":"Henri Bergius <[email protected]>","repo":"noflo/noflo-dom","version":"0.0.1","keywords":[],"dependencies":{"noflo/noflo":"*"},"scripts":["components/GetElement.js","components/ListenDrag.js","components/ListenMouse.js","components/ListenScroll.js","components/ListenTouch.js","components/MoveElement.js","components/ReadHtml.js","components/WriteHtml.js","index.js"],"json":["component.json"],"noflo":{"components":{"GetElement":"components/GetElement.js","ListenDrag":"components/ListenDrag.js","ListenMouse":"components/ListenMouse.js","ListenScroll":"components/ListenScroll.js","ListenTouch":"components/ListenTouch.js","MoveElement":"components/MoveElement.js","WriteHtml":"components/WriteHtml.js","ReadHtml":"components/ReadHtml.js"}}}'); | |
}); | |
require.register("noflo-noflo-flow/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features of flow. | |
* | |
* The library features can be made available as CommonJS modules that the | |
* components in this project utilize. | |
*/ | |
}); | |
require.register("noflo-noflo-flow/components/Gate.js", function(exports, require, module){ | |
var Gate, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Gate = (function(_super) { | |
__extends(Gate, _super); | |
Gate.prototype.description = 'This component forwards received packets when the gate is open'; | |
function Gate() { | |
var _this = this; | |
this.open = false; | |
this.inPorts = { | |
"in": new noflo.Port('all'), | |
open: new noflo.Port('bang'), | |
close: new noflo.Port('bang') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('all') | |
}; | |
this.inPorts["in"].on('connect', function() { | |
if (!_this.open) { | |
return; | |
} | |
return _this.outPorts.out.connect(); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
if (!_this.open) { | |
return; | |
} | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
if (!_this.open) { | |
return; | |
} | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
if (!_this.open) { | |
return; | |
} | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
if (!_this.open) { | |
return; | |
} | |
return _this.outPorts.out.disconnect(); | |
}); | |
this.inPorts.open.on('data', function() { | |
return _this.open = true; | |
}); | |
this.inPorts.close.on('data', function() { | |
return _this.open = false; | |
}); | |
} | |
return Gate; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Gate; | |
}; | |
}); | |
require.register("noflo-noflo-flow/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-flow","description":"Flow Control for NoFlo","author":"Henri Bergius <[email protected]>","repo":"noflo/noflo-dom","version":"0.2.0","keywords":[],"dependencies":{"noflo/noflo":"*"},"scripts":["components/Gate.js","index.js"],"json":["component.json"],"noflo":{"components":{"Gate":"components/Gate.js"}}}'); | |
}); | |
require.register("noflo-noflo-math/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features of noflo-math. | |
* | |
* The library features can be made available as CommonJS modules that the | |
* components in this project utilize. | |
*/ | |
}); | |
require.register("noflo-noflo-math/components/Add.js", function(exports, require, module){ | |
var Add, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Add = (function(_super) { | |
__extends(Add, _super); | |
function Add() { | |
var _this = this; | |
this.augend = null; | |
this.addend = null; | |
this.inPorts = { | |
augend: new noflo.Port, | |
addend: new noflo.Port | |
}; | |
this.outPorts = { | |
sum: new noflo.Port | |
}; | |
this.inPorts.augend.on('data', function(data) { | |
_this.augend = data; | |
if (_this.addend !== null) { | |
return _this.add(); | |
} | |
}); | |
this.inPorts.addend.on('data', function(data) { | |
_this.addend = data; | |
if (_this.augend !== null) { | |
return _this.add(); | |
} | |
}); | |
} | |
Add.prototype.add = function() { | |
this.outPorts.sum.send(this.augend + this.addend); | |
return this.outPorts.sum.disconnect(); | |
}; | |
return Add; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Add; | |
}; | |
}); | |
require.register("noflo-noflo-math/components/Subtract.js", function(exports, require, module){ | |
var Subtract, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Subtract = (function(_super) { | |
__extends(Subtract, _super); | |
function Subtract() { | |
var _this = this; | |
this.minuend = null; | |
this.subtrahend = null; | |
this.inPorts = { | |
minuend: new noflo.Port, | |
subtrahend: new noflo.Port | |
}; | |
this.outPorts = { | |
difference: new noflo.Port | |
}; | |
this.inPorts.minuend.on('data', function(data) { | |
_this.minuend = data; | |
if (_this.subtrahend !== null) { | |
return _this.add(); | |
} | |
}); | |
this.inPorts.subtrahend.on('data', function(data) { | |
_this.subtrahend = data; | |
if (_this.minuend !== null) { | |
return _this.add(); | |
} | |
}); | |
} | |
Subtract.prototype.add = function() { | |
this.outPorts.difference.send(this.minuend - this.subtrahend); | |
return this.outPorts.difference.disconnect(); | |
}; | |
return Subtract; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Subtract; | |
}; | |
}); | |
require.register("noflo-noflo-math/components/Multiply.js", function(exports, require, module){ | |
var Multiply, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Multiply = (function(_super) { | |
__extends(Multiply, _super); | |
function Multiply() { | |
var _this = this; | |
this.multiplicand = null; | |
this.multiplier = null; | |
this.inPorts = { | |
multiplicand: new noflo.Port, | |
multiplier: new noflo.Port | |
}; | |
this.outPorts = { | |
product: new noflo.Port | |
}; | |
this.inPorts.multiplicand.on('data', function(data) { | |
_this.multiplicand = data; | |
if (_this.multiplier !== null) { | |
return _this.add(); | |
} | |
}); | |
this.inPorts.multiplier.on('data', function(data) { | |
_this.multiplier = data; | |
if (_this.multiplicand !== null) { | |
return _this.add(); | |
} | |
}); | |
} | |
Multiply.prototype.add = function() { | |
this.outPorts.product.send(this.multiplicand * this.multiplier); | |
return this.outPorts.product.disconnect(); | |
}; | |
return Multiply; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Multiply; | |
}; | |
}); | |
require.register("noflo-noflo-math/components/Divide.js", function(exports, require, module){ | |
var Divide, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Divide = (function(_super) { | |
__extends(Divide, _super); | |
function Divide() { | |
var _this = this; | |
this.dividend = null; | |
this.divisor = null; | |
this.inPorts = { | |
dividend: new noflo.Port, | |
divisor: new noflo.Port | |
}; | |
this.outPorts = { | |
quotient: new noflo.Port | |
}; | |
this.inPorts.dividend.on('data', function(data) { | |
_this.dividend = data; | |
if (_this.divisor !== null) { | |
return _this.add(); | |
} | |
}); | |
this.inPorts.divisor.on('data', function(data) { | |
_this.divisor = data; | |
if (_this.dividend !== null) { | |
return _this.add(); | |
} | |
}); | |
} | |
Divide.prototype.add = function() { | |
this.outPorts.quotient.send(this.dividend / this.divisor); | |
return this.outPorts.quotient.disconnect(); | |
}; | |
return Divide; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Divide; | |
}; | |
}); | |
require.register("noflo-noflo-math/components/CountSum.js", function(exports, require, module){ | |
var CountSum, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
CountSum = (function(_super) { | |
__extends(CountSum, _super); | |
function CountSum() { | |
var _this = this; | |
this.portCounts = {}; | |
this.inPorts = { | |
"in": new noflo.ArrayPort('number') | |
}; | |
this.outPorts = { | |
out: new noflo.ArrayPort('number') | |
}; | |
this.inPorts["in"].on('data', function(data, portId) { | |
return _this.count(portId, data); | |
}); | |
this.inPorts["in"].on('disconnect', function(socket, portId) { | |
var _i, _len, _ref; | |
_ref = _this.inPorts["in"].sockets; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
socket = _ref[_i]; | |
if (socket.isConnected()) { | |
return; | |
} | |
} | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
CountSum.prototype.count = function(port, data) { | |
var id, socket, sum, _i, _len, _ref; | |
sum = 0; | |
this.portCounts[port] = data; | |
_ref = this.inPorts["in"].sockets; | |
for (id = _i = 0, _len = _ref.length; _i < _len; id = ++_i) { | |
socket = _ref[id]; | |
if (typeof this.portCounts[id] === 'undefined') { | |
this.portCounts[id] = 0; | |
} | |
sum += this.portCounts[id]; | |
} | |
return this.outPorts.out.send(sum); | |
}; | |
return CountSum; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new CountSum; | |
}; | |
}); | |
require.register("noflo-noflo-math/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-math","description":"Mathematical components for NoFlo","author":"Henri Bergius <[email protected]>","repo":"noflo/noflo-math","version":"0.0.1","keywords":[],"dependencies":{"noflo/noflo":"*"},"scripts":["components/Add.js","components/Subtract.js","components/Multiply.js","components/Divide.js","components/CountSum.js","index.js"],"json":["component.json"],"noflo":{"components":{"Add":"components/Add.js","Subtract":"components/Subtract.js","Multiply":"components/Multiply.js","Divide":"components/Divide.js","CountSum":"components/CountSum.js"}}}'); | |
}); | |
require.register("noflo-noflo-objects/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features of objects. | |
* | |
* The library features can be made available as CommonJS modules that the | |
* components in this project utilize. | |
*/ | |
}); | |
require.register("noflo-noflo-objects/components/Extend.js", function(exports, require, module){ | |
var Extend, cleanSymbols, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
_ = require("underscore"); | |
noflo = require("noflo"); | |
Extend = (function(_super) { | |
__extends(Extend, _super); | |
Extend.prototype.description = "Extend an incoming object to some predefined objects, optionally by a certain property"; | |
function Extend() { | |
var _this = this; | |
this.bases = []; | |
this.key = null; | |
this.inPorts = { | |
"in": new noflo.Port, | |
base: new noflo.Port, | |
key: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts.base.on("data", function(base) { | |
if (base != null) { | |
return _this.bases.push(base); | |
} else { | |
return _this.bases = []; | |
} | |
}); | |
this.inPorts.key.on("data", function(key) { | |
_this.key = key; | |
}); | |
this.inPorts["in"].on("connect", function() { | |
return _this.objects = []; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(incoming) { | |
var base, out, _i, _len, _ref; | |
out = {}; | |
_ref = _this.bases; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
base = _ref[_i]; | |
if ((_this.key == null) || (incoming[_this.key] != null) && incoming[_this.key] === base[_this.key]) { | |
_.extend(out, base); | |
} | |
} | |
_.extend(out, incoming); | |
return _this.outPorts.out.send(out); | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Extend; | |
})(noflo.Component); | |
cleanSymbols = function(str) { | |
return str.replace(/[^a-zA-Z0-9]/g, ""); | |
}; | |
exports.getComponent = function() { | |
return new Extend; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/MergeObjects.js", function(exports, require, module){ | |
var MergeObjects, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
_ = require("underscore"); | |
noflo = require("noflo"); | |
MergeObjects = (function(_super) { | |
__extends(MergeObjects, _super); | |
MergeObjects.prototype.description = "merges all incoming objects into one"; | |
function MergeObjects() { | |
var _this = this; | |
this.merge = _.bind(this.merge, this); | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on("connect", function() { | |
_this.groups = []; | |
return _this.objects = []; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.groups.push(group); | |
}); | |
this.inPorts["in"].on("data", function(object) { | |
return _this.objects.push(object); | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.groups.pop(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
_this.outPorts.out.send(_.reduce(_this.objects, _this.merge, {})); | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
MergeObjects.prototype.merge = function(origin, object) { | |
var key, oValue, value; | |
for (key in object) { | |
value = object[key]; | |
oValue = origin[key]; | |
if (oValue != null) { | |
switch (toString.call(oValue)) { | |
case "[object Array]": | |
origin[key].push.apply(origin[key], value); | |
break; | |
case "[object Object]": | |
origin[key] = this.merge(oValue, value); | |
break; | |
default: | |
origin[key] = value; | |
} | |
} else { | |
origin[key] = value; | |
} | |
} | |
return origin; | |
}; | |
return MergeObjects; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new MergeObjects; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SplitObject.js", function(exports, require, module){ | |
var SplitObject, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
SplitObject = (function(_super) { | |
__extends(SplitObject, _super); | |
SplitObject.prototype.description = "splits a single object into multiple IPs, wrapped with the key as the group"; | |
function SplitObject() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
var key, value, _results; | |
_results = []; | |
for (key in data) { | |
value = data[key]; | |
_this.outPorts.out.beginGroup(key); | |
_this.outPorts.out.send(value); | |
_results.push(_this.outPorts.out.endGroup()); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return SplitObject; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SplitObject; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/ReplaceKey.js", function(exports, require, module){ | |
var ReplaceKey, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
ReplaceKey = (function(_super) { | |
__extends(ReplaceKey, _super); | |
ReplaceKey.prototype.description = "given a regexp matching any key of an incoming object as a data IP, replace the key with the provided string"; | |
function ReplaceKey() { | |
var _this = this; | |
this.patterns = {}; | |
this.inPorts = { | |
"in": new noflo.Port, | |
pattern: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts.pattern.on("data", function(patterns) { | |
_this.patterns = patterns; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
var key, newKey, pattern, replace, value, _ref; | |
newKey = null; | |
for (key in data) { | |
value = data[key]; | |
_ref = _this.patterns; | |
for (pattern in _ref) { | |
replace = _ref[pattern]; | |
pattern = new RegExp(pattern); | |
if (key.match(pattern) != null) { | |
newKey = key.replace(pattern, replace); | |
data[newKey] = value; | |
delete data[key]; | |
} | |
} | |
} | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
_this.pattern = null; | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return ReplaceKey; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ReplaceKey; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/Keys.js", function(exports, require, module){ | |
var Keys, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
_ = require("underscore"); | |
Keys = (function(_super) { | |
__extends(Keys, _super); | |
Keys.prototype.description = "gets only the keys of an object and forward them as an array"; | |
function Keys() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
var key, _i, _len, _ref, _results; | |
_ref = _.keys(data); | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
key = _ref[_i]; | |
_results.push(_this.outPorts.out.send(key)); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Keys; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Keys; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/Values.js", function(exports, require, module){ | |
var Values, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
_ = require("underscore"); | |
Values = (function(_super) { | |
__extends(Values, _super); | |
Values.prototype.description = "gets only the values of an object and forward them as an array"; | |
function Values() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
var value, _i, _len, _ref, _results; | |
_ref = _.values(data); | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
value = _ref[_i]; | |
_results.push(_this.outPorts.out.send(value)); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Values; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Values; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/Join.js", function(exports, require, module){ | |
var Join, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
_ = require("underscore"); | |
noflo = require("noflo"); | |
Join = (function(_super) { | |
__extends(Join, _super); | |
Join.prototype.description = "Join all values of a passed packet together as a string with a predefined delimiter"; | |
function Join() { | |
var _this = this; | |
this.delimiter = ","; | |
this.inPorts = { | |
"in": new noflo.Port, | |
delimiter: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts.delimiter.on("data", function(delimiter) { | |
_this.delimiter = delimiter; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(object) { | |
if (_.isObject(object)) { | |
return _this.outPorts.out.send(_.values(object).join(_this.delimiter)); | |
} | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Join; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Join; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/ExtractProperty.js", function(exports, require, module){ | |
var ExtractProperty, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
_ = require("underscore"); | |
ExtractProperty = (function(_super) { | |
__extends(ExtractProperty, _super); | |
ExtractProperty.prototype.description = "Given a key, return only the value matching that key in the incoming object"; | |
function ExtractProperty() { | |
var _this = this; | |
this.key = null; | |
this.inPorts = { | |
"in": new noflo.Port, | |
key: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts.key.on("data", function(key) { | |
_this.key = key; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
if ((_this.key != null) && _.isObject(data)) { | |
return _this.outPorts.out.send(data[_this.key]); | |
} | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return ExtractProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new ExtractProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/InsertProperty.js", function(exports, require, module){ | |
var InsertProperty, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
_ = require("underscore"); | |
InsertProperty = (function(_super) { | |
__extends(InsertProperty, _super); | |
InsertProperty.prototype.description = "Insert a property into incoming objects."; | |
function InsertProperty() { | |
var _this = this; | |
this.properties = {}; | |
this.inPorts = { | |
"in": new noflo.Port, | |
property: new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts.property.on("connect", function() { | |
return _this.properties = {}; | |
}); | |
this.inPorts.property.on("begingroup", function(key) { | |
_this.key = key; | |
}); | |
this.inPorts.property.on("data", function(value) { | |
if (_this.key != null) { | |
return _this.properties[_this.key] = value; | |
} | |
}); | |
this.inPorts.property.on("endgroup", function() { | |
return _this.key = null; | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
var key, value, _ref; | |
if (!_.isObject(data)) { | |
data = {}; | |
} | |
_ref = _this.properties; | |
for (key in _ref) { | |
value = _ref[key]; | |
data[key] = value; | |
} | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return InsertProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new InsertProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SliceArray.js", function(exports, require, module){ | |
var SliceArray, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
SliceArray = (function(_super) { | |
__extends(SliceArray, _super); | |
function SliceArray() { | |
var _this = this; | |
this.begin = 0; | |
this.end = null; | |
this.inPorts = { | |
"in": new noflo.Port(), | |
begin: new noflo.Port(), | |
end: new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port(), | |
error: new noflo.Port() | |
}; | |
this.inPorts.begin.on('data', function(data) { | |
return _this.begin = data; | |
}); | |
this.inPorts.end.on('data', function(data) { | |
return _this.end = data; | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.sliceData(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
SliceArray.prototype.sliceData = function(data) { | |
var sliced; | |
if (!data.slice) { | |
return this.outPorts.error.send("Data " + (typeof data) + " cannot be sliced"); | |
} | |
if (this.end !== null) { | |
sliced = data.slice(this.begin, this.end); | |
} | |
if (this.end === null) { | |
sliced = data.slice(this.begin); | |
} | |
return this.outPorts.out.send(sliced); | |
}; | |
return SliceArray; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SliceArray; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SplitArray.js", function(exports, require, module){ | |
var SplitArray, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
SplitArray = (function(_super) { | |
__extends(SplitArray, _super); | |
function SplitArray() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.ArrayPort() | |
}; | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
var item, key, _i, _len, _results; | |
if (toString.call(data) !== '[object Array]') { | |
for (key in data) { | |
item = data[key]; | |
_this.outPorts.out.beginGroup(key); | |
_this.outPorts.out.send(item); | |
_this.outPorts.out.endGroup(); | |
} | |
return; | |
} | |
_results = []; | |
for (_i = 0, _len = data.length; _i < _len; _i++) { | |
item = data[_i]; | |
_results.push(_this.outPorts.out.send(item)); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function(data) { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return SplitArray; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SplitArray; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/FilterPropertyValue.js", function(exports, require, module){ | |
var FilterPropertyValue, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
FilterPropertyValue = (function(_super) { | |
__extends(FilterPropertyValue, _super); | |
function FilterPropertyValue() { | |
var _this = this; | |
this.accepts = {}; | |
this.regexps = {}; | |
this.inPorts = { | |
accept: new noflo.ArrayPort(), | |
regexp: new noflo.ArrayPort(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.accept.on('data', function(data) { | |
return _this.prepareAccept(data); | |
}); | |
this.inPorts.regexp.on('data', function(data) { | |
return _this.prepareRegExp(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
if (_this.filtering()) { | |
return _this.filterData(data); | |
} | |
return _this.outPorts.out.send(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
FilterPropertyValue.prototype.filtering = function() { | |
return (Object.keys(this.accepts)).length > 0 || (Object.keys(this.regexps)).length > 0; | |
}; | |
FilterPropertyValue.prototype.prepareAccept = function(map) { | |
var e, mapParts; | |
if (typeof map === 'object') { | |
this.accepts = map; | |
return; | |
} | |
mapParts = map.split('='); | |
try { | |
return this.accepts[mapParts[0]] = eval(mapParts[1]); | |
} catch (_error) { | |
e = _error; | |
if (e instanceof ReferenceError) { | |
return this.accepts[mapParts[0]] = mapParts[1]; | |
} else { | |
throw e; | |
} | |
} | |
}; | |
FilterPropertyValue.prototype.prepareRegExp = function(map) { | |
var mapParts; | |
mapParts = map.split('='); | |
return this.regexps[mapParts[0]] = mapParts[1]; | |
}; | |
FilterPropertyValue.prototype.filterData = function(object) { | |
var match, newData, property, regexp, value; | |
newData = {}; | |
match = false; | |
for (property in object) { | |
value = object[property]; | |
if (this.accepts[property]) { | |
if (this.accepts[property] !== value) { | |
continue; | |
} | |
match = true; | |
} | |
if (this.regexps[property]) { | |
regexp = new RegExp(this.regexps[property]); | |
if (!regexp.exec(value)) { | |
continue; | |
} | |
match = true; | |
} | |
newData[property] = value; | |
continue; | |
} | |
if (!match) { | |
return; | |
} | |
return this.outPorts.out.send(newData); | |
}; | |
return FilterPropertyValue; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new FilterPropertyValue; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/FlattenObject.js", function(exports, require, module){ | |
var FlattenObject, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
FlattenObject = (function(_super) { | |
__extends(FlattenObject, _super); | |
function FlattenObject() { | |
var _this = this; | |
this.map = {}; | |
this.inPorts = { | |
map: new noflo.ArrayPort(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.map.on('data', function(data) { | |
return _this.prepareMap(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
var object, _i, _len, _ref, _results; | |
_ref = _this.flattenObject(data); | |
_results = []; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
object = _ref[_i]; | |
_results.push(_this.outPorts.out.send(_this.mapKeys(object))); | |
} | |
return _results; | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
FlattenObject.prototype.prepareMap = function(map) { | |
var mapParts; | |
if (typeof map === 'object') { | |
this.map = map; | |
return; | |
} | |
mapParts = map.split('='); | |
return this.map[mapParts[0]] = mapParts[1]; | |
}; | |
FlattenObject.prototype.mapKeys = function(object) { | |
var key, map, _ref; | |
_ref = this.map; | |
for (key in _ref) { | |
map = _ref[key]; | |
object[map] = object.flattenedKeys[key]; | |
} | |
delete object.flattenedKeys; | |
return object; | |
}; | |
FlattenObject.prototype.flattenObject = function(object) { | |
var flattened, flattenedValue, key, val, value, _i, _len; | |
flattened = []; | |
for (key in object) { | |
value = object[key]; | |
if (typeof value === 'object') { | |
flattenedValue = this.flattenObject(value); | |
for (_i = 0, _len = flattenedValue.length; _i < _len; _i++) { | |
val = flattenedValue[_i]; | |
val.flattenedKeys.push(key); | |
flattened.push(val); | |
} | |
continue; | |
} | |
flattened.push({ | |
flattenedKeys: [key], | |
value: value | |
}); | |
} | |
return flattened; | |
}; | |
return FlattenObject; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new FlattenObject; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/MapProperty.js", function(exports, require, module){ | |
var MapProperty, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
MapProperty = (function(_super) { | |
__extends(MapProperty, _super); | |
function MapProperty() { | |
var _this = this; | |
this.map = {}; | |
this.regexps = {}; | |
this.inPorts = { | |
map: new noflo.ArrayPort(), | |
regexp: new noflo.ArrayPort(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.map.on('data', function(data) { | |
return _this.prepareMap(data); | |
}); | |
this.inPorts.regexp.on('data', function(data) { | |
return _this.prepareRegExp(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.mapData(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
MapProperty.prototype.prepareMap = function(map) { | |
var mapParts; | |
if (typeof map === 'object') { | |
this.map = map; | |
return; | |
} | |
mapParts = map.split('='); | |
return this.map[mapParts[0]] = mapParts[1]; | |
}; | |
MapProperty.prototype.prepareRegExp = function(map) { | |
var mapParts; | |
mapParts = map.split('='); | |
return this.regexps[mapParts[0]] = mapParts[1]; | |
}; | |
MapProperty.prototype.mapData = function(data) { | |
var expression, matched, newData, property, regexp, replacement, value, _ref; | |
newData = {}; | |
for (property in data) { | |
value = data[property]; | |
if (property in this.map) { | |
property = this.map[property]; | |
} | |
_ref = this.regexps; | |
for (expression in _ref) { | |
replacement = _ref[expression]; | |
regexp = new RegExp(expression); | |
matched = regexp.exec(property); | |
if (!matched) { | |
continue; | |
} | |
property = property.replace(regexp, replacement); | |
} | |
if (property in newData) { | |
if (Array.isArray(newData[property])) { | |
newData[property].push(value); | |
} else { | |
newData[property] = [newData[property], value]; | |
} | |
} else { | |
newData[property] = value; | |
} | |
} | |
return this.outPorts.out.send(newData); | |
}; | |
return MapProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new MapProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/RemoveProperty.js", function(exports, require, module){ | |
var RemoveProperty, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
_ = require('underscore'); | |
RemoveProperty = (function(_super) { | |
__extends(RemoveProperty, _super); | |
function RemoveProperty() { | |
var _this = this; | |
this.properties = []; | |
this.inPorts = { | |
"in": new noflo.Port(), | |
property: new noflo.ArrayPort() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.property.on('data', function(data) { | |
return _this.properties.push(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(_this.removeProperties(data)); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
RemoveProperty.prototype.removeProperties = function(object) { | |
var property, _i, _len, _ref; | |
object = _.clone(object); | |
_ref = this.properties; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
property = _ref[_i]; | |
delete object[property]; | |
} | |
return object; | |
}; | |
return RemoveProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new RemoveProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/MapPropertyValue.js", function(exports, require, module){ | |
var MapPropertyValue, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
MapPropertyValue = (function(_super) { | |
__extends(MapPropertyValue, _super); | |
function MapPropertyValue() { | |
var _this = this; | |
this.mapAny = {}; | |
this.map = {}; | |
this.regexpAny = {}; | |
this.regexp = {}; | |
this.inPorts = { | |
map: new noflo.ArrayPort(), | |
regexp: new noflo.ArrayPort(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.map.on('data', function(data) { | |
return _this.prepareMap(data); | |
}); | |
this.inPorts.regexp.on('data', function(data) { | |
return _this.prepareRegExp(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.mapData(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
MapPropertyValue.prototype.prepareMap = function(map) { | |
var mapParts; | |
if (typeof map === 'object') { | |
this.mapAny = map; | |
return; | |
} | |
mapParts = map.split('='); | |
if (mapParts.length === 3) { | |
this.map[mapParts[0]] = { | |
from: mapParts[1], | |
to: mapParts[2] | |
}; | |
return; | |
} | |
return this.mapAny[mapParts[0]] = mapParts[1]; | |
}; | |
MapPropertyValue.prototype.prepareRegExp = function(map) { | |
var mapParts; | |
mapParts = map.split('='); | |
if (mapParts.length === 3) { | |
this.regexp[mapParts[0]] = { | |
from: mapParts[1], | |
to: mapParts[2] | |
}; | |
return; | |
} | |
return this.regexpAny[mapParts[0]] = mapParts[1]; | |
}; | |
MapPropertyValue.prototype.mapData = function(data) { | |
var expression, matched, property, regexp, replacement, value, _ref; | |
for (property in data) { | |
value = data[property]; | |
if (this.map[property] && this.map[property].from === value) { | |
data[property] = this.map[property].to; | |
} | |
if (this.mapAny[value]) { | |
data[property] = this.mapAny[value]; | |
} | |
if (this.regexp[property]) { | |
regexp = new RegExp(this.regexp[property].from); | |
matched = regexp.exec(value); | |
if (matched) { | |
data[property] = value.replace(regexp, this.regexp[property].to); | |
} | |
} | |
_ref = this.regexpAny; | |
for (expression in _ref) { | |
replacement = _ref[expression]; | |
regexp = new RegExp(expression); | |
matched = regexp.exec(value); | |
if (!matched) { | |
continue; | |
} | |
data[property] = value.replace(regexp, replacement); | |
} | |
} | |
return this.outPorts.out.send(data); | |
}; | |
return MapPropertyValue; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new MapPropertyValue; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/GetObjectKey.js", function(exports, require, module){ | |
var GetObjectKey, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
GetObjectKey = (function(_super) { | |
__extends(GetObjectKey, _super); | |
function GetObjectKey() { | |
var _this = this; | |
this.sendGroup = true; | |
this.data = []; | |
this.key = []; | |
this.inPorts = { | |
"in": new noflo.Port(), | |
key: new noflo.ArrayPort(), | |
sendgroup: new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port(), | |
object: new noflo.Port(), | |
missed: new noflo.Port() | |
}; | |
this.inPorts["in"].on('connect', function() { | |
return _this.data = []; | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
if (_this.key.length) { | |
return _this.getKey(data); | |
} | |
return _this.data.push(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
var data, _i, _len, _ref; | |
if (!_this.data.length) { | |
_this.outPorts.out.disconnect(); | |
return; | |
} | |
if (!_this.key.length) { | |
return; | |
} | |
_ref = _this.data; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
data = _ref[_i]; | |
_this.getKey(data); | |
} | |
_this.outPorts.out.disconnect(); | |
if (_this.outPorts.object.isAttached()) { | |
return _this.outPorts.object.disconnect(); | |
} | |
}); | |
this.inPorts.key.on('data', function(data) { | |
return _this.key.push(data); | |
}); | |
this.inPorts.key.on('disconnect', function() { | |
var data, _i, _len, _ref; | |
if (!_this.data.length) { | |
return; | |
} | |
_ref = _this.data; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
data = _ref[_i]; | |
_this.getKey(data); | |
} | |
_this.data = []; | |
return _this.outPorts.out.disconnect(); | |
}); | |
this.inPorts.sendgroup.on('data', function(data) { | |
if (typeof data === 'string') { | |
if (data.toLowerCase() === 'false') { | |
_this.sendGroup = false; | |
return; | |
} | |
_this.sendGroup = true; | |
return; | |
} | |
return _this.sendGroup = data; | |
}); | |
} | |
GetObjectKey.prototype.error = function(data, error) { | |
if (this.outPorts.missed.isAttached()) { | |
this.outPorts.missed.send(data); | |
this.outPorts.missed.disconnect(); | |
return; | |
} | |
throw error; | |
}; | |
GetObjectKey.prototype.getKey = function(data) { | |
var key, _i, _len, _ref; | |
if (!this.key.length) { | |
this.error(data, new Error('Key not defined')); | |
return; | |
} | |
if (typeof data !== 'object') { | |
this.error(data, new Error('Data is not an object')); | |
return; | |
} | |
if (data === null) { | |
this.error(data, new Error('Data is NULL')); | |
return; | |
} | |
_ref = this.key; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
key = _ref[_i]; | |
if (data[key] === void 0) { | |
this.error(data, new Error("Object has no key " + key)); | |
continue; | |
} | |
if (this.sendGroup) { | |
this.outPorts.out.beginGroup(key); | |
} | |
this.outPorts.out.send(data[key]); | |
if (this.sendGroup) { | |
this.outPorts.out.endGroup(); | |
} | |
} | |
if (!this.outPorts.object.isAttached()) { | |
return; | |
} | |
return this.outPorts.object.send(data); | |
}; | |
return GetObjectKey; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new GetObjectKey; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/UniqueArray.js", function(exports, require, module){ | |
var UniqueArray, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
UniqueArray = (function(_super) { | |
__extends(UniqueArray, _super); | |
function UniqueArray() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(_this.unique(data)); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
UniqueArray.prototype.unique = function(array) { | |
var member, newArray, seen, _i, _len; | |
seen = {}; | |
newArray = []; | |
for (_i = 0, _len = array.length; _i < _len; _i++) { | |
member = array[_i]; | |
seen[member] = member; | |
} | |
for (member in seen) { | |
newArray.push(member); | |
} | |
return newArray; | |
}; | |
return UniqueArray; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new UniqueArray; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SetProperty.js", function(exports, require, module){ | |
var SetProperty, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
SetProperty = (function(_super) { | |
__extends(SetProperty, _super); | |
function SetProperty() { | |
var _this = this; | |
this.properties = {}; | |
this.inPorts = { | |
property: new noflo.ArrayPort(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.property.on('data', function(data) { | |
return _this.setProperty(data); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.addProperties(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
SetProperty.prototype.setProperty = function(prop) { | |
var propParts; | |
if (typeof prop === 'object') { | |
this.prop = prop; | |
return; | |
} | |
propParts = prop.split('='); | |
return this.properties[propParts[0]] = propParts[1]; | |
}; | |
SetProperty.prototype.addProperties = function(object) { | |
var property, value, _ref; | |
_ref = this.properties; | |
for (property in _ref) { | |
value = _ref[property]; | |
object[property] = value; | |
} | |
return this.outPorts.out.send(object); | |
}; | |
return SetProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SetProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SimplifyObject.js", function(exports, require, module){ | |
var SimplifyObject, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
_ = require('underscore')._; | |
SimplifyObject = (function(_super) { | |
__extends(SimplifyObject, _super); | |
function SimplifyObject() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port | |
}; | |
this.outPorts = { | |
out: new noflo.Port | |
}; | |
this.inPorts["in"].on('beginGroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(_this.simplify(data)); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
SimplifyObject.prototype.simplify = function(data) { | |
if (_.isArray(data)) { | |
if (data.length === 1) { | |
return data[0]; | |
} | |
return data; | |
} | |
if (!_.isObject(data)) { | |
return data; | |
} | |
return this.simplifyObject(data); | |
}; | |
SimplifyObject.prototype.simplifyObject = function(data) { | |
var keys, simplified, | |
_this = this; | |
keys = _.keys(data); | |
if (keys.length === 1 && keys[0] === '$data') { | |
return this.simplify(data['$data']); | |
} | |
simplified = {}; | |
_.each(data, function(value, key) { | |
return simplified[key] = _this.simplify(value); | |
}); | |
return simplified; | |
}; | |
return SimplifyObject; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SimplifyObject; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/DuplicateProperty.js", function(exports, require, module){ | |
var DuplicateProperty, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
DuplicateProperty = (function(_super) { | |
__extends(DuplicateProperty, _super); | |
function DuplicateProperty() { | |
var _this = this; | |
this.properties = {}; | |
this.separator = '/'; | |
this.inPorts = { | |
property: new noflo.ArrayPort(), | |
separator: new noflo.Port(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.property.on('data', function(data) { | |
return _this.setProperty(data); | |
}); | |
this.inPorts.separator.on('data', function(data) { | |
return _this.separator = data; | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.addProperties(data); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
DuplicateProperty.prototype.setProperty = function(prop) { | |
var propParts; | |
if (typeof prop === 'object') { | |
this.prop = prop; | |
return; | |
} | |
propParts = prop.split('='); | |
if (propParts.length > 2) { | |
this.properties[propParts.pop()] = propParts; | |
return; | |
} | |
return this.properties[propParts[1]] = propParts[0]; | |
}; | |
DuplicateProperty.prototype.addProperties = function(object) { | |
var newValues, newprop, original, originalProp, _i, _len, _ref; | |
_ref = this.properties; | |
for (newprop in _ref) { | |
original = _ref[newprop]; | |
if (typeof original === 'string') { | |
object[newprop] = object[original]; | |
continue; | |
} | |
newValues = []; | |
for (_i = 0, _len = original.length; _i < _len; _i++) { | |
originalProp = original[_i]; | |
newValues.push(object[originalProp]); | |
} | |
object[newprop] = newValues.join(this.separator); | |
} | |
return this.outPorts.out.send(object); | |
}; | |
return DuplicateProperty; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new DuplicateProperty; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/CreateObject.js", function(exports, require, module){ | |
var CreateObject, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
CreateObject = (function(_super) { | |
__extends(CreateObject, _super); | |
function CreateObject() { | |
var _this = this; | |
this.inPorts = { | |
start: new noflo.Port('bang') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('object') | |
}; | |
this.inPorts.start.on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts.start.on("data", function() { | |
_this.outPorts.out.send({}); | |
return _this.outPorts.out.disconnect(); | |
}); | |
this.inPorts.start.on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
} | |
return CreateObject; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new CreateObject; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/CreateDate.js", function(exports, require, module){ | |
var CreateDate, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
CreateDate = (function(_super) { | |
__extends(CreateDate, _super); | |
function CreateDate() { | |
var _this = this; | |
this.inPorts = { | |
"in": new noflo.Port('string') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('object') | |
}; | |
this.inPorts["in"].on("data", function(data) { | |
var date; | |
if (data === "now" || data === null) { | |
date = new Date; | |
} else { | |
date = new Date(data); | |
} | |
_this.outPorts.out.send(date); | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return CreateDate; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new CreateDate; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/SetPropertyValue.js", function(exports, require, module){ | |
var SetPropertyValue, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
SetPropertyValue = (function(_super) { | |
__extends(SetPropertyValue, _super); | |
function SetPropertyValue() { | |
var _this = this; | |
this.property = null; | |
this.value = null; | |
this.data = []; | |
this.groups = []; | |
this.inPorts = { | |
property: new noflo.Port(), | |
value: new noflo.Port(), | |
"in": new noflo.Port() | |
}; | |
this.outPorts = { | |
out: new noflo.Port() | |
}; | |
this.inPorts.property.on('data', function(data) { | |
_this.property = data; | |
if (_this.value && _this.data.length) { | |
return _this.addProperties(); | |
} | |
}); | |
this.inPorts.value.on('data', function(data) { | |
_this.value = data; | |
if (_this.property && _this.data.length) { | |
return _this.addProperties(); | |
} | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.groups.push(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
if (_this.property && _this.value) { | |
_this.addProperty({ | |
data: data, | |
group: _this.groups.slice(0) | |
}); | |
return; | |
} | |
return _this.data.push({ | |
data: data, | |
group: _this.groups.slice(0) | |
}); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.groups.pop(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
if (_this.property && _this.value) { | |
_this.outPorts.out.disconnect(); | |
} | |
return _this.value = null; | |
}); | |
} | |
SetPropertyValue.prototype.addProperty = function(object) { | |
var group, _i, _j, _len, _len1, _ref, _ref1, _results; | |
object.data[this.property] = this.value; | |
_ref = object.group; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
group = _ref[_i]; | |
this.outPorts.out.beginGroup(group); | |
} | |
this.outPorts.out.send(object.data); | |
_ref1 = object.group; | |
_results = []; | |
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | |
group = _ref1[_j]; | |
_results.push(this.outPorts.out.endGroup()); | |
} | |
return _results; | |
}; | |
SetPropertyValue.prototype.addProperties = function() { | |
var object, _i, _len, _ref; | |
_ref = this.data; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
object = _ref[_i]; | |
this.addProperty(object); | |
} | |
this.data = []; | |
return this.outPorts.out.disconnect(); | |
}; | |
return SetPropertyValue; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SetPropertyValue; | |
}; | |
}); | |
require.register("noflo-noflo-objects/components/CallMethod.js", function(exports, require, module){ | |
var CallMethod, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
CallMethod = (function(_super) { | |
__extends(CallMethod, _super); | |
CallMethod.prototype.description = "call a method on an object"; | |
function CallMethod() { | |
var _this = this; | |
this.method = null; | |
this.inPorts = { | |
"in": new noflo.Port('object'), | |
method: new noflo.Port('string') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('all'), | |
error: new noflo.Port('string') | |
}; | |
this.inPorts["in"].on("data", function(data) { | |
var msg; | |
if (!_this.method) { | |
return; | |
} | |
if (!data[_this.method]) { | |
msg = "Method '" + _this.method + "' not available"; | |
if (_this.outPorts.error.isAttached()) { | |
_this.outPorts.error.send(msg); | |
_this.outPorts.error.disconnect(); | |
return; | |
} | |
throw new Error(msg); | |
} | |
return _this.outPorts.out.send(data[_this.method].call(data)); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
this.inPorts.method.on("data", function(data) { | |
return _this.method = data; | |
}); | |
} | |
return CallMethod; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new CallMethod; | |
}; | |
}); | |
require.register("noflo-noflo-objects/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-objects","description":"Object Utilities for NoFlo","version":"0.1.0","keywords":["noflo","objects","utilities"],"author":"Kenneth Kan <[email protected]>","repo":"noflo/objects","dependencies":{"noflo/noflo":"*","component/underscore":"*"},"scripts":["components/Extend.js","components/MergeObjects.js","components/SplitObject.js","components/ReplaceKey.js","components/Keys.js","components/Values.js","components/Join.js","components/ExtractProperty.js","components/InsertProperty.js","components/SliceArray.js","components/SplitArray.js","components/FilterPropertyValue.js","components/FlattenObject.js","components/MapProperty.js","components/RemoveProperty.js","components/MapPropertyValue.js","components/GetObjectKey.js","components/UniqueArray.js","components/SetProperty.js","components/SimplifyObject.js","components/DuplicateProperty.js","components/CreateObject.js","components/CreateDate.js","components/SetPropertyValue.js","components/CallMethod.js","index.js"],"json":["component.json"],"noflo":{"components":{"Extend":"components/Extend.js","MergeObjects":"components/MergeObjects.js","SplitObject":"components/SplitObject.js","ReplaceKey":"components/ReplaceKey.js","Keys":"components/Keys.js","Values":"components/Values.js","Join":"components/Join.js","ExtractProperty":"components/ExtractProperty.js","InsertProperty":"components/InsertProperty.js","SliceArray":"components/SliceArray.js","SplitArray":"components/SplitArray.js","FilterPropertyValue":"components/FilterPropertyValue.js","FlattenObject":"components/FlattenObject.js","MapProperty":"components/MapProperty.js","RemoveProperty":"components/RemoveProperty.js","MapPropertyValue":"components/MapPropertyValue.js","GetObjectKey":"components/GetObjectKey.js","UniqueArray":"components/UniqueArray.js","SetProperty":"components/SetProperty.js","SimplifyObject":"components/SimplifyObject.js","DuplicateProperty":"components/DuplicateProperty.js","CreateObject":"components/CreateObject.js","CreateDate":"components/CreateDate.js","SetPropertyValue":"components/SetPropertyValue.js","CallMethod":"components/CallMethod.js"}}}'); | |
}); | |
require.register("noflo-noflo-strings/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features that are exposed as CommonJS modules | |
* that the components then utilize | |
*/ | |
}); | |
require.register("noflo-noflo-strings/components/Filter.js", function(exports, require, module){ | |
var Filter, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require("noflo"); | |
Filter = (function(_super) { | |
__extends(Filter, _super); | |
Filter.prototype.description = "filters an IP which is a string using a regex"; | |
function Filter() { | |
var _this = this; | |
this.regex = null; | |
this.inPorts = { | |
"in": new noflo.Port('string'), | |
pattern: new noflo.Port('string') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('string'), | |
missed: new noflo.Port('string') | |
}; | |
this.inPorts.pattern.on("data", function(data) { | |
return _this.regex = new RegExp(data); | |
}); | |
this.inPorts["in"].on("begingroup", function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on("data", function(data) { | |
if (typeof data !== 'string') { | |
data = data.toString(); | |
} | |
if ((_this.regex != null) && ((data != null ? typeof data.match === "function" ? data.match(_this.regex) : void 0 : void 0) != null)) { | |
_this.outPorts.out.send(data); | |
return; | |
} | |
if (_this.outPorts.missed.isAttached()) { | |
return _this.outPorts.missed.send(data); | |
} | |
}); | |
this.inPorts["in"].on("endgroup", function(group) { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on("disconnect", function() { | |
_this.outPorts.out.disconnect(); | |
if (_this.outPorts.missed.isAttached()) { | |
return _this.outPorts.missed.disconnect(); | |
} | |
}); | |
} | |
return Filter; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Filter; | |
}; | |
}); | |
require.register("noflo-noflo-strings/components/SendString.js", function(exports, require, module){ | |
var SendString, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
SendString = (function(_super) { | |
__extends(SendString, _super); | |
function SendString() { | |
var _this = this; | |
this.string = ''; | |
this.inPorts = { | |
string: new noflo.Port('string'), | |
"in": new noflo.Port('bang') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('string') | |
}; | |
this.inPorts.string.on('data', function(data) { | |
return _this.string = data; | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(_this.string); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return SendString; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new SendString; | |
}; | |
}); | |
require.register("noflo-noflo-strings/components/StringTemplate.js", function(exports, require, module){ | |
var StringTemplate, noflo, _, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
_ = require('underscore'); | |
StringTemplate = (function(_super) { | |
__extends(StringTemplate, _super); | |
function StringTemplate() { | |
var _this = this; | |
this.template = null; | |
this.inPorts = { | |
template: new noflo.Port('string'), | |
"in": new noflo.Port('object') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('string') | |
}; | |
this.inPorts.template.on('data', function(data) { | |
return _this.template = _.template(data); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
return _this.outPorts.out.send(_this.template(data)); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return StringTemplate; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new StringTemplate; | |
}; | |
}); | |
require.register("noflo-noflo-strings/components/Replace.js", function(exports, require, module){ | |
var Replace, noflo, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
noflo = require('noflo'); | |
Replace = (function(_super) { | |
__extends(Replace, _super); | |
Replace.prototype.description = 'Given a fixed pattern and its replacement, replace all\ | |
occurrences in the incoming template.'; | |
function Replace() { | |
var _this = this; | |
this.pattern = null; | |
this.replacement = ''; | |
this.inPorts = { | |
"in": new noflo.Port('string'), | |
pattern: new noflo.Port('string'), | |
replacement: new noflo.Port('string') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('string') | |
}; | |
this.inPorts.pattern.on('data', function(data) { | |
return _this.pattern = new RegExp(data, 'g'); | |
}); | |
this.inPorts.replacement.on('data', function(data) { | |
return _this.replacement = data.replace('\\\\n', "\n"); | |
}); | |
this.inPorts["in"].on('begingroup', function(group) { | |
return _this.outPorts.out.beginGroup(group); | |
}); | |
this.inPorts["in"].on('data', function(data) { | |
var string; | |
string = data; | |
if (_this.pattern != null) { | |
string = ("" + data).replace(_this.pattern, _this.replacement); | |
} | |
return _this.outPorts.out.send(string); | |
}); | |
this.inPorts["in"].on('endgroup', function() { | |
return _this.outPorts.out.endGroup(); | |
}); | |
this.inPorts["in"].on('disconnect', function() { | |
return _this.outPorts.out.disconnect(); | |
}); | |
} | |
return Replace; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Replace; | |
}; | |
}); | |
require.register("noflo-noflo-strings/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-strings","description":"String Utilities for NoFlo","author":"Henri Bergius <[email protected]>","repo":"noflo/noflo-strings","version":"0.0.1","keywords":[],"dependencies":{"noflo/noflo":"*","component/underscore":"*"},"scripts":["components/Filter.js","components/SendString.js","components/StringTemplate.js","components/Replace.js","index.js"],"json":["component.json"],"noflo":{"components":{"Filter":"components/Filter.js","SendString":"components/SendString.js","StringTemplate":"components/StringTemplate.js","Replace":"components/Replace.js"}}}'); | |
}); | |
require.register("noflo-noflo-physics/index.js", function(exports, require, module){ | |
/* | |
* This file can be used for general library features of noflo-physics. | |
* | |
* The library features can be made available as CommonJS modules that the | |
* components in this project utilize. | |
*/ | |
}); | |
require.register("noflo-noflo-physics/components/Spring.js", function(exports, require, module){ | |
var Spring, noflo, requestAnimFrame, | |
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | |
__hasProp = {}.hasOwnProperty, | |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | |
if (typeof process === 'object' && process.title === 'node') { | |
noflo = require("noflo"); | |
requestAnimFrame = process.nextTick; | |
} else { | |
noflo = require('noflo'); | |
requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { | |
return setTimeout(callback, 1); | |
}; | |
} | |
Spring = (function(_super) { | |
__extends(Spring, _super); | |
Spring.prototype.description = 'Animates a directional spring'; | |
function Spring() { | |
this.step = __bind(this.step, this); | |
var _this = this; | |
this.massPosition = 0; | |
this.anchorPosition = 0; | |
this.stiffness = 120; | |
this.mass = 10; | |
this.friction = 3; | |
this.speed = 0; | |
this.inPorts = { | |
anchor: new noflo.Port('number'), | |
"in": new noflo.Port('number'), | |
stiffness: new noflo.Port('int'), | |
mass: new noflo.Port('int'), | |
friction: new noflo.Port('int') | |
}; | |
this.outPorts = { | |
out: new noflo.Port('number') | |
}; | |
this.inPorts.anchor.on('data', function(anchorPosition) { | |
_this.anchorPosition = anchorPosition; | |
}); | |
this.inPorts.stiffness.on('data', function(stiffness) { | |
_this.stiffness = stiffness; | |
}); | |
this.inPorts.mass.on('data', function(mass) { | |
_this.mass = mass; | |
}); | |
this.inPorts.friction.on('data', function(friction) { | |
_this.friction = friction; | |
}); | |
this.inPorts["in"].on('data', function(massPosition) { | |
_this.massPosition = massPosition; | |
return _this.step(); | |
}); | |
} | |
Spring.prototype.step = function() { | |
var acceleration, dampingForce, distance, previousPosition, springForce, totalForce; | |
distance = this.massPosition - this.anchorPosition; | |
dampingForce = -this.friction * this.speed; | |
springForce = -this.stiffness * distance; | |
totalForce = springForce + dampingForce; | |
acceleration = totalForce / this.mass; | |
this.speed += acceleration; | |
previousPosition = this.massPosition; | |
this.massPosition += this.speed / 100; | |
if (Math.round(this.massPosition) !== Math.round(previousPosition)) { | |
this.outPorts.out.send(Math.round(this.massPosition)); | |
} | |
if (Math.round(this.massPosition) === this.anchorPosition && Math.abs(this.speed) < 0.2) { | |
return this.outPorts.out.disconnect(); | |
} else { | |
if (this.massPosition === 0) { | |
return; | |
} | |
return requestAnimFrame(this.step); | |
} | |
}; | |
return Spring; | |
})(noflo.Component); | |
exports.getComponent = function() { | |
return new Spring; | |
}; | |
}); | |
require.register("noflo-noflo-physics/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-physics","description":"Physics components for NoFlo","author":"Henri Bergius <[email protected]>","repo":"noflo/noflo-physics","version":"0.1.0","keywords":[],"dependencies":{"noflo/noflo":"*"},"scripts":["components/Spring.js","index.js"],"json":["component.json"],"noflo":{"components":{"Spring":"components/Spring.js"}}}'); | |
}); | |
require.register("noflo-custom/component.json", function(exports, require, module){ | |
module.exports = JSON.parse('{"name":"noflo-custom","dependencies":{"noflo/noflo":"*","noflo/noflo-core":"*","noflo/noflo-dom":"*","noflo/noflo-flow":"*","noflo/noflo-math":"*","noflo/noflo-objects":"*","noflo/noflo-strings":"*","noflo/noflo-physics":"*"},"scripts":["noflo-custom.js"],"main":"noflo-custom.js","json":["component.json"]}'); | |
}); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-custom/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-custom/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-custom/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-custom/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-custom/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-custom/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-custom/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-custom/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-custom/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-custom/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-custom/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-custom/deps/noflo/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("noflo-noflo-core/components/Callback.js", "noflo-custom/deps/noflo-core/components/Callback.js"); | |
require.alias("noflo-noflo-core/components/Drop.js", "noflo-custom/deps/noflo-core/components/Drop.js"); | |
require.alias("noflo-noflo-core/components/Group.js", "noflo-custom/deps/noflo-core/components/Group.js"); | |
require.alias("noflo-noflo-core/components/Kick.js", "noflo-custom/deps/noflo-core/components/Kick.js"); | |
require.alias("noflo-noflo-core/components/Merge.js", "noflo-custom/deps/noflo-core/components/Merge.js"); | |
require.alias("noflo-noflo-core/components/Output.js", "noflo-custom/deps/noflo-core/components/Output.js"); | |
require.alias("noflo-noflo-core/components/Repeat.js", "noflo-custom/deps/noflo-core/components/Repeat.js"); | |
require.alias("noflo-noflo-core/components/RepeatAsync.js", "noflo-custom/deps/noflo-core/components/RepeatAsync.js"); | |
require.alias("noflo-noflo-core/components/Split.js", "noflo-custom/deps/noflo-core/components/Split.js"); | |
require.alias("noflo-noflo-core/components/RunInterval.js", "noflo-custom/deps/noflo-core/components/RunInterval.js"); | |
require.alias("noflo-noflo-core/index.js", "noflo-custom/deps/noflo-core/index.js"); | |
require.alias("noflo-noflo-core/index.js", "noflo-core/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-core/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-core/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-core/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-core/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-core/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-core/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-core/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-core/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-core/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-core/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-core/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-core/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo-core/deps/underscore/index.js"); | |
require.alias("noflo-noflo-dom/components/GetElement.js", "noflo-custom/deps/noflo-dom/components/GetElement.js"); | |
require.alias("noflo-noflo-dom/components/ListenDrag.js", "noflo-custom/deps/noflo-dom/components/ListenDrag.js"); | |
require.alias("noflo-noflo-dom/components/ListenMouse.js", "noflo-custom/deps/noflo-dom/components/ListenMouse.js"); | |
require.alias("noflo-noflo-dom/components/ListenScroll.js", "noflo-custom/deps/noflo-dom/components/ListenScroll.js"); | |
require.alias("noflo-noflo-dom/components/ListenTouch.js", "noflo-custom/deps/noflo-dom/components/ListenTouch.js"); | |
require.alias("noflo-noflo-dom/components/MoveElement.js", "noflo-custom/deps/noflo-dom/components/MoveElement.js"); | |
require.alias("noflo-noflo-dom/components/ReadHtml.js", "noflo-custom/deps/noflo-dom/components/ReadHtml.js"); | |
require.alias("noflo-noflo-dom/components/WriteHtml.js", "noflo-custom/deps/noflo-dom/components/WriteHtml.js"); | |
require.alias("noflo-noflo-dom/index.js", "noflo-custom/deps/noflo-dom/index.js"); | |
require.alias("noflo-noflo-dom/index.js", "noflo-dom/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-dom/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-dom/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-dom/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-dom/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-dom/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-dom/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-dom/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-dom/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-dom/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-dom/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-dom/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-dom/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("noflo-noflo-flow/components/Gate.js", "noflo-custom/deps/noflo-flow/components/Gate.js"); | |
require.alias("noflo-noflo-flow/index.js", "noflo-custom/deps/noflo-flow/index.js"); | |
require.alias("noflo-noflo-flow/index.js", "noflo-flow/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-flow/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-flow/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-flow/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-flow/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-flow/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-flow/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-flow/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-flow/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-flow/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-flow/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-flow/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-flow/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("noflo-noflo-math/components/Add.js", "noflo-custom/deps/noflo-math/components/Add.js"); | |
require.alias("noflo-noflo-math/components/Subtract.js", "noflo-custom/deps/noflo-math/components/Subtract.js"); | |
require.alias("noflo-noflo-math/components/Multiply.js", "noflo-custom/deps/noflo-math/components/Multiply.js"); | |
require.alias("noflo-noflo-math/components/Divide.js", "noflo-custom/deps/noflo-math/components/Divide.js"); | |
require.alias("noflo-noflo-math/components/CountSum.js", "noflo-custom/deps/noflo-math/components/CountSum.js"); | |
require.alias("noflo-noflo-math/index.js", "noflo-custom/deps/noflo-math/index.js"); | |
require.alias("noflo-noflo-math/index.js", "noflo-math/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-math/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-math/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-math/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-math/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-math/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-math/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-math/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-math/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-math/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-math/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-math/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-math/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("noflo-noflo-objects/components/Extend.js", "noflo-custom/deps/noflo-objects/components/Extend.js"); | |
require.alias("noflo-noflo-objects/components/MergeObjects.js", "noflo-custom/deps/noflo-objects/components/MergeObjects.js"); | |
require.alias("noflo-noflo-objects/components/SplitObject.js", "noflo-custom/deps/noflo-objects/components/SplitObject.js"); | |
require.alias("noflo-noflo-objects/components/ReplaceKey.js", "noflo-custom/deps/noflo-objects/components/ReplaceKey.js"); | |
require.alias("noflo-noflo-objects/components/Keys.js", "noflo-custom/deps/noflo-objects/components/Keys.js"); | |
require.alias("noflo-noflo-objects/components/Values.js", "noflo-custom/deps/noflo-objects/components/Values.js"); | |
require.alias("noflo-noflo-objects/components/Join.js", "noflo-custom/deps/noflo-objects/components/Join.js"); | |
require.alias("noflo-noflo-objects/components/ExtractProperty.js", "noflo-custom/deps/noflo-objects/components/ExtractProperty.js"); | |
require.alias("noflo-noflo-objects/components/InsertProperty.js", "noflo-custom/deps/noflo-objects/components/InsertProperty.js"); | |
require.alias("noflo-noflo-objects/components/SliceArray.js", "noflo-custom/deps/noflo-objects/components/SliceArray.js"); | |
require.alias("noflo-noflo-objects/components/SplitArray.js", "noflo-custom/deps/noflo-objects/components/SplitArray.js"); | |
require.alias("noflo-noflo-objects/components/FilterPropertyValue.js", "noflo-custom/deps/noflo-objects/components/FilterPropertyValue.js"); | |
require.alias("noflo-noflo-objects/components/FlattenObject.js", "noflo-custom/deps/noflo-objects/components/FlattenObject.js"); | |
require.alias("noflo-noflo-objects/components/MapProperty.js", "noflo-custom/deps/noflo-objects/components/MapProperty.js"); | |
require.alias("noflo-noflo-objects/components/RemoveProperty.js", "noflo-custom/deps/noflo-objects/components/RemoveProperty.js"); | |
require.alias("noflo-noflo-objects/components/MapPropertyValue.js", "noflo-custom/deps/noflo-objects/components/MapPropertyValue.js"); | |
require.alias("noflo-noflo-objects/components/GetObjectKey.js", "noflo-custom/deps/noflo-objects/components/GetObjectKey.js"); | |
require.alias("noflo-noflo-objects/components/UniqueArray.js", "noflo-custom/deps/noflo-objects/components/UniqueArray.js"); | |
require.alias("noflo-noflo-objects/components/SetProperty.js", "noflo-custom/deps/noflo-objects/components/SetProperty.js"); | |
require.alias("noflo-noflo-objects/components/SimplifyObject.js", "noflo-custom/deps/noflo-objects/components/SimplifyObject.js"); | |
require.alias("noflo-noflo-objects/components/DuplicateProperty.js", "noflo-custom/deps/noflo-objects/components/DuplicateProperty.js"); | |
require.alias("noflo-noflo-objects/components/CreateObject.js", "noflo-custom/deps/noflo-objects/components/CreateObject.js"); | |
require.alias("noflo-noflo-objects/components/CreateDate.js", "noflo-custom/deps/noflo-objects/components/CreateDate.js"); | |
require.alias("noflo-noflo-objects/components/SetPropertyValue.js", "noflo-custom/deps/noflo-objects/components/SetPropertyValue.js"); | |
require.alias("noflo-noflo-objects/components/CallMethod.js", "noflo-custom/deps/noflo-objects/components/CallMethod.js"); | |
require.alias("noflo-noflo-objects/index.js", "noflo-custom/deps/noflo-objects/index.js"); | |
require.alias("noflo-noflo-objects/index.js", "noflo-objects/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-objects/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-objects/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-objects/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-objects/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-objects/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-objects/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-objects/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-objects/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-objects/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-objects/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-objects/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-objects/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo-objects/deps/underscore/index.js"); | |
require.alias("noflo-noflo-strings/components/Filter.js", "noflo-custom/deps/noflo-strings/components/Filter.js"); | |
require.alias("noflo-noflo-strings/components/SendString.js", "noflo-custom/deps/noflo-strings/components/SendString.js"); | |
require.alias("noflo-noflo-strings/components/StringTemplate.js", "noflo-custom/deps/noflo-strings/components/StringTemplate.js"); | |
require.alias("noflo-noflo-strings/components/Replace.js", "noflo-custom/deps/noflo-strings/components/Replace.js"); | |
require.alias("noflo-noflo-strings/index.js", "noflo-custom/deps/noflo-strings/index.js"); | |
require.alias("noflo-noflo-strings/index.js", "noflo-strings/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-strings/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-strings/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-strings/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-strings/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-strings/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-strings/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-strings/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-strings/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-strings/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-strings/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-strings/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-strings/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo-strings/deps/underscore/index.js"); | |
require.alias("noflo-noflo-physics/components/Spring.js", "noflo-custom/deps/noflo-physics/components/Spring.js"); | |
require.alias("noflo-noflo-physics/index.js", "noflo-custom/deps/noflo-physics/index.js"); | |
require.alias("noflo-noflo-physics/index.js", "noflo-physics/index.js"); | |
require.alias("noflo-noflo/src/lib/Graph.js", "noflo-noflo-physics/deps/noflo/src/lib/Graph.js"); | |
require.alias("noflo-noflo/src/lib/InternalSocket.js", "noflo-noflo-physics/deps/noflo/src/lib/InternalSocket.js"); | |
require.alias("noflo-noflo/src/lib/Port.js", "noflo-noflo-physics/deps/noflo/src/lib/Port.js"); | |
require.alias("noflo-noflo/src/lib/ArrayPort.js", "noflo-noflo-physics/deps/noflo/src/lib/ArrayPort.js"); | |
require.alias("noflo-noflo/src/lib/Component.js", "noflo-noflo-physics/deps/noflo/src/lib/Component.js"); | |
require.alias("noflo-noflo/src/lib/AsyncComponent.js", "noflo-noflo-physics/deps/noflo/src/lib/AsyncComponent.js"); | |
require.alias("noflo-noflo/src/lib/LoggingComponent.js", "noflo-noflo-physics/deps/noflo/src/lib/LoggingComponent.js"); | |
require.alias("noflo-noflo/src/lib/ComponentLoader.js", "noflo-noflo-physics/deps/noflo/src/lib/ComponentLoader.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-physics/deps/noflo/src/lib/NoFlo.js"); | |
require.alias("noflo-noflo/src/lib/Network.js", "noflo-noflo-physics/deps/noflo/src/lib/Network.js"); | |
require.alias("noflo-noflo/src/components/Graph.js", "noflo-noflo-physics/deps/noflo/src/components/Graph.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo-physics/deps/noflo/index.js"); | |
require.alias("component-emitter/index.js", "noflo-noflo/deps/emitter/index.js"); | |
require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js"); | |
require.alias("component-underscore/index.js", "noflo-noflo/deps/underscore/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/lib/fbp.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-noflo/deps/fbp/index.js"); | |
require.alias("noflo-fbp/lib/fbp.js", "noflo-fbp/index.js"); | |
require.alias("noflo-noflo/src/lib/NoFlo.js", "noflo-noflo/index.js"); | |
if (typeof exports == "object") { | |
module.exports = require("noflo"); | |
} else if (typeof define == "function" && define.amd) { | |
define(function(){ return require("noflo"); }); | |
} else { | |
this["noflo"] = require("noflo"); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment