forked from enviPath/enviPy
Current Dev State
This commit is contained in:
18
static/js/ketcher2/node_modules/labeled-stream-splicer/LICENSE
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/labeled-stream-splicer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
3
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/bar.js
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/bar.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function (n) {
|
||||
return n * 100;
|
||||
};
|
||||
5
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/foo.js
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/foo.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var bar = require('./bar');
|
||||
|
||||
module.exports = function (n) {
|
||||
return n * 111 + bar(n);
|
||||
};
|
||||
2
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/main.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/main.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var foo = require('./foo');
|
||||
console.log('main: ' + foo(5));
|
||||
2
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/xyz.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/labeled-stream-splicer/example/browser/xyz.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var foo = require('./foo');
|
||||
console.log('xyz: ' + foo(6));
|
||||
16
static/js/ketcher2/node_modules/labeled-stream-splicer/example/bundle.js
generated
vendored
Normal file
16
static/js/ketcher2/node_modules/labeled-stream-splicer/example/bundle.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
var splicer = require('../');
|
||||
var through = require('through2');
|
||||
var deps = require('module-deps');
|
||||
var pack = require('browser-pack');
|
||||
|
||||
var pipeline = splicer.obj([
|
||||
'deps', [ deps(__dirname + '/browser/main.js') ],
|
||||
'pack', [ pack({ raw: true }) ],
|
||||
process.stdout
|
||||
]);
|
||||
|
||||
pipeline.get('deps').push(through.obj(function (row, enc, next) {
|
||||
row.source = row.source.toUpperCase();
|
||||
this.push(row);
|
||||
next();
|
||||
}));
|
||||
65
static/js/ketcher2/node_modules/labeled-stream-splicer/index.js
generated
vendored
Normal file
65
static/js/ketcher2/node_modules/labeled-stream-splicer/index.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
var Splicer = require('stream-splicer');
|
||||
var inherits = require('inherits');
|
||||
var isarray = require('isarray');
|
||||
|
||||
module.exports = Labeled;
|
||||
inherits(Labeled, Splicer);
|
||||
|
||||
module.exports.obj = function (streams, opts) {
|
||||
if (!opts) opts = {};
|
||||
opts.objectMode = true;
|
||||
return new Labeled(streams, opts);
|
||||
};
|
||||
|
||||
function Labeled (streams, opts) {
|
||||
if (!(this instanceof Labeled)) return new Labeled(streams, opts);
|
||||
Splicer.call(this, [], opts);
|
||||
|
||||
var reps = [];
|
||||
for (var i = 0; i < streams.length; i++) {
|
||||
var s = streams[i];
|
||||
if (typeof s === 'string') continue;
|
||||
if (isarray(s)) {
|
||||
s = new Labeled(s, opts);
|
||||
}
|
||||
if (i >= 0 && typeof streams[i-1] === 'string') {
|
||||
s.label = streams[i-1];
|
||||
}
|
||||
reps.push(s);
|
||||
}
|
||||
if (typeof streams[i-1] === 'string') {
|
||||
reps.push(new Labeled([], opts));
|
||||
}
|
||||
this.splice.apply(this, [0,0].concat(reps));
|
||||
}
|
||||
|
||||
Labeled.prototype.indexOf = function (stream) {
|
||||
if (typeof stream === 'string') {
|
||||
for (var i = 0; i < this._streams.length; i++) {
|
||||
if (this._streams[i].label === stream) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return Splicer.prototype.indexOf.call(this, stream);
|
||||
}
|
||||
};
|
||||
|
||||
Labeled.prototype.get = function (key) {
|
||||
if (typeof key === 'string') {
|
||||
var ix = this.indexOf(key);
|
||||
if (ix < 0) return undefined;
|
||||
return this._streams[ix];
|
||||
}
|
||||
else return Splicer.prototype.get.call(this, key);
|
||||
};
|
||||
|
||||
Labeled.prototype.splice = function (key) {
|
||||
var ix;
|
||||
if (typeof key === 'string') {
|
||||
ix = this.indexOf(key);
|
||||
}
|
||||
else ix = key;
|
||||
var args = [ ix ].concat([].slice.call(arguments, 1));
|
||||
return Splicer.prototype.splice.apply(this, args);
|
||||
};
|
||||
54
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/README.md
generated
vendored
Normal file
54
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/README.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
209
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/build/build.js
generated
vendored
Normal file
209
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/build/build.js
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
|
||||
/**
|
||||
* 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 index = path + '/index.js';
|
||||
|
||||
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(index)) {
|
||||
return require.aliases[index];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 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("isarray/index.js", function(exports, require, module){
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
|
||||
});
|
||||
require.alias("isarray/index.js", "isarray/index.js");
|
||||
|
||||
19
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/component.json
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name" : "isarray",
|
||||
"description" : "Array#isArray for older browsers",
|
||||
"version" : "0.0.1",
|
||||
"repository" : "juliangruber/isarray",
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main" : "index.js",
|
||||
"scripts" : [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies" : {},
|
||||
"keywords": ["browser","isarray","array"],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
3
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/index.js
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
57
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/package.json
generated
vendored
Normal file
57
static/js/ketcher2/node_modules/labeled-stream-splicer/node_modules/isarray/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"_from": "isarray@~0.0.1",
|
||||
"_id": "isarray@0.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
|
||||
"_location": "/labeled-stream-splicer/isarray",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "isarray@~0.0.1",
|
||||
"name": "isarray",
|
||||
"escapedName": "isarray",
|
||||
"rawSpec": "~0.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/labeled-stream-splicer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
|
||||
"_spec": "isarray@~0.0.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/labeled-stream-splicer",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/isarray/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Array#isArray for older browsers",
|
||||
"devDependencies": {
|
||||
"tap": "*"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"isarray",
|
||||
"array"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "isarray",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
||||
67
static/js/ketcher2/node_modules/labeled-stream-splicer/package.json
generated
vendored
Normal file
67
static/js/ketcher2/node_modules/labeled-stream-splicer/package.json
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "labeled-stream-splicer@^2.0.0",
|
||||
"_id": "labeled-stream-splicer@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-pS4dE4AkwAuGscDJH2d5GLiuClk=",
|
||||
"_location": "/labeled-stream-splicer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "labeled-stream-splicer@^2.0.0",
|
||||
"name": "labeled-stream-splicer",
|
||||
"escapedName": "labeled-stream-splicer",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz",
|
||||
"_shasum": "a52e1d138024c00b86b1c0c91f677918b8ae0a59",
|
||||
"_spec": "labeled-stream-splicer@^2.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/browserify",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/labeled-stream-splicer/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.1",
|
||||
"isarray": "~0.0.1",
|
||||
"stream-splicer": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "stream splicer with labels",
|
||||
"devDependencies": {
|
||||
"browser-pack": "^2.0.1",
|
||||
"concat-stream": "^1.4.6",
|
||||
"module-deps": "^2.1.2",
|
||||
"tape": "^2.12.1",
|
||||
"through2": "^1.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/substack/labeled-stream-splicer",
|
||||
"keywords": [
|
||||
"splice",
|
||||
"stream",
|
||||
"labels",
|
||||
"mutable",
|
||||
"pipeline"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "labeled-stream-splicer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/labeled-stream-splicer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
124
static/js/ketcher2/node_modules/labeled-stream-splicer/readme.markdown
generated
vendored
Normal file
124
static/js/ketcher2/node_modules/labeled-stream-splicer/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
# labeled-stream-splicer
|
||||
|
||||
[stream splicer](https://npmjs.org/package/stream-splicer) with labels
|
||||
|
||||
[](http://travis-ci.org/substack/labeled-stream-splicer)
|
||||
|
||||
# example
|
||||
|
||||
Here's an example that exposes a label for `deps` and `pack`:
|
||||
|
||||
``` js
|
||||
var splicer = require('labeled-stream-splicer');
|
||||
var through = require('through2');
|
||||
var deps = require('module-deps');
|
||||
var pack = require('browser-pack');
|
||||
var lstream = require('lstream');
|
||||
|
||||
var pipeline = splicer.obj([
|
||||
'deps', [ deps() ],
|
||||
'pack', [ pack({ raw: true }) ]
|
||||
]);
|
||||
|
||||
pipeline.get('deps').unshift(lstream());
|
||||
|
||||
pipeline.get('deps').push(through.obj(function (row, enc, next) {
|
||||
row.source = row.source.toUpperCase();
|
||||
this.push(row);
|
||||
next();
|
||||
}));
|
||||
|
||||
process.stdin.pipe(pipeline).pipe(process.stdout);
|
||||
```
|
||||
|
||||
Here the `deps` sub-pipeline is augmented with a post-transformation that
|
||||
uppercases its source input.
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var splicer = require('labeled-stream-splicer')
|
||||
```
|
||||
|
||||
The API is the same as
|
||||
[stream-splicer](https://npmjs.org/package/stream-splicer),
|
||||
except that `pipeline.get()`, `pipeline.splice()`, and `pipeline.indexOf()` can
|
||||
accept string labels in addition to numeric indexes.
|
||||
|
||||
## var pipeline = splicer(streams, opts)
|
||||
|
||||
Create a `pipeline` duplex stream given an array of `streams`. Each `stream`
|
||||
will be piped to the next. Writes to `pipeline` get written to the first stream
|
||||
and data for reads from `pipeline` come from the last stream.
|
||||
|
||||
To signify a label, a stream may have a `.label` property or a string may be
|
||||
placed in the `streams` array.
|
||||
|
||||
For example, for streams `[ a, 'foo', b, c, 'bar', d ]`, this pipeline is
|
||||
constructed internally:
|
||||
|
||||
```
|
||||
a.pipe(b).pipe(c).pipe(d)
|
||||
```
|
||||
|
||||
with a label `'foo`' that points to `b` and a label `'bar'` that points to `d`.
|
||||
If `a` or `c` has a `.label` property, that label would be used for addressing.
|
||||
|
||||
Input will get written into `a`. Output will be read from `d`.
|
||||
|
||||
If any of the elements in `streams` are arrays, they will be converted into
|
||||
nested labeled pipelines. This is useful if you want to expose a hookable
|
||||
pipeline with grouped insertion points.
|
||||
|
||||
## var pipeline = splicer.obj(streams, opts)
|
||||
|
||||
Create a `pipeline` with `opts.objectMode` set to true for convenience.
|
||||
|
||||
## var removed = pipeline.splice(index, howMany, stream, ...)
|
||||
|
||||
Splice the pipeline starting at `index`, removing `howMany` streams and
|
||||
replacing them with each additional `stream` argument provided.
|
||||
|
||||
The streams that were removed from the splice and returned.
|
||||
|
||||
`index` can be an integer index or a label.
|
||||
|
||||
## pipeline.push(stream, ...)
|
||||
|
||||
Push one or more streams to the end of the pipeline.
|
||||
|
||||
The stream arguments may have a `label` property that will be used for string
|
||||
lookups.
|
||||
|
||||
## var stream = pipeline.pop()
|
||||
|
||||
Pop a stream from the end of the pipeline.
|
||||
|
||||
## pipeline.unshift(stream, ...)
|
||||
|
||||
Unshift one or more streams to the begining of the pipeline.
|
||||
|
||||
The stream arguments may have a `label` property that will be used for string
|
||||
lookups.
|
||||
|
||||
## var stream = pipeline.shift()
|
||||
|
||||
Shift a stream from the begining of the pipeline.
|
||||
|
||||
## var stream = pipeline.get(index)
|
||||
|
||||
Return the stream at index `index`.
|
||||
|
||||
`index` can be an integer or a string label.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install labeled-stream-splicer
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
27
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle.js
generated
vendored
Normal file
27
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
var test = require('tape');
|
||||
var splicer = require('../');
|
||||
var through = require('through2');
|
||||
var deps = require('module-deps');
|
||||
var pack = require('browser-pack');
|
||||
var concat = require('concat-stream');
|
||||
|
||||
test('bundle', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var pipeline = splicer.obj([
|
||||
'deps', [ deps(__dirname + '/bundle/main.js') ],
|
||||
'pack', [ pack({ raw: true }) ]
|
||||
]);
|
||||
pipeline.pipe(concat(function (body) {
|
||||
Function([ 'console' ], body.toString('utf8'))({ log: log });
|
||||
function log (msg) {
|
||||
t.equal(msg, 'main: 56055');
|
||||
}
|
||||
}));
|
||||
|
||||
pipeline.get('deps').push(through.obj(function (row, enc, next) {
|
||||
row.source = row.source.replace(/111/g, '11111');
|
||||
this.push(row);
|
||||
next();
|
||||
}));
|
||||
});
|
||||
3
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/bar.js
generated
vendored
Normal file
3
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/bar.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function (n) {
|
||||
return n * 100;
|
||||
};
|
||||
5
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/foo.js
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/foo.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
var bar = require('./bar');
|
||||
|
||||
module.exports = function (n) {
|
||||
return n * 111 + bar(n);
|
||||
};
|
||||
2
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/main.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/main.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var foo = require('./foo');
|
||||
console.log('main: ' + foo(5));
|
||||
2
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/xyz.js
generated
vendored
Normal file
2
static/js/ketcher2/node_modules/labeled-stream-splicer/test/bundle/xyz.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var foo = require('./foo');
|
||||
console.log('xyz: ' + foo(6));
|
||||
Reference in New Issue
Block a user