init commit
This commit is contained in:
2
node_modules/gulp-remote-src/.npmignore
generated
vendored
Normal file
2
node_modules/gulp-remote-src/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/node_modules
|
||||
/dist
|
||||
5
node_modules/gulp-remote-src/.travis.yml
generated
vendored
Normal file
5
node_modules/gulp-remote-src/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.10
|
||||
before_script:
|
||||
- "npm install -g gulp"
|
||||
23
node_modules/gulp-remote-src/CHANGELOG.md
generated
vendored
Normal file
23
node_modules/gulp-remote-src/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Changelog
|
||||
|
||||
### v0.1.0 (2014-06-30)
|
||||
|
||||
First release.
|
||||
|
||||
### v0.2.0 (2014-07-01)
|
||||
|
||||
Fix streaming pipe.
|
||||
|
||||
Add tests for streaming pipe.
|
||||
|
||||
### v0.2.1 (2014-07-18)
|
||||
|
||||
Add option `strictSSL` (thank you [@Magomogo](https://github.com/Magomogo))
|
||||
|
||||
### v0.3.0 (2014-09-02)
|
||||
|
||||
Pass through [request](https://github.com/mikeal/request) options to make it flexible.
|
||||
|
||||
### v0.4.0 (2015-08-14)
|
||||
|
||||
Put `request` options in a single `requestOptions`.
|
||||
90
node_modules/gulp-remote-src/Gulpfile.js
generated
vendored
Normal file
90
node_modules/gulp-remote-src/Gulpfile.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
var remoteSrc = require('./');
|
||||
var gulp = require('gulp');
|
||||
var uglify = require('gulp-uglify');
|
||||
var clean = require('gulp-clean');
|
||||
|
||||
var FILES = [
|
||||
"src/node.js",
|
||||
"lib/_debugger.js",
|
||||
"lib/_linklist.js",
|
||||
"lib/_stream_duplex.js",
|
||||
"lib/_stream_passthrough.js",
|
||||
"lib/_stream_readable.js",
|
||||
"lib/_stream_transform.js",
|
||||
"lib/_stream_writable.js",
|
||||
"lib/assert.js",
|
||||
"lib/buffer.js",
|
||||
"lib/child_process.js",
|
||||
"lib/cluster.js",
|
||||
"lib/console.js",
|
||||
"lib/constants.js",
|
||||
"lib/crypto.js",
|
||||
"lib/dgram.js",
|
||||
"lib/dns.js",
|
||||
"lib/domain.js",
|
||||
"lib/events.js",
|
||||
"lib/freelist.js",
|
||||
"lib/fs.js",
|
||||
"lib/http.js",
|
||||
"lib/https.js",
|
||||
"lib/module.js",
|
||||
"lib/net.js",
|
||||
"lib/os.js",
|
||||
"lib/path.js",
|
||||
"lib/punycode.js",
|
||||
"lib/querystring.js",
|
||||
"lib/readline.js",
|
||||
"lib/repl.js",
|
||||
"lib/stream.js",
|
||||
"lib/string_decoder.js",
|
||||
"lib/sys.js",
|
||||
"lib/timers.js",
|
||||
"lib/tls.js",
|
||||
"lib/tty.js",
|
||||
"lib/url.js",
|
||||
"lib/util.js",
|
||||
"lib/vm.js",
|
||||
"lib/zlib.js"
|
||||
];
|
||||
|
||||
var URL = "https://raw.githubusercontent.com/joyent/node/v0.10.29/"
|
||||
|
||||
gulp.task('clean', function() {
|
||||
return gulp.src('dist', {read: false})
|
||||
.pipe(clean());
|
||||
});
|
||||
|
||||
gulp.task('nostream', ['clean'], function() {
|
||||
return remoteSrc(FILES, {
|
||||
base: URL
|
||||
})
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('dist/nostream'));
|
||||
});
|
||||
|
||||
gulp.task('stream', ['clean'], function() {
|
||||
return remoteSrc(FILES, {
|
||||
buffer: false,
|
||||
base: URL
|
||||
})
|
||||
.pipe(gulp.dest('dist/stream'));
|
||||
});
|
||||
|
||||
gulp.task('self-signed-ssl', ['clean'], function() {
|
||||
return remoteSrc(['index.html'], {
|
||||
strictSSL: false,
|
||||
base: 'https://example.com/'
|
||||
})
|
||||
.pipe(gulp.dest('dist/strictSSL'));
|
||||
});
|
||||
|
||||
// run this task alone to test timeout
|
||||
gulp.task('timeout', ['clean'], function() {
|
||||
return remoteSrc(FILES, {
|
||||
base: URL,
|
||||
timeout: 1
|
||||
})
|
||||
.pipe(gulp.dest('dist/timeout'));
|
||||
});
|
||||
|
||||
gulp.task('test', ['stream', 'nostream', 'self-signed-ssl']);
|
||||
23
node_modules/gulp-remote-src/LICENSE
generated
vendored
Normal file
23
node_modules/gulp-remote-src/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
MIT License
|
||||
===========
|
||||
|
||||
Copyright (c) 2014 Dong <ddliuhb@gmail.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.
|
||||
75
node_modules/gulp-remote-src/README.md
generated
vendored
Normal file
75
node_modules/gulp-remote-src/README.md
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# gulp-remote-src
|
||||
|
||||
[](https://travis-ci.org/ddliu/gulp-remote-src)
|
||||
|
||||
Remote `gulp.src`.
|
||||
|
||||
## Installation
|
||||
|
||||
Install package with NPM and add it to your development dependencies:
|
||||
|
||||
npm install --save-dev gulp-remote-src
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var gulp = require('gulp');
|
||||
var uglify = require('gulp-uglify');
|
||||
var remoteSrc = require('gulp-remote-src');
|
||||
|
||||
gulp.task('remote', function() {
|
||||
|
||||
remoteSrc(['app.js', 'jquery.js'], {
|
||||
base: 'http://myapps.com/assets/',
|
||||
})
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
})
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `base`
|
||||
|
||||
Url base.
|
||||
|
||||
- `buffer` (default is true)
|
||||
|
||||
Pipe out files as buffer or as stream. Note that some plugins does not support streaming.
|
||||
|
||||
## Request Options
|
||||
|
||||
`gulp-remote-src` uses [request](https://github.com/mikeal/request) to make HTTP request, you can specify below
|
||||
options to customize your request:
|
||||
|
||||
* `qs` - object containing querystring values to be appended to the `uri`
|
||||
* `headers` - http headers (default: `{}`)
|
||||
* `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
|
||||
* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise.
|
||||
* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)
|
||||
* `maxRedirects` - the maximum number of redirects to follow (default: `10`)
|
||||
* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request
|
||||
* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)
|
||||
* `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option.
|
||||
* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services)
|
||||
* `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response.
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.1.0 (2014-06-30)
|
||||
|
||||
First release.
|
||||
|
||||
### v0.2.0 (2014-07-01)
|
||||
|
||||
Fix streaming pipe.
|
||||
|
||||
Add tests for streaming pipe.
|
||||
|
||||
### v0.2.1 (2014-07-18)
|
||||
|
||||
Add option `strictSSL` (thank you [@Magomogo](https://github.com/Magomogo))
|
||||
|
||||
### v0.3.0 (2014-09-02)
|
||||
|
||||
Pass through [request](https://github.com/mikeal/request) options to make it flexible.
|
||||
77
node_modules/gulp-remote-src/index.js
generated
vendored
Normal file
77
node_modules/gulp-remote-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
var util = require('util');
|
||||
var es = require('event-stream');
|
||||
var request = require('request');
|
||||
var File = require('vinyl');
|
||||
var through2 = require('through2');
|
||||
var extend = require('node.extend');
|
||||
|
||||
module.exports = function(urls, options) {
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.base !== 'string' ) {
|
||||
options.base = '/';
|
||||
}
|
||||
|
||||
if (typeof options.buffer !== 'boolean') {
|
||||
options.buffer = true;
|
||||
}
|
||||
|
||||
if (!util.isArray(urls)) {
|
||||
urls = [urls];
|
||||
}
|
||||
|
||||
var allowedRequestOptions = ['qs', 'headers', 'auth', 'followRedirect', 'followAllRedirects', 'maxRedirects', 'timeout', 'proxy',
|
||||
'strictSSL', 'aws', 'gzip']
|
||||
|
||||
var requestBaseOptions = {};
|
||||
for (var i = allowedRequestOptions.length - 1; i >= 0; i--) {
|
||||
var k = allowedRequestOptions[i];
|
||||
if (k in options) {
|
||||
requestBaseOptions[k] = options[k];
|
||||
}
|
||||
}
|
||||
|
||||
if (options.requestOptions) {
|
||||
for (var k in options.requestOptions) {
|
||||
requestBaseOptions[k] = options.requestOptions[k];
|
||||
}
|
||||
}
|
||||
|
||||
return es.readArray(urls).pipe(es.map(function(data, cb) {
|
||||
var url = options.base + data, requestOptions = extend({url: url}, requestBaseOptions);
|
||||
|
||||
if (!options.buffer) {
|
||||
var file = new File({
|
||||
cwd: '/',
|
||||
base: options.base,
|
||||
path: url,
|
||||
// request must be piped out once created, or we'll get this error: "You cannot pipe after data has been emitted from the response."
|
||||
contents: request(requestOptions).pipe(through2())
|
||||
});
|
||||
|
||||
cb(null, file);
|
||||
} else {
|
||||
// set encoding to `null` to return the body as buffer
|
||||
requestOptions.encoding = null;
|
||||
|
||||
request(requestOptions, function(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
var file = new File({
|
||||
cwd: '/',
|
||||
base: options.base,
|
||||
path: url,
|
||||
contents: body
|
||||
});
|
||||
cb(null, file);
|
||||
} else {
|
||||
if (!error) {
|
||||
error = new Error("GET " + url + " failed with status code:" + response.statusCode);
|
||||
}
|
||||
cb(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
};
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
4
node_modules/gulp-remote-src/node_modules/event-stream/.travis.yml
generated
vendored
Normal file
4
node_modules/gulp-remote-src/node_modules/event-stream/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- "0.10"
|
||||
22
node_modules/gulp-remote-src/node_modules/event-stream/LICENCE
generated
vendored
Normal file
22
node_modules/gulp-remote-src/node_modules/event-stream/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
25
node_modules/gulp-remote-src/node_modules/event-stream/examples/pretty.js
generated
vendored
Normal file
25
node_modules/gulp-remote-src/node_modules/event-stream/examples/pretty.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
var inspect = require('util').inspect
|
||||
|
||||
if(!module.parent) {
|
||||
var es = require('..') //load event-stream
|
||||
es.pipe( //pipe joins streams together
|
||||
process.openStdin(), //open stdin
|
||||
es.split(), //split stream to break on newlines
|
||||
es.map(function (data, callback) {//turn this async function into a stream
|
||||
var j
|
||||
try {
|
||||
j = JSON.parse(data) //try to parse input into json
|
||||
} catch (err) {
|
||||
return callback(null, data) //if it fails just pass it anyway
|
||||
}
|
||||
callback(null, inspect(j)) //render it nicely
|
||||
}),
|
||||
process.stdout // pipe it to stdout !
|
||||
)
|
||||
}
|
||||
|
||||
// run this
|
||||
//
|
||||
// curl -sS registry.npmjs.org/event-stream | node pretty.js
|
||||
//
|
||||
306
node_modules/gulp-remote-src/node_modules/event-stream/index.js
generated
vendored
Normal file
306
node_modules/gulp-remote-src/node_modules/event-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
//filter will reemit the data if cb(err,pass) pass is truthy
|
||||
|
||||
// reduce is more tricky
|
||||
// maybe we want to group the reductions or emit progress updates occasionally
|
||||
// the most basic reduce just emits one 'data' event after it has recieved 'end'
|
||||
|
||||
var Stream = require('stream').Stream
|
||||
, es = exports
|
||||
, through = require('through')
|
||||
, from = require('from')
|
||||
, duplex = require('duplexer')
|
||||
, map = require('map-stream')
|
||||
, pause = require('pause-stream')
|
||||
, split = require('split')
|
||||
, pipeline = require('stream-combiner')
|
||||
, immediately = global.setImmediate || process.nextTick;
|
||||
|
||||
es.Stream = Stream //re-export Stream from core
|
||||
es.through = through
|
||||
es.from = from
|
||||
es.duplex = duplex
|
||||
es.map = map
|
||||
es.pause = pause
|
||||
es.split = split
|
||||
es.pipeline = es.connect = es.pipe = pipeline
|
||||
// merge / concat
|
||||
//
|
||||
// combine multiple streams into a single stream.
|
||||
// will emit end only once
|
||||
|
||||
es.concat = //actually this should be called concat
|
||||
es.merge = function (/*streams...*/) {
|
||||
var toMerge = [].slice.call(arguments)
|
||||
var stream = new Stream()
|
||||
stream.setMaxListeners(0) // allow adding more than 11 streams
|
||||
var endCount = 0
|
||||
stream.writable = stream.readable = true
|
||||
|
||||
toMerge.forEach(function (e) {
|
||||
e.pipe(stream, {end: false})
|
||||
var ended = false
|
||||
e.on('end', function () {
|
||||
if(ended) return
|
||||
ended = true
|
||||
endCount ++
|
||||
if(endCount == toMerge.length)
|
||||
stream.emit('end')
|
||||
})
|
||||
})
|
||||
stream.write = function (data) {
|
||||
this.emit('data', data)
|
||||
}
|
||||
stream.destroy = function () {
|
||||
toMerge.forEach(function (e) {
|
||||
if(e.destroy) e.destroy()
|
||||
})
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
// writable stream, collects all events into an array
|
||||
// and calls back when 'end' occurs
|
||||
// mainly I'm using this to test the other functions
|
||||
|
||||
es.writeArray = function (done) {
|
||||
if ('function' !== typeof done)
|
||||
throw new Error('function writeArray (done): done must be function')
|
||||
|
||||
var a = new Stream ()
|
||||
, array = [], isDone = false
|
||||
a.write = function (l) {
|
||||
array.push(l)
|
||||
}
|
||||
a.end = function () {
|
||||
isDone = true
|
||||
done(null, array)
|
||||
}
|
||||
a.writable = true
|
||||
a.readable = false
|
||||
a.destroy = function () {
|
||||
a.writable = a.readable = false
|
||||
if(isDone) return
|
||||
done(new Error('destroyed before end'), array)
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
//return a Stream that reads the properties of an object
|
||||
//respecting pause() and resume()
|
||||
|
||||
es.readArray = function (array) {
|
||||
var stream = new Stream()
|
||||
, i = 0
|
||||
, paused = false
|
||||
, ended = false
|
||||
|
||||
stream.readable = true
|
||||
stream.writable = false
|
||||
|
||||
if(!Array.isArray(array))
|
||||
throw new Error('event-stream.read expects an array')
|
||||
|
||||
stream.resume = function () {
|
||||
if(ended) return
|
||||
paused = false
|
||||
var l = array.length
|
||||
while(i < l && !paused && !ended) {
|
||||
stream.emit('data', array[i++])
|
||||
}
|
||||
if(i == l && !ended)
|
||||
ended = true, stream.readable = false, stream.emit('end')
|
||||
}
|
||||
process.nextTick(stream.resume)
|
||||
stream.pause = function () {
|
||||
paused = true
|
||||
}
|
||||
stream.destroy = function () {
|
||||
ended = true
|
||||
stream.emit('close')
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
||||
//
|
||||
// readable (asyncFunction)
|
||||
// return a stream that calls an async function while the stream is not paused.
|
||||
//
|
||||
// the function must take: (count, callback) {...
|
||||
//
|
||||
|
||||
es.readable =
|
||||
function (func, continueOnError) {
|
||||
var stream = new Stream()
|
||||
, i = 0
|
||||
, paused = false
|
||||
, ended = false
|
||||
, reading = false
|
||||
|
||||
stream.readable = true
|
||||
stream.writable = false
|
||||
|
||||
if('function' !== typeof func)
|
||||
throw new Error('event-stream.readable expects async function')
|
||||
|
||||
stream.on('end', function () { ended = true })
|
||||
|
||||
function get (err, data) {
|
||||
|
||||
if(err) {
|
||||
stream.emit('error', err)
|
||||
if(!continueOnError) stream.emit('end')
|
||||
} else if (arguments.length > 1)
|
||||
stream.emit('data', data)
|
||||
|
||||
immediately(function () {
|
||||
if(ended || paused || reading) return
|
||||
try {
|
||||
reading = true
|
||||
func.call(stream, i++, function () {
|
||||
reading = false
|
||||
get.apply(null, arguments)
|
||||
})
|
||||
} catch (err) {
|
||||
stream.emit('error', err)
|
||||
}
|
||||
})
|
||||
}
|
||||
stream.resume = function () {
|
||||
paused = false
|
||||
get()
|
||||
}
|
||||
process.nextTick(get)
|
||||
stream.pause = function () {
|
||||
paused = true
|
||||
}
|
||||
stream.destroy = function () {
|
||||
stream.emit('end')
|
||||
stream.emit('close')
|
||||
ended = true
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// map sync
|
||||
//
|
||||
|
||||
es.mapSync = function (sync) {
|
||||
return es.through(function write(data) {
|
||||
var mappedData = sync(data)
|
||||
if (typeof mappedData !== 'undefined')
|
||||
this.emit('data', mappedData)
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
// log just print out what is coming through the stream, for debugging
|
||||
//
|
||||
|
||||
es.log = function (name) {
|
||||
return es.through(function (data) {
|
||||
var args = [].slice.call(arguments)
|
||||
if(name) console.error(name, data)
|
||||
else console.error(data)
|
||||
this.emit('data', data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// child -- pipe through a child process
|
||||
//
|
||||
|
||||
es.child = function (child) {
|
||||
|
||||
return es.duplex(child.stdin, child.stdout)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// parse
|
||||
//
|
||||
// must be used after es.split() to ensure that each chunk represents a line
|
||||
// source.pipe(es.split()).pipe(es.parse())
|
||||
|
||||
es.parse = function () {
|
||||
return es.through(function (data) {
|
||||
var obj
|
||||
try {
|
||||
if(data) //ignore empty lines
|
||||
obj = JSON.parse(data.toString())
|
||||
} catch (err) {
|
||||
return console.error(err, 'attemping to parse:', data)
|
||||
}
|
||||
//ignore lines that where only whitespace.
|
||||
if(obj !== undefined)
|
||||
this.emit('data', obj)
|
||||
})
|
||||
}
|
||||
//
|
||||
// stringify
|
||||
//
|
||||
|
||||
es.stringify = function () {
|
||||
var Buffer = require('buffer').Buffer
|
||||
return es.mapSync(function (e){
|
||||
return JSON.stringify(Buffer.isBuffer(e) ? e.toString() : e) + '\n'
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
// replace a string within a stream.
|
||||
//
|
||||
// warn: just concatenates the string and then does str.split().join().
|
||||
// probably not optimal.
|
||||
// for smallish responses, who cares?
|
||||
// I need this for shadow-npm so it's only relatively small json files.
|
||||
|
||||
es.replace = function (from, to) {
|
||||
return es.pipeline(es.split(from), es.join(to))
|
||||
}
|
||||
|
||||
//
|
||||
// join chunks with a joiner. just like Array#join
|
||||
// also accepts a callback that is passed the chunks appended together
|
||||
// this is still supported for legacy reasons.
|
||||
//
|
||||
|
||||
es.join = function (str) {
|
||||
|
||||
//legacy api
|
||||
if('function' === typeof str)
|
||||
return es.wait(str)
|
||||
|
||||
var first = true
|
||||
return es.through(function (data) {
|
||||
if(!first)
|
||||
this.emit('data', str)
|
||||
first = false
|
||||
this.emit('data', data)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// wait. callback when 'end' is emitted, with all chunks appended as string.
|
||||
//
|
||||
|
||||
es.wait = function (callback) {
|
||||
var arr = []
|
||||
return es.through(function (data) { arr.push(data) },
|
||||
function () {
|
||||
var body = Buffer.isBuffer(arr[0]) ? Buffer.concat(arr)
|
||||
: arr.join('')
|
||||
this.emit('data', body)
|
||||
this.emit('end')
|
||||
if(callback) callback(null, body)
|
||||
})
|
||||
}
|
||||
|
||||
es.pipeable = function () {
|
||||
throw new Error('[EVENT-STREAM] es.pipeable is deprecated')
|
||||
}
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
*.log
|
||||
*.err
|
||||
6
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/.travis.yml
generated
vendored
Normal file
6
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
19
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/LICENCE
generated
vendored
Normal file
19
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 Raynos.
|
||||
|
||||
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.
|
||||
47
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/README.md
generated
vendored
Normal file
47
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# duplexer
|
||||
|
||||
[![build status][1]][2] [![dependency status][3]][4]
|
||||
|
||||
[![browser support][5]][6]
|
||||
|
||||
Creates a duplex stream
|
||||
|
||||
Taken from [event-stream][7]
|
||||
|
||||
## duplex (writeStream, readStream)
|
||||
|
||||
Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
|
||||
|
||||
It is assumed that the two streams are connected to each other in some way.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var grep = cp.exec('grep Stream')
|
||||
|
||||
duplex(grep.stdin, grep.stdout)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install duplexer`
|
||||
|
||||
## Tests
|
||||
|
||||
`npm test`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Dominictarr
|
||||
- Raynos
|
||||
- samccone
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[1]: https://secure.travis-ci.org/Raynos/duplexer.png
|
||||
[2]: https://travis-ci.org/Raynos/duplexer
|
||||
[3]: https://david-dm.org/Raynos/duplexer.png
|
||||
[4]: https://david-dm.org/Raynos/duplexer
|
||||
[5]: https://ci.testling.com/Raynos/duplexer.png
|
||||
[6]: https://ci.testling.com/Raynos/duplexer
|
||||
[7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
|
||||
87
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/index.js
generated
vendored
Normal file
87
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/index.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var Stream = require("stream")
|
||||
var writeMethods = ["write", "end", "destroy"]
|
||||
var readMethods = ["resume", "pause"]
|
||||
var readEvents = ["data", "close"]
|
||||
var slice = Array.prototype.slice
|
||||
|
||||
module.exports = duplex
|
||||
|
||||
function forEach (arr, fn) {
|
||||
if (arr.forEach) {
|
||||
return arr.forEach(fn)
|
||||
}
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
fn(arr[i], i)
|
||||
}
|
||||
}
|
||||
|
||||
function duplex(writer, reader) {
|
||||
var stream = new Stream()
|
||||
var ended = false
|
||||
|
||||
forEach(writeMethods, proxyWriter)
|
||||
|
||||
forEach(readMethods, proxyReader)
|
||||
|
||||
forEach(readEvents, proxyStream)
|
||||
|
||||
reader.on("end", handleEnd)
|
||||
|
||||
writer.on("drain", function() {
|
||||
stream.emit("drain")
|
||||
})
|
||||
|
||||
writer.on("error", reemit)
|
||||
reader.on("error", reemit)
|
||||
|
||||
stream.writable = writer.writable
|
||||
stream.readable = reader.readable
|
||||
|
||||
return stream
|
||||
|
||||
function proxyWriter(methodName) {
|
||||
stream[methodName] = method
|
||||
|
||||
function method() {
|
||||
return writer[methodName].apply(writer, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
function proxyReader(methodName) {
|
||||
stream[methodName] = method
|
||||
|
||||
function method() {
|
||||
stream.emit(methodName)
|
||||
var func = reader[methodName]
|
||||
if (func) {
|
||||
return func.apply(reader, arguments)
|
||||
}
|
||||
reader.emit(methodName)
|
||||
}
|
||||
}
|
||||
|
||||
function proxyStream(methodName) {
|
||||
reader.on(methodName, reemit)
|
||||
|
||||
function reemit() {
|
||||
var args = slice.call(arguments)
|
||||
args.unshift(methodName)
|
||||
stream.emit.apply(stream, args)
|
||||
}
|
||||
}
|
||||
|
||||
function handleEnd() {
|
||||
if (ended) {
|
||||
return
|
||||
}
|
||||
ended = true
|
||||
var args = slice.call(arguments)
|
||||
args.unshift("end")
|
||||
stream.emit.apply(stream, args)
|
||||
}
|
||||
|
||||
function reemit(err) {
|
||||
stream.emit("error", err)
|
||||
}
|
||||
}
|
||||
79
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/package.json
generated
vendored
Normal file
79
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "duplexer",
|
||||
"version": "0.1.1",
|
||||
"description": "Creates a duplex stream",
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Raynos/duplexer.git"
|
||||
},
|
||||
"main": "index",
|
||||
"homepage": "https://github.com/Raynos/duplexer",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jake Verbaten"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/duplexer/issues",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "0.3.3",
|
||||
"through": "~0.1.4"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/Raynos/duplexer/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/16..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest"
|
||||
]
|
||||
},
|
||||
"readme": "# duplexer\n\n[![build status][1]][2] [![dependency status][3]][4]\n\n[![browser support][5]][6]\n\nCreates a duplex stream\n\nTaken from [event-stream][7]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n```js\nvar grep = cp.exec('grep Stream')\n\nduplex(grep.stdin, grep.stdout)\n```\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`npm test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n - samccone\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: https://travis-ci.org/Raynos/duplexer\n [3]: https://david-dm.org/Raynos/duplexer.png\n [4]: https://david-dm.org/Raynos/duplexer\n [5]: https://ci.testling.com/Raynos/duplexer.png\n [6]: https://ci.testling.com/Raynos/duplexer\n [7]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream\n",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "duplexer@0.1.1",
|
||||
"dist": {
|
||||
"shasum": "ace6ff808c1ce66b57d1ebf97977acb02334cfc1",
|
||||
"tarball": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz"
|
||||
},
|
||||
"_from": "duplexer@>=0.1.1 <0.2.0",
|
||||
"_npmVersion": "1.2.18",
|
||||
"_npmUser": {
|
||||
"name": "raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "ace6ff808c1ce66b57d1ebf97977acb02334cfc1",
|
||||
"_resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz"
|
||||
}
|
||||
31
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/test/index.js
generated
vendored
Normal file
31
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/duplexer/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var through = require("through")
|
||||
var test = require("tape")
|
||||
|
||||
var duplex = require("../index")
|
||||
|
||||
var readable = through()
|
||||
var writable = through(write)
|
||||
var written = 0
|
||||
var data = 0
|
||||
|
||||
var stream = duplex(writable, readable)
|
||||
|
||||
function write() {
|
||||
written++
|
||||
}
|
||||
|
||||
stream.on("data", ondata)
|
||||
|
||||
function ondata() {
|
||||
data++
|
||||
}
|
||||
|
||||
test("emit and write", function(t) {
|
||||
t.plan(2)
|
||||
|
||||
stream.write()
|
||||
readable.emit("data")
|
||||
|
||||
t.equal(written, 1, "should have written once")
|
||||
t.equal(data, 1, "should have recived once")
|
||||
})
|
||||
1
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/.npmignore
generated
vendored
Normal file
1
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
15
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/LICENSE.APACHE2
generated
vendored
Normal file
15
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/LICENSE.APACHE2
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
24
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/LICENSE.MIT
generated
vendored
Normal file
24
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/LICENSE.MIT
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
68
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/index.js
generated
vendored
Normal file
68
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/index.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var Stream = require('stream')
|
||||
|
||||
// from
|
||||
//
|
||||
// a stream that reads from an source.
|
||||
// source may be an array, or a function.
|
||||
// from handles pause behaviour for you.
|
||||
|
||||
module.exports =
|
||||
function from (source) {
|
||||
if(Array.isArray(source)) {
|
||||
source = source.slice()
|
||||
return from (function (i) {
|
||||
if(source.length)
|
||||
this.emit('data', source.shift())
|
||||
else
|
||||
this.emit('end')
|
||||
return true
|
||||
})
|
||||
}
|
||||
var s = new Stream(), i = 0
|
||||
s.ended = false
|
||||
s.started = false
|
||||
s.readable = true
|
||||
s.writable = false
|
||||
s.paused = false
|
||||
s.ended = false
|
||||
s.pause = function () {
|
||||
s.started = true
|
||||
s.paused = true
|
||||
}
|
||||
function next () {
|
||||
s.started = true
|
||||
if(s.ended) return
|
||||
while(!s.ended && !s.paused && source.call(s, i++, function () {
|
||||
if(!s.ended && !s.paused)
|
||||
next()
|
||||
}))
|
||||
;
|
||||
}
|
||||
s.resume = function () {
|
||||
s.started = true
|
||||
s.paused = false
|
||||
next()
|
||||
}
|
||||
s.on('end', function () {
|
||||
s.ended = true
|
||||
s.readable = false
|
||||
process.nextTick(s.destroy)
|
||||
})
|
||||
s.destroy = function () {
|
||||
s.ended = true
|
||||
s.emit('close')
|
||||
}
|
||||
/*
|
||||
by default, the stream will start emitting at nextTick
|
||||
if you want, you can pause it, after pipeing.
|
||||
you can also resume before next tick, and that will also
|
||||
work.
|
||||
*/
|
||||
process.nextTick(function () {
|
||||
if(!s.started) s.resume()
|
||||
})
|
||||
return s
|
||||
}
|
||||
56
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/package.json
generated
vendored
Normal file
56
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "from",
|
||||
"version": "0.1.3",
|
||||
"description": "Easy way to make a Readable Stream",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "asynct test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/from.git"
|
||||
},
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams",
|
||||
"readable",
|
||||
"easy"
|
||||
],
|
||||
"devDependencies": {
|
||||
"asynct": "1",
|
||||
"stream-spec": "0",
|
||||
"assertions": "~2.3.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "dominictarr.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"readme": "# from\n\nAn easy way to create a `readable Stream`.\n\n## from(function getChunk(count, next))\n\nfrom takes a `getChunk` function and returns a stream. \n\n`getChunk` is called again and again, after each time the user calls `next()`, \nuntil the user emits `'end'`\n\nif `pause()` is called, the `getChunk` won't be called again untill `resume()` is called.\n\n\n```js\nvar from = require('from')\n\nvar stream = \n from(function getChunk(count, next) {\n //do some sort of data\n this.emit('data', whatever)\n \n if(itsOver)\n this.emit('end')\n\n //ready to handle the next chunk\n next()\n //or, if it's sync:\n return true \n })\n```\n\n## from(array)\n\nfrom also takes an `Array` whose elements it emits one after another.\n\n## License\nMIT / Apache2\n",
|
||||
"readmeFilename": "readme.markdown",
|
||||
"_id": "from@0.1.3",
|
||||
"dist": {
|
||||
"shasum": "ef63ac2062ac32acf7862e0d40b44b896f22f3bc",
|
||||
"tarball": "http://registry.npmjs.org/from/-/from-0.1.3.tgz"
|
||||
},
|
||||
"_from": "from@>=0.0.0 <1.0.0",
|
||||
"_npmVersion": "1.2.3",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "ef63ac2062ac32acf7862e0d40b44b896f22f3bc",
|
||||
"_resolved": "https://registry.npmjs.org/from/-/from-0.1.3.tgz",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/from/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dominictarr/from#readme"
|
||||
}
|
||||
38
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/readme.markdown
generated
vendored
Normal file
38
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# from
|
||||
|
||||
An easy way to create a `readable Stream`.
|
||||
|
||||
## from(function getChunk(count, next))
|
||||
|
||||
from takes a `getChunk` function and returns a stream.
|
||||
|
||||
`getChunk` is called again and again, after each time the user calls `next()`,
|
||||
until the user emits `'end'`
|
||||
|
||||
if `pause()` is called, the `getChunk` won't be called again untill `resume()` is called.
|
||||
|
||||
|
||||
```js
|
||||
var from = require('from')
|
||||
|
||||
var stream =
|
||||
from(function getChunk(count, next) {
|
||||
//do some sort of data
|
||||
this.emit('data', whatever)
|
||||
|
||||
if(itsOver)
|
||||
this.emit('end')
|
||||
|
||||
//ready to handle the next chunk
|
||||
next()
|
||||
//or, if it's sync:
|
||||
return true
|
||||
})
|
||||
```
|
||||
|
||||
## from(array)
|
||||
|
||||
from also takes an `Array` whose elements it emits one after another.
|
||||
|
||||
## License
|
||||
MIT / Apache2
|
||||
141
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/test/index.js
generated
vendored
Normal file
141
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/from/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
var from = require('..')
|
||||
var spec = require('stream-spec')
|
||||
var a = require('assertions')
|
||||
|
||||
function read(stream, callback) {
|
||||
var actual = []
|
||||
stream.on('data', function (data) {
|
||||
actual.push(data)
|
||||
})
|
||||
stream.once('end', function () {
|
||||
callback(null, actual)
|
||||
})
|
||||
stream.once('error', function (err) {
|
||||
callback(err)
|
||||
})
|
||||
}
|
||||
|
||||
function pause(stream) {
|
||||
stream.on('data', function () {
|
||||
if(Math.random() > 0.1) return
|
||||
stream.pause()
|
||||
process.nextTick(function () {
|
||||
stream.resume()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
exports['inc'] = function (test) {
|
||||
|
||||
var fs = from(function (i) {
|
||||
this.emit('data', i)
|
||||
if(i >= 99)
|
||||
return this.emit('end')
|
||||
return true
|
||||
})
|
||||
|
||||
spec(fs).readable().validateOnExit()
|
||||
|
||||
read(fs, function (err, arr) {
|
||||
test.equal(arr.length, 100)
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
|
||||
exports['simple'] = function (test) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = from(expected.slice())
|
||||
|
||||
spec(t)
|
||||
.readable()
|
||||
.pausable({strict: true})
|
||||
.validateOnExit()
|
||||
|
||||
read(t, function (err, actual) {
|
||||
if(err) test.error(err) //fail
|
||||
a.deepEqual(actual, expected)
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports['simple pausable'] = function (test) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = from(expected.slice())
|
||||
|
||||
spec(t)
|
||||
.readable()
|
||||
.pausable({strict: true})
|
||||
.validateOnExit()
|
||||
|
||||
pause(t)
|
||||
|
||||
read(t, function (err, actual) {
|
||||
if(err) test.error(err) //fail
|
||||
a.deepEqual(actual, expected)
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports['simple (not strictly pausable) setTimeout'] = function (test) {
|
||||
|
||||
var l = 10
|
||||
, expected = []
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
|
||||
var _expected = expected.slice()
|
||||
var t = from(function (i, n) {
|
||||
var self = this
|
||||
setTimeout(function () {
|
||||
if(_expected.length)
|
||||
self.emit('data', _expected.shift())
|
||||
else
|
||||
self.emit('end')
|
||||
n()
|
||||
}, 3)
|
||||
})
|
||||
|
||||
/*
|
||||
using from in this way will not be strictly pausable.
|
||||
it could be extended to buffer outputs, but I think a better
|
||||
way would be to use a PauseStream that implements strict pause.
|
||||
*/
|
||||
|
||||
spec(t)
|
||||
.readable()
|
||||
.pausable({strict: false })
|
||||
.validateOnExit()
|
||||
|
||||
//pause(t)
|
||||
var paused = false
|
||||
var i = setInterval(function () {
|
||||
if(!paused) t.pause()
|
||||
else t.resume()
|
||||
paused = !paused
|
||||
}, 2)
|
||||
|
||||
t.on('end', function () {
|
||||
clearInterval(i)
|
||||
})
|
||||
|
||||
read(t, function (err, actual) {
|
||||
if(err) test.error(err) //fail
|
||||
a.deepEqual(actual, expected)
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/.travis.yml
generated
vendored
Normal file
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/LICENCE
generated
vendored
Normal file
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
26
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/examples/pretty.js
generated
vendored
Normal file
26
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/examples/pretty.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
var inspect = require('util').inspect
|
||||
|
||||
if(!module.parent) {
|
||||
var map = require('..') //load map-stream
|
||||
var es = require('event-stream') //load event-stream
|
||||
es.pipe( //pipe joins streams together
|
||||
process.openStdin(), //open stdin
|
||||
es.split(), //split stream to break on newlines
|
||||
map(function (data, callback) { //turn this async function into a stream
|
||||
var j
|
||||
try {
|
||||
j = JSON.parse(data) //try to parse input into json
|
||||
} catch (err) {
|
||||
return callback(null, data) //if it fails just pass it anyway
|
||||
}
|
||||
callback(null, inspect(j)) //render it nicely
|
||||
}),
|
||||
process.stdout // pipe it to stdout !
|
||||
)
|
||||
}
|
||||
|
||||
// run this
|
||||
//
|
||||
// curl -sS registry.npmjs.org/event-stream | node pretty.js
|
||||
//
|
||||
145
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/index.js
generated
vendored
Normal file
145
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
//filter will reemit the data if cb(err,pass) pass is truthy
|
||||
|
||||
// reduce is more tricky
|
||||
// maybe we want to group the reductions or emit progress updates occasionally
|
||||
// the most basic reduce just emits one 'data' event after it has recieved 'end'
|
||||
|
||||
|
||||
var Stream = require('stream').Stream
|
||||
|
||||
|
||||
//create an event stream and apply function to each .write
|
||||
//emitting each response as data
|
||||
//unless it's an empty callback
|
||||
|
||||
module.exports = function (mapper, opts) {
|
||||
|
||||
var stream = new Stream()
|
||||
, self = this
|
||||
, inputs = 0
|
||||
, outputs = 0
|
||||
, ended = false
|
||||
, paused = false
|
||||
, destroyed = false
|
||||
, lastWritten = 0
|
||||
, inNext = false
|
||||
|
||||
this.opts = opts || {};
|
||||
var errorEventName = this.opts.failures ? 'failure' : 'error';
|
||||
|
||||
// Items that are not ready to be written yet (because they would come out of
|
||||
// order) get stuck in a queue for later.
|
||||
var writeQueue = {}
|
||||
|
||||
stream.writable = true
|
||||
stream.readable = true
|
||||
|
||||
function queueData (data, number) {
|
||||
var nextToWrite = lastWritten + 1
|
||||
|
||||
if (number === nextToWrite) {
|
||||
// If it's next, and its not undefined write it
|
||||
if (data !== undefined) {
|
||||
stream.emit.apply(stream, ['data', data])
|
||||
}
|
||||
lastWritten ++
|
||||
nextToWrite ++
|
||||
} else {
|
||||
// Otherwise queue it for later.
|
||||
writeQueue[number] = data
|
||||
}
|
||||
|
||||
// If the next value is in the queue, write it
|
||||
if (writeQueue.hasOwnProperty(nextToWrite)) {
|
||||
var dataToWrite = writeQueue[nextToWrite]
|
||||
delete writeQueue[nextToWrite]
|
||||
return queueData(dataToWrite, nextToWrite)
|
||||
}
|
||||
|
||||
outputs ++
|
||||
if(inputs === outputs) {
|
||||
if(paused) paused = false, stream.emit('drain') //written all the incoming events
|
||||
if(ended) end()
|
||||
}
|
||||
}
|
||||
|
||||
function next (err, data, number) {
|
||||
if(destroyed) return
|
||||
inNext = true
|
||||
|
||||
if (!err || self.opts.failures) {
|
||||
queueData(data, number)
|
||||
}
|
||||
|
||||
if (err) {
|
||||
stream.emit.apply(stream, [ errorEventName, err ]);
|
||||
}
|
||||
|
||||
inNext = false;
|
||||
}
|
||||
|
||||
// Wrap the mapper function by calling its callback with the order number of
|
||||
// the item in the stream.
|
||||
function wrappedMapper (input, number, callback) {
|
||||
return mapper.call(null, input, function(err, data){
|
||||
callback(err, data, number)
|
||||
})
|
||||
}
|
||||
|
||||
stream.write = function (data) {
|
||||
if(ended) throw new Error('map stream is not writable')
|
||||
inNext = false
|
||||
inputs ++
|
||||
|
||||
try {
|
||||
//catch sync errors and handle them like async errors
|
||||
var written = wrappedMapper(data, inputs, next)
|
||||
paused = (written === false)
|
||||
return !paused
|
||||
} catch (err) {
|
||||
//if the callback has been called syncronously, and the error
|
||||
//has occured in an listener, throw it again.
|
||||
if(inNext)
|
||||
throw err
|
||||
next(err)
|
||||
return !paused
|
||||
}
|
||||
}
|
||||
|
||||
function end (data) {
|
||||
//if end was called with args, write it,
|
||||
ended = true //write will emit 'end' if ended is true
|
||||
stream.writable = false
|
||||
if(data !== undefined) {
|
||||
return queueData(data, inputs)
|
||||
} else if (inputs == outputs) { //wait for processing
|
||||
stream.readable = false, stream.emit('end'), stream.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
stream.end = function (data) {
|
||||
if(ended) return
|
||||
end()
|
||||
}
|
||||
|
||||
stream.destroy = function () {
|
||||
ended = destroyed = true
|
||||
stream.writable = stream.readable = paused = false
|
||||
process.nextTick(function () {
|
||||
stream.emit('close')
|
||||
})
|
||||
}
|
||||
stream.pause = function () {
|
||||
paused = true
|
||||
}
|
||||
|
||||
stream.resume = function () {
|
||||
paused = false
|
||||
}
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
51
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/package.json
generated
vendored
Normal file
51
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "map-stream",
|
||||
"version": "0.1.0",
|
||||
"description": "construct pipes of streams of events",
|
||||
"homepage": "http://github.com/dominictarr/map-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/map-stream.git"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"asynct": "*",
|
||||
"it-is": "1",
|
||||
"ubelt": "~2.9",
|
||||
"stream-spec": "~0.2",
|
||||
"event-stream": "~2.1",
|
||||
"from": "0.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "asynct test/"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "http://dominictarr.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/map-stream/issues"
|
||||
},
|
||||
"_id": "map-stream@0.1.0",
|
||||
"dist": {
|
||||
"shasum": "e56aa94c4c8055a16404a0674b78f215f7c8e194",
|
||||
"tarball": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz"
|
||||
},
|
||||
"_from": "map-stream@>=0.1.0 <0.2.0",
|
||||
"_npmVersion": "1.3.21",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "e56aa94c4c8055a16404a0674b78f215f7c8e194",
|
||||
"_resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
37
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/readme.markdown
generated
vendored
Normal file
37
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# MapStream
|
||||
|
||||
Refactored out of [event-stream](https://github.com/dominictarr/event-stream)
|
||||
|
||||
##map (asyncFunction[, options])
|
||||
|
||||
Create a through stream from an asyncronous function.
|
||||
|
||||
``` js
|
||||
var map = require('map-stream')
|
||||
|
||||
map(function (data, callback) {
|
||||
//transform data
|
||||
// ...
|
||||
callback(null, data)
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
Each map MUST call the callback. It may callback with data, with an error or with no arguments,
|
||||
|
||||
* `callback()` drop this data.
|
||||
this makes the map work like `filter`,
|
||||
note:`callback(null,null)` is not the same, and will emit `null`
|
||||
|
||||
* `callback(null, newData)` turn data into newData
|
||||
|
||||
* `callback(error)` emit an error for this item.
|
||||
|
||||
>Note: if a callback is not called, `map` will think that it is still being processed,
|
||||
>every call must be answered or the stream will not know when to end.
|
||||
>
|
||||
>Also, if the callback is called more than once, every call but the first will be ignored.
|
||||
|
||||
##Options
|
||||
|
||||
* `failures` - `boolean` continue mapping even if error occured. On error `map-stream` will emit `failure` event. (default: `false`)
|
||||
318
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/test/simple-map.asynct.js
generated
vendored
Normal file
318
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/map-stream/test/simple-map.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
'use strict';
|
||||
|
||||
var map = require('../')
|
||||
, it = require('it-is')
|
||||
, u = require('ubelt')
|
||||
, spec = require('stream-spec')
|
||||
, from = require('from')
|
||||
, Stream = require('stream')
|
||||
, es = require('event-stream')
|
||||
|
||||
//REFACTOR THIS TEST TO USE es.readArray and es.writeArray
|
||||
|
||||
function writeArray(array, stream) {
|
||||
|
||||
array.forEach( function (j) {
|
||||
stream.write(j)
|
||||
})
|
||||
stream.end()
|
||||
|
||||
}
|
||||
|
||||
function readStream(stream, done) {
|
||||
|
||||
var array = []
|
||||
stream.on('data', function (data) {
|
||||
array.push(data)
|
||||
})
|
||||
stream.on('error', done)
|
||||
stream.on('end', function (data) {
|
||||
done(null, array)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//call sink on each write,
|
||||
//and complete when finished.
|
||||
|
||||
function pauseStream (prob, delay) {
|
||||
var pauseIf = (
|
||||
'number' == typeof prob
|
||||
? function () {
|
||||
return Math.random() < prob
|
||||
}
|
||||
: 'function' == typeof prob
|
||||
? prob
|
||||
: 0.1
|
||||
)
|
||||
var delayer = (
|
||||
!delay
|
||||
? process.nextTick
|
||||
: 'number' == typeof delay
|
||||
? function (next) { setTimeout(next, delay) }
|
||||
: delay
|
||||
)
|
||||
|
||||
return es.through(function (data) {
|
||||
if(!this.paused && pauseIf()) {
|
||||
console.log('PAUSE STREAM PAUSING')
|
||||
this.pause()
|
||||
var self = this
|
||||
delayer(function () {
|
||||
console.log('PAUSE STREAM RESUMING')
|
||||
self.resume()
|
||||
})
|
||||
}
|
||||
console.log("emit ('data', " + data + ')')
|
||||
this.emit('data', data)
|
||||
})
|
||||
}
|
||||
|
||||
exports ['simple map applied to a stream'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
//create event stream from
|
||||
|
||||
var doubler = map(function (data, cb) {
|
||||
cb(null, data * 2)
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
//a map is only a middle man, so it is both readable and writable
|
||||
|
||||
it(doubler).has({
|
||||
readable: true,
|
||||
writable: true,
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
// process.nextTick(x.validate)
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
exports ['stream comes back in the correct order'] = function (test) {
|
||||
var input = [3, 2, 1]
|
||||
|
||||
var delayer = map(function(data, cb){
|
||||
setTimeout(function () {
|
||||
cb(null, data)
|
||||
}, 100 * data)
|
||||
})
|
||||
|
||||
readStream(delayer, function (err, output) {
|
||||
it(output).deepEqual(input)
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, delayer)
|
||||
}
|
||||
|
||||
exports ['continues on error event with failures `true`'] = function (test) {
|
||||
var input = [1, 2, 3]
|
||||
|
||||
var delayer = map(function(data, cb){
|
||||
cb(new Error('Something gone wrong'), data)
|
||||
}, { failures: true })
|
||||
|
||||
readStream(delayer, function (err, output) {
|
||||
it(output).deepEqual(input)
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, delayer)
|
||||
}
|
||||
|
||||
exports['pipe two maps together'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
//create event stream from
|
||||
function dd (data, cb) {
|
||||
cb(null, data * 2)
|
||||
}
|
||||
var doubler1 = map(dd), doubler2 = map(dd)
|
||||
|
||||
doubler1.pipe(doubler2)
|
||||
|
||||
spec(doubler1).through().validateOnExit()
|
||||
spec(doubler2).through().validateOnExit()
|
||||
|
||||
readStream(doubler2, function (err, output) {
|
||||
it(output).deepEqual(input.map(function (j) {
|
||||
return j * 4
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, doubler1)
|
||||
|
||||
}
|
||||
|
||||
//next:
|
||||
//
|
||||
// test pause, resume and drian.
|
||||
//
|
||||
|
||||
// then make a pipe joiner:
|
||||
//
|
||||
// plumber (evStr1, evStr2, evStr3, evStr4, evStr5)
|
||||
//
|
||||
// will return a single stream that write goes to the first
|
||||
|
||||
exports ['map will not call end until the callback'] = function (test) {
|
||||
|
||||
var ticker = map(function (data, cb) {
|
||||
process.nextTick(function () {
|
||||
cb(null, data * 2)
|
||||
})
|
||||
})
|
||||
|
||||
spec(ticker).through().validateOnExit()
|
||||
|
||||
ticker.write('x')
|
||||
ticker.end()
|
||||
|
||||
ticker.on('end', function () {
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
|
||||
exports ['emit failures with opts.failures === `ture`'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, mapper =
|
||||
map(function () {
|
||||
throw err
|
||||
}, { failures: true })
|
||||
|
||||
mapper.on('failure', function (_err) {
|
||||
it(_err).equal(err)
|
||||
test.done()
|
||||
})
|
||||
|
||||
mapper.write('hello')
|
||||
|
||||
}
|
||||
|
||||
exports ['emit error thrown'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, mapper =
|
||||
map(function () {
|
||||
throw err
|
||||
})
|
||||
|
||||
mapper.on('error', function (_err) {
|
||||
it(_err).equal(err)
|
||||
test.done()
|
||||
})
|
||||
|
||||
mapper.write('hello')
|
||||
|
||||
}
|
||||
|
||||
exports ['emit error calledback'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, mapper =
|
||||
map(function (data, callback) {
|
||||
callback(err)
|
||||
})
|
||||
|
||||
mapper.on('error', function (_err) {
|
||||
it(_err).equal(err)
|
||||
test.done()
|
||||
})
|
||||
|
||||
mapper.write('hello')
|
||||
|
||||
}
|
||||
|
||||
exports ['do not emit drain if not paused'] = function (test) {
|
||||
|
||||
var maps = map(function (data, callback) {
|
||||
u.delay(callback)(null, 1)
|
||||
return true
|
||||
})
|
||||
|
||||
spec(maps).through().pausable().validateOnExit()
|
||||
|
||||
maps.on('drain', function () {
|
||||
it(false).ok('should not emit drain unless the stream is paused')
|
||||
})
|
||||
|
||||
it(maps.write('hello')).equal(true)
|
||||
it(maps.write('hello')).equal(true)
|
||||
it(maps.write('hello')).equal(true)
|
||||
setTimeout(function () {maps.end()},10)
|
||||
maps.on('end', test.done)
|
||||
}
|
||||
|
||||
exports ['emits drain if paused, when all '] = function (test) {
|
||||
var active = 0
|
||||
var drained = false
|
||||
var maps = map(function (data, callback) {
|
||||
active ++
|
||||
u.delay(function () {
|
||||
active --
|
||||
callback(null, 1)
|
||||
})()
|
||||
console.log('WRITE', false)
|
||||
return false
|
||||
})
|
||||
|
||||
spec(maps).through().validateOnExit()
|
||||
|
||||
maps.on('drain', function () {
|
||||
drained = true
|
||||
it(active).equal(0, 'should emit drain when all maps are done')
|
||||
})
|
||||
|
||||
it(maps.write('hello')).equal(false)
|
||||
it(maps.write('hello')).equal(false)
|
||||
it(maps.write('hello')).equal(false)
|
||||
|
||||
process.nextTick(function () {maps.end()},10)
|
||||
|
||||
maps.on('end', function () {
|
||||
console.log('end')
|
||||
it(drained).ok('shoud have emitted drain before end')
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports ['map applied to a stream with filtering'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
|
||||
var doubler = map(function (data, callback) {
|
||||
if (data % 2)
|
||||
callback(null, data * 2)
|
||||
else
|
||||
callback()
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.filter(function (j) {
|
||||
return j % 2
|
||||
}).map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
231
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/LICENSE
generated
vendored
Normal file
231
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
Dual Licensed MIT and Apache 2
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2013 Dominic Tarr
|
||||
|
||||
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.
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright (c) 2013 Dominic Tarr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/index.js
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
//through@2 handles this by default!
|
||||
module.exports = require('through')
|
||||
|
||||
64
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/package.json
generated
vendored
Normal file
64
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "pause-stream",
|
||||
"version": "0.0.11",
|
||||
"description": "a ThroughStream that strictly buffers all readable events when paused.",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"stream-tester": "0.0.2",
|
||||
"stream-spec": "~0.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/index.js && node test/pause-end.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/pause-stream.git"
|
||||
},
|
||||
"keywords": [
|
||||
"stream",
|
||||
"pipe",
|
||||
"pause",
|
||||
"drain",
|
||||
"buffer"
|
||||
],
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "dominictarr.com"
|
||||
},
|
||||
"license": [
|
||||
"MIT",
|
||||
"Apache2"
|
||||
],
|
||||
"dependencies": {
|
||||
"through": "~2.3"
|
||||
},
|
||||
"readme": "# PauseStream\n\nThis is a `Stream` that will strictly buffer when paused.\nConnect it to anything you need buffered.\n\n``` js\n var ps = require('pause-stream')();\n\n badlyBehavedStream.pipe(ps.pause())\n\n aLittleLater(function (err, data) {\n ps.pipe(createAnotherStream(data))\n ps.resume()\n })\n```\n\n`PauseStream` will buffer whenever paused.\nit will buffer when yau have called `pause` manually.\nbut also when it's downstream `dest.write()===false`.\nit will attempt to drain the buffer when you call resume\nor the downstream emits `'drain'`\n\n`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)\nand [stream-tester](https://github.com/dominictarr/stream-tester)\n\nThis is now the default case of \n[through](https://github.com/dominictarr/through)\n\nhttps://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0\n",
|
||||
"readmeFilename": "readme.markdown",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/pause-stream/issues"
|
||||
},
|
||||
"_id": "pause-stream@0.0.11",
|
||||
"dist": {
|
||||
"shasum": "fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445",
|
||||
"tarball": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz"
|
||||
},
|
||||
"_from": "pause-stream@0.0.11",
|
||||
"_npmVersion": "1.3.6",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"_shasum": "fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445",
|
||||
"_resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
|
||||
"homepage": "https://github.com/dominictarr/pause-stream#readme"
|
||||
}
|
||||
29
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/readme.markdown
generated
vendored
Normal file
29
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# PauseStream
|
||||
|
||||
This is a `Stream` that will strictly buffer when paused.
|
||||
Connect it to anything you need buffered.
|
||||
|
||||
``` js
|
||||
var ps = require('pause-stream')();
|
||||
|
||||
badlyBehavedStream.pipe(ps.pause())
|
||||
|
||||
aLittleLater(function (err, data) {
|
||||
ps.pipe(createAnotherStream(data))
|
||||
ps.resume()
|
||||
})
|
||||
```
|
||||
|
||||
`PauseStream` will buffer whenever paused.
|
||||
it will buffer when yau have called `pause` manually.
|
||||
but also when it's downstream `dest.write()===false`.
|
||||
it will attempt to drain the buffer when you call resume
|
||||
or the downstream emits `'drain'`
|
||||
|
||||
`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)
|
||||
and [stream-tester](https://github.com/dominictarr/stream-tester)
|
||||
|
||||
This is now the default case of
|
||||
[through](https://github.com/dominictarr/through)
|
||||
|
||||
https://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0
|
||||
17
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/test/index.js
generated
vendored
Normal file
17
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var spec = require('stream-spec')
|
||||
var tester = require('stream-tester')
|
||||
var ps = require('..')()
|
||||
|
||||
spec(ps)
|
||||
.through({strict: false})
|
||||
.validateOnExit()
|
||||
|
||||
var master = tester.createConsistent
|
||||
|
||||
tester.createRandomStream(1000) //1k random numbers
|
||||
.pipe(master = tester.createConsistentStream())
|
||||
.pipe(tester.createUnpauseStream())
|
||||
.pipe(ps)
|
||||
.pipe(tester.createPauseStream())
|
||||
.pipe(master.createSlave())
|
||||
|
||||
33
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/test/pause-end.js
generated
vendored
Normal file
33
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/pause-stream/test/pause-end.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
var pause = require('..')
|
||||
var assert = require('assert')
|
||||
|
||||
var ps = pause()
|
||||
var read = [], ended = false
|
||||
|
||||
ps.on('data', function (i) {
|
||||
read.push(i)
|
||||
})
|
||||
|
||||
ps.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
assert.deepEqual(read, [])
|
||||
|
||||
ps.write(0)
|
||||
ps.write(1)
|
||||
ps.write(2)
|
||||
|
||||
assert.deepEqual(read, [0, 1, 2])
|
||||
|
||||
ps.pause()
|
||||
|
||||
assert.deepEqual(read, [0, 1, 2])
|
||||
|
||||
ps.end()
|
||||
assert.equal(ended, false)
|
||||
ps.resume()
|
||||
assert.equal(ended, true)
|
||||
|
||||
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/.travis.yml
generated
vendored
Normal file
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- "0.10"
|
||||
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/LICENCE
generated
vendored
Normal file
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
26
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/examples/pretty.js
generated
vendored
Normal file
26
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/examples/pretty.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
var inspect = require('util').inspect
|
||||
var es = require('event-stream') //load event-stream
|
||||
var split = require('../')
|
||||
|
||||
if(!module.parent) {
|
||||
es.pipe( //pipe joins streams together
|
||||
process.openStdin(), //open stdin
|
||||
split(), //split stream to break on newlines
|
||||
es.map(function (data, callback) {//turn this async function into a stream
|
||||
var j
|
||||
try {
|
||||
j = JSON.parse(data) //try to parse input into json
|
||||
} catch (err) {
|
||||
return callback(null, data) //if it fails just pass it anyway
|
||||
}
|
||||
callback(null, inspect(j)) //render it nicely
|
||||
}),
|
||||
process.stdout // pipe it to stdout !
|
||||
)
|
||||
}
|
||||
|
||||
// run this
|
||||
//
|
||||
// curl -sS registry.npmjs.org/event-stream | node pretty.js
|
||||
//
|
||||
59
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/index.js
generated
vendored
Normal file
59
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
//filter will reemit the data if cb(err,pass) pass is truthy
|
||||
|
||||
// reduce is more tricky
|
||||
// maybe we want to group the reductions or emit progress updates occasionally
|
||||
// the most basic reduce just emits one 'data' event after it has recieved 'end'
|
||||
|
||||
|
||||
var through = require('through')
|
||||
var Decoder = require('string_decoder').StringDecoder
|
||||
|
||||
module.exports = split
|
||||
|
||||
//TODO pass in a function to map across the lines.
|
||||
|
||||
function split (matcher, mapper) {
|
||||
var decoder = new Decoder()
|
||||
var soFar = ''
|
||||
if('function' === typeof matcher)
|
||||
mapper = matcher, matcher = null
|
||||
if (!matcher)
|
||||
matcher = /\r?\n/
|
||||
|
||||
function emit(stream, piece) {
|
||||
if(mapper) {
|
||||
try {
|
||||
piece = mapper(piece)
|
||||
}
|
||||
catch (err) {
|
||||
return stream.emit('error', err)
|
||||
}
|
||||
if('undefined' !== typeof piece)
|
||||
stream.queue(piece)
|
||||
}
|
||||
else
|
||||
stream.queue(piece)
|
||||
}
|
||||
|
||||
function next (stream, buffer) {
|
||||
var pieces = (soFar + buffer).split(matcher)
|
||||
soFar = pieces.pop()
|
||||
|
||||
for (var i = 0; i < pieces.length; i++) {
|
||||
var piece = pieces[i]
|
||||
emit(stream, piece)
|
||||
}
|
||||
}
|
||||
|
||||
return through(function (b) {
|
||||
next(this, decoder.write(b))
|
||||
},
|
||||
function () {
|
||||
if(decoder.end)
|
||||
next(this, decoder.end())
|
||||
if(soFar != null)
|
||||
emit(this, soFar)
|
||||
this.queue(null)
|
||||
})
|
||||
}
|
||||
|
||||
56
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/package.json
generated
vendored
Normal file
56
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "split",
|
||||
"version": "0.2.10",
|
||||
"description": "split a Text Stream into a Line Stream",
|
||||
"homepage": "http://github.com/dominictarr/split",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/split.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"through": "2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"asynct": "*",
|
||||
"it-is": "1",
|
||||
"ubelt": "~2.9",
|
||||
"stream-spec": "~0.2",
|
||||
"event-stream": "~3.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "asynct test/"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "http://bit.ly/dominictarr"
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/split/issues"
|
||||
},
|
||||
"_id": "split@0.2.10",
|
||||
"dist": {
|
||||
"shasum": "67097c601d697ce1368f418f06cd201cf0521a57",
|
||||
"tarball": "http://registry.npmjs.org/split/-/split-0.2.10.tgz"
|
||||
},
|
||||
"_from": "split@>=0.2.0 <0.3.0",
|
||||
"_npmVersion": "1.3.6",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "67097c601d697ce1368f418f06cd201cf0521a57",
|
||||
"_resolved": "https://registry.npmjs.org/split/-/split-0.2.10.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
39
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/readme.markdown
generated
vendored
Normal file
39
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# Split (matcher)
|
||||
|
||||
[](http://travis-ci.org/dominictarr/split)
|
||||
|
||||
Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp`
|
||||
|
||||
Example, read every line in a file ...
|
||||
|
||||
``` js
|
||||
fs.createReadStream(file)
|
||||
.pipe(split())
|
||||
.on('data', function (line) {
|
||||
//each chunk now is a seperate line!
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
`split` takes the same arguments as `string.split` except it defaults to '/\r?\n/' instead of ',', and the optional `limit` paremeter is ignored.
|
||||
[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
|
||||
|
||||
# NDJ - Newline Delimited Json
|
||||
|
||||
`split` accepts a function which transforms each line.
|
||||
|
||||
``` js
|
||||
fs.createReadStream(file)
|
||||
.pipe(split(JSON.parse))
|
||||
.on('data', function (obj) {
|
||||
//each chunk now is a a js object
|
||||
})
|
||||
.on('error', function (err) {
|
||||
//syntax errors will land here
|
||||
//note, this ends the stream.
|
||||
})
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
34
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/partitioned_unicode.js
generated
vendored
Normal file
34
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/partitioned_unicode.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var it = require('it-is').style('colour')
|
||||
, split = require('..')
|
||||
|
||||
exports ['split data with partitioned unicode character'] = function (test) {
|
||||
var s = split(/,/g)
|
||||
, caughtError = false
|
||||
, rows = []
|
||||
|
||||
s.on('error', function (err) {
|
||||
caughtError = true
|
||||
})
|
||||
|
||||
s.on('data', function (row) { rows.push(row) })
|
||||
|
||||
var x = 'テスト試験今日とても,よい天気で'
|
||||
unicodeData = new Buffer(x);
|
||||
|
||||
// partition of 日
|
||||
piece1 = unicodeData.slice(0, 20);
|
||||
piece2 = unicodeData.slice(20, unicodeData.length);
|
||||
|
||||
s.write(piece1);
|
||||
s.write(piece2);
|
||||
|
||||
s.end()
|
||||
|
||||
it(caughtError).equal(false)
|
||||
|
||||
it(rows).deepEqual(['テスト試験今日とても', 'よい天気で']);
|
||||
|
||||
it(rows).deepEqual(x.split(','))
|
||||
|
||||
test.done()
|
||||
}
|
||||
85
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/split.asynct.js
generated
vendored
Normal file
85
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/split.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
var es = require('event-stream')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
, split = require('..')
|
||||
, join = require('path').join
|
||||
, fs = require('fs')
|
||||
, Stream = require('stream').Stream
|
||||
, spec = require('stream-spec')
|
||||
|
||||
exports ['split() works like String#split'] = function (test) {
|
||||
var readme = join(__filename)
|
||||
, expected = fs.readFileSync(readme, 'utf-8').split('\n')
|
||||
, cs = split()
|
||||
, actual = []
|
||||
, ended = false
|
||||
, x = spec(cs).through()
|
||||
|
||||
var a = new Stream ()
|
||||
|
||||
a.write = function (l) {
|
||||
actual.push(l.trim())
|
||||
}
|
||||
a.end = function () {
|
||||
|
||||
ended = true
|
||||
expected.forEach(function (v,k) {
|
||||
//String.split will append an empty string ''
|
||||
//if the string ends in a split pattern.
|
||||
//es.split doesn't which was breaking this test.
|
||||
//clearly, appending the empty string is correct.
|
||||
//tests are passing though. which is the current job.
|
||||
if(v)
|
||||
it(actual[k]).like(v)
|
||||
})
|
||||
//give the stream time to close
|
||||
process.nextTick(function () {
|
||||
test.done()
|
||||
x.validate()
|
||||
})
|
||||
}
|
||||
a.writable = true
|
||||
|
||||
fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
|
||||
cs.pipe(a)
|
||||
|
||||
}
|
||||
|
||||
exports ['split() takes mapper function'] = function (test) {
|
||||
var readme = join(__filename)
|
||||
, expected = fs.readFileSync(readme, 'utf-8').split('\n')
|
||||
, cs = split(function (line) { return line.toUpperCase() })
|
||||
, actual = []
|
||||
, ended = false
|
||||
, x = spec(cs).through()
|
||||
|
||||
var a = new Stream ()
|
||||
|
||||
a.write = function (l) {
|
||||
actual.push(l.trim())
|
||||
}
|
||||
a.end = function () {
|
||||
|
||||
ended = true
|
||||
expected.forEach(function (v,k) {
|
||||
//String.split will append an empty string ''
|
||||
//if the string ends in a split pattern.
|
||||
//es.split doesn't which was breaking this test.
|
||||
//clearly, appending the empty string is correct.
|
||||
//tests are passing though. which is the current job.
|
||||
if(v)
|
||||
it(actual[k]).equal(v.trim().toUpperCase())
|
||||
})
|
||||
//give the stream time to close
|
||||
process.nextTick(function () {
|
||||
test.done()
|
||||
x.validate()
|
||||
})
|
||||
}
|
||||
a.writable = true
|
||||
|
||||
fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
|
||||
cs.pipe(a)
|
||||
|
||||
}
|
||||
|
||||
51
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/try_catch.asynct.js
generated
vendored
Normal file
51
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/split/test/try_catch.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
var it = require('it-is').style('colour')
|
||||
, split = require('..')
|
||||
|
||||
exports ['emit mapper exceptions as error events'] = function (test) {
|
||||
var s = split(JSON.parse)
|
||||
, caughtError = false
|
||||
, rows = []
|
||||
|
||||
s.on('error', function (err) {
|
||||
caughtError = true
|
||||
})
|
||||
|
||||
s.on('data', function (row) { rows.push(row) })
|
||||
|
||||
s.write('{"a":1}\n{"')
|
||||
it(caughtError).equal(false)
|
||||
it(rows).deepEqual([ { a: 1 } ])
|
||||
|
||||
s.write('b":2}\n{"c":}\n')
|
||||
it(caughtError).equal(true)
|
||||
it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
|
||||
|
||||
s.end()
|
||||
test.done()
|
||||
}
|
||||
|
||||
exports ['mapper error events on trailing chunks'] = function (test) {
|
||||
var s = split(JSON.parse)
|
||||
, caughtError = false
|
||||
, rows = []
|
||||
|
||||
s.on('error', function (err) {
|
||||
caughtError = true
|
||||
})
|
||||
|
||||
s.on('data', function (row) { rows.push(row) })
|
||||
|
||||
s.write('{"a":1}\n{"')
|
||||
it(caughtError).equal(false)
|
||||
it(rows).deepEqual([ { a: 1 } ])
|
||||
|
||||
s.write('b":2}\n{"c":}')
|
||||
it(caughtError).equal(false)
|
||||
it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
|
||||
|
||||
s.end()
|
||||
it(caughtError).equal(true)
|
||||
it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
|
||||
|
||||
test.done()
|
||||
}
|
||||
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/.npmignore
generated
vendored
Normal file
3
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
node_modules/*
|
||||
npm_debug.log
|
||||
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/.travis.yml
generated
vendored
Normal file
4
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/LICENSE
generated
vendored
Normal file
22
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 'Dominic Tarr'
|
||||
|
||||
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.
|
||||
29
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/README.md
generated
vendored
Normal file
29
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/README.md
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# stream-combiner
|
||||
|
||||
<img src=https://secure.travis-ci.org/dominictarr/stream-combiner.png?branch=master>
|
||||
|
||||
## Combine (stream1,...,streamN)
|
||||
|
||||
Turn a pipeline into a single stream. `pipeline` returns a stream that writes to the first stream
|
||||
and reads from the last stream.
|
||||
|
||||
Listening for 'error' will recieve errors from all streams inside the pipe.
|
||||
|
||||
``` js
|
||||
var Combine = require('stream-combiner')
|
||||
var es = require('event-stream')
|
||||
|
||||
Combine( //connect streams together with `pipe`
|
||||
process.openStdin(), //open stdin
|
||||
es.split(), //split stream to break on newlines
|
||||
es.map(function (data, callback) {//turn this async function into a stream
|
||||
callback(null
|
||||
, inspect(JSON.parse(data))) //render it nicely
|
||||
}),
|
||||
process.stdout // pipe it to stdout !
|
||||
)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
39
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/index.js
generated
vendored
Normal file
39
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var duplexer = require('duplexer')
|
||||
|
||||
module.exports = function () {
|
||||
|
||||
var streams = [].slice.call(arguments)
|
||||
, first = streams[0]
|
||||
, last = streams[streams.length - 1]
|
||||
, thepipe = duplexer(first, last)
|
||||
|
||||
if(streams.length == 1)
|
||||
return streams[0]
|
||||
else if (!streams.length)
|
||||
throw new Error('connect called with empty args')
|
||||
|
||||
//pipe all the streams together
|
||||
|
||||
function recurse (streams) {
|
||||
if(streams.length < 2)
|
||||
return
|
||||
streams[0].pipe(streams[1])
|
||||
recurse(streams.slice(1))
|
||||
}
|
||||
|
||||
recurse(streams)
|
||||
|
||||
function onerror () {
|
||||
var args = [].slice.call(arguments)
|
||||
args.unshift('error')
|
||||
thepipe.emit.apply(thepipe, args)
|
||||
}
|
||||
|
||||
//es.duplex already reemits the error from the first and last stream.
|
||||
//add a listener for the inner streams in the pipeline.
|
||||
for(var i = 1; i < streams.length - 1; i ++)
|
||||
streams[i].on('error', onerror)
|
||||
|
||||
return thepipe
|
||||
}
|
||||
|
||||
50
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/package.json
generated
vendored
Normal file
50
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "stream-combiner",
|
||||
"version": "0.0.4",
|
||||
"homepage": "https://github.com/dominictarr/stream-combiner",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/stream-combiner.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"duplexer": "~0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.0",
|
||||
"event-stream": "~3.0.7"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "set -e; for t in test/*.js; do node $t; done"
|
||||
},
|
||||
"author": {
|
||||
"name": "'Dominic Tarr'",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "http://dominictarr.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "<img src=https://secure.travis-ci.org/dominictarr/stream-combiner.png?branch=master>",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/stream-combiner/issues"
|
||||
},
|
||||
"_id": "stream-combiner@0.0.4",
|
||||
"dist": {
|
||||
"shasum": "4d5e433c185261dde623ca3f44c586bcf5c4ad14",
|
||||
"tarball": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz"
|
||||
},
|
||||
"_from": "stream-combiner@>=0.0.4 <0.1.0",
|
||||
"_npmVersion": "1.3.11",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "4d5e433c185261dde623ca3f44c586bcf5c4ad14",
|
||||
"_resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
52
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/test/index.js
generated
vendored
Normal file
52
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/stream-combiner/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
var es = require('event-stream')
|
||||
var combine = require('..')
|
||||
var test = require('tape')
|
||||
|
||||
test('do not duplicate errors', function (test) {
|
||||
|
||||
var errors = 0;
|
||||
var pipe = combine(
|
||||
es.through(function(data) {
|
||||
return this.emit('data', data);
|
||||
}),
|
||||
es.through(function(data) {
|
||||
return this.emit('error', new Error(data));
|
||||
})
|
||||
)
|
||||
|
||||
pipe.on('error', function(err) {
|
||||
errors++
|
||||
test.ok(errors, 'expected error count')
|
||||
process.nextTick(function () {
|
||||
return test.end();
|
||||
})
|
||||
})
|
||||
|
||||
return pipe.write('meh');
|
||||
})
|
||||
|
||||
test('3 pipe do not duplicate errors', function (test) {
|
||||
|
||||
var errors = 0;
|
||||
var pipe = combine(
|
||||
es.through(function(data) {
|
||||
return this.emit('data', data);
|
||||
}),
|
||||
es.through(function(data) {
|
||||
return this.emit('error', new Error(data));
|
||||
}),
|
||||
es.through()
|
||||
)
|
||||
|
||||
pipe.on('error', function(err) {
|
||||
errors++
|
||||
test.ok(errors, 'expected error count')
|
||||
process.nextTick(function () {
|
||||
return test.end();
|
||||
})
|
||||
})
|
||||
|
||||
return pipe.write('meh');
|
||||
|
||||
})
|
||||
|
||||
5
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/.travis.yml
generated
vendored
Normal file
5
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
- "0.10"
|
||||
15
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/LICENSE.APACHE2
generated
vendored
Normal file
15
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/LICENSE.APACHE2
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
24
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/LICENSE.MIT
generated
vendored
Normal file
24
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/LICENSE.MIT
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
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.
|
||||
108
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/index.js
generated
vendored
Normal file
108
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/index.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
var Stream = require('stream')
|
||||
|
||||
// through
|
||||
//
|
||||
// a stream that does nothing but re-emit the input.
|
||||
// useful for aggregating a series of changing but not ending streams into one stream)
|
||||
|
||||
exports = module.exports = through
|
||||
through.through = through
|
||||
|
||||
//create a readable writable stream.
|
||||
|
||||
function through (write, end, opts) {
|
||||
write = write || function (data) { this.queue(data) }
|
||||
end = end || function () { this.queue(null) }
|
||||
|
||||
var ended = false, destroyed = false, buffer = [], _ended = false
|
||||
var stream = new Stream()
|
||||
stream.readable = stream.writable = true
|
||||
stream.paused = false
|
||||
|
||||
// stream.autoPause = !(opts && opts.autoPause === false)
|
||||
stream.autoDestroy = !(opts && opts.autoDestroy === false)
|
||||
|
||||
stream.write = function (data) {
|
||||
write.call(this, data)
|
||||
return !stream.paused
|
||||
}
|
||||
|
||||
function drain() {
|
||||
while(buffer.length && !stream.paused) {
|
||||
var data = buffer.shift()
|
||||
if(null === data)
|
||||
return stream.emit('end')
|
||||
else
|
||||
stream.emit('data', data)
|
||||
}
|
||||
}
|
||||
|
||||
stream.queue = stream.push = function (data) {
|
||||
// console.error(ended)
|
||||
if(_ended) return stream
|
||||
if(data === null) _ended = true
|
||||
buffer.push(data)
|
||||
drain()
|
||||
return stream
|
||||
}
|
||||
|
||||
//this will be registered as the first 'end' listener
|
||||
//must call destroy next tick, to make sure we're after any
|
||||
//stream piped from here.
|
||||
//this is only a problem if end is not emitted synchronously.
|
||||
//a nicer way to do this is to make sure this is the last listener for 'end'
|
||||
|
||||
stream.on('end', function () {
|
||||
stream.readable = false
|
||||
if(!stream.writable && stream.autoDestroy)
|
||||
process.nextTick(function () {
|
||||
stream.destroy()
|
||||
})
|
||||
})
|
||||
|
||||
function _end () {
|
||||
stream.writable = false
|
||||
end.call(stream)
|
||||
if(!stream.readable && stream.autoDestroy)
|
||||
stream.destroy()
|
||||
}
|
||||
|
||||
stream.end = function (data) {
|
||||
if(ended) return
|
||||
ended = true
|
||||
if(arguments.length) stream.write(data)
|
||||
_end() // will emit or queue
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.destroy = function () {
|
||||
if(destroyed) return
|
||||
destroyed = true
|
||||
ended = true
|
||||
buffer.length = 0
|
||||
stream.writable = stream.readable = false
|
||||
stream.emit('close')
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.pause = function () {
|
||||
if(stream.paused) return
|
||||
stream.paused = true
|
||||
return stream
|
||||
}
|
||||
|
||||
stream.resume = function () {
|
||||
if(stream.paused) {
|
||||
stream.paused = false
|
||||
stream.emit('resume')
|
||||
}
|
||||
drain()
|
||||
//may have become paused again,
|
||||
//as drain emits 'data'.
|
||||
if(!stream.paused)
|
||||
stream.emit('drain')
|
||||
return stream
|
||||
}
|
||||
return stream
|
||||
}
|
||||
|
||||
66
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/package.json
generated
vendored
Normal file
66
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/package.json
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "through",
|
||||
"version": "2.3.8",
|
||||
"description": "simplified stream construction",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "set -e; for t in test/*.js; do node $t; done"
|
||||
},
|
||||
"devDependencies": {
|
||||
"stream-spec": "~0.3.5",
|
||||
"tape": "~2.3.2",
|
||||
"from": "~0.1.3"
|
||||
},
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams",
|
||||
"user-streams",
|
||||
"pipe"
|
||||
],
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "dominictarr.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dominictarr/through.git"
|
||||
},
|
||||
"homepage": "https://github.com/dominictarr/through",
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"ff/15..latest",
|
||||
"chrome/20..latest",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"gitHead": "2c5a6f9a0cc54da759b6e10964f2081c358e49dc",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/through/issues"
|
||||
},
|
||||
"_id": "through@2.3.8",
|
||||
"_shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5",
|
||||
"_from": "through@>=2.3.1 <2.4.0",
|
||||
"_npmVersion": "2.12.0",
|
||||
"_nodeVersion": "2.3.1",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5",
|
||||
"tarball": "http://registry.npmjs.org/through/-/through-2.3.8.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
64
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/readme.markdown
generated
vendored
Normal file
64
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
#through
|
||||
|
||||
[](http://travis-ci.org/dominictarr/through)
|
||||
[](https://ci.testling.com/dominictarr/through)
|
||||
|
||||
Easy way to create a `Stream` that is both `readable` and `writable`.
|
||||
|
||||
* Pass in optional `write` and `end` methods.
|
||||
* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.
|
||||
* Use `this.pause()` and `this.resume()` to manage flow.
|
||||
* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).
|
||||
|
||||
This function is the basis for most of the synchronous streams in
|
||||
[event-stream](http://github.com/dominictarr/event-stream).
|
||||
|
||||
``` js
|
||||
var through = require('through')
|
||||
|
||||
through(function write(data) {
|
||||
this.queue(data) //data *must* not be null
|
||||
},
|
||||
function end () { //optional
|
||||
this.queue(null)
|
||||
})
|
||||
```
|
||||
|
||||
Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`,
|
||||
and this.emit('end')
|
||||
|
||||
``` js
|
||||
var through = require('through')
|
||||
|
||||
through(function write(data) {
|
||||
this.emit('data', data)
|
||||
//this.pause()
|
||||
},
|
||||
function end () { //optional
|
||||
this.emit('end')
|
||||
})
|
||||
```
|
||||
|
||||
## Extended Options
|
||||
|
||||
You will probably not need these 99% of the time.
|
||||
|
||||
### autoDestroy=false
|
||||
|
||||
By default, `through` emits close when the writable
|
||||
and readable side of the stream has ended.
|
||||
If that is not desired, set `autoDestroy=false`.
|
||||
|
||||
``` js
|
||||
var through = require('through')
|
||||
|
||||
//like this
|
||||
var ts = through(write, end, {autoDestroy: false})
|
||||
//or like this
|
||||
var ts = through(write, end)
|
||||
ts.autoDestroy = false
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT / Apache2
|
||||
28
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/async.js
generated
vendored
Normal file
28
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/async.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var from = require('from')
|
||||
var through = require('../')
|
||||
|
||||
var tape = require('tape')
|
||||
|
||||
tape('simple async example', function (t) {
|
||||
|
||||
var n = 0, expected = [1,2,3,4,5], actual = []
|
||||
from(expected)
|
||||
.pipe(through(function(data) {
|
||||
this.pause()
|
||||
n ++
|
||||
setTimeout(function(){
|
||||
console.log('pushing data', data)
|
||||
this.push(data)
|
||||
this.resume()
|
||||
}.bind(this), 300)
|
||||
})).pipe(through(function(data) {
|
||||
console.log('pushing data second time', data);
|
||||
this.push(data)
|
||||
})).on('data', function (d) {
|
||||
actual.push(d)
|
||||
}).on('end', function() {
|
||||
t.deepEqual(actual, expected)
|
||||
t.end()
|
||||
})
|
||||
|
||||
})
|
||||
30
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/auto-destroy.js
generated
vendored
Normal file
30
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/auto-destroy.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('end before close', function (assert) {
|
||||
var ts = through()
|
||||
ts.autoDestroy = false
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
assert.ok(!closed)
|
||||
ended = true
|
||||
})
|
||||
ts.on('close', function () {
|
||||
assert.ok(ended)
|
||||
closed = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.ok(ended)
|
||||
assert.notOk(closed)
|
||||
ts.destroy()
|
||||
assert.ok(closed)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
71
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/buffering.js
generated
vendored
Normal file
71
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/buffering.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('buffering', function(assert) {
|
||||
var ts = through(function (data) {
|
||||
this.queue(data)
|
||||
}, function () {
|
||||
this.queue(null)
|
||||
})
|
||||
|
||||
var ended = false, actual = []
|
||||
|
||||
ts.on('data', actual.push.bind(actual))
|
||||
ts.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
assert.deepEqual(actual, [1, 2, 3])
|
||||
ts.pause()
|
||||
ts.write(4)
|
||||
ts.write(5)
|
||||
ts.write(6)
|
||||
assert.deepEqual(actual, [1, 2, 3])
|
||||
ts.resume()
|
||||
assert.deepEqual(actual, [1, 2, 3, 4, 5, 6])
|
||||
ts.pause()
|
||||
ts.end()
|
||||
assert.ok(!ended)
|
||||
ts.resume()
|
||||
assert.ok(ended)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test('buffering has data in queue, when ends', function (assert) {
|
||||
|
||||
/*
|
||||
* If stream ends while paused with data in the queue,
|
||||
* stream should still emit end after all data is written
|
||||
* on resume.
|
||||
*/
|
||||
|
||||
var ts = through(function (data) {
|
||||
this.queue(data)
|
||||
}, function () {
|
||||
this.queue(null)
|
||||
})
|
||||
|
||||
var ended = false, actual = []
|
||||
|
||||
ts.on('data', actual.push.bind(actual))
|
||||
ts.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.pause()
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.deepEqual(actual, [], 'no data written yet, still paused')
|
||||
assert.ok(!ended, 'end not emitted yet, still paused')
|
||||
ts.resume()
|
||||
assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered')
|
||||
assert.ok(ended, 'end should be emitted once all data was delivered')
|
||||
assert.end();
|
||||
})
|
||||
45
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/end.js
generated
vendored
Normal file
45
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/end.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var test = require('tape')
|
||||
var through = require('../')
|
||||
|
||||
// must emit end before close.
|
||||
|
||||
test('end before close', function (assert) {
|
||||
var ts = through()
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
assert.ok(!closed)
|
||||
ended = true
|
||||
})
|
||||
ts.on('close', function () {
|
||||
assert.ok(ended)
|
||||
closed = true
|
||||
})
|
||||
|
||||
ts.write(1)
|
||||
ts.write(2)
|
||||
ts.write(3)
|
||||
ts.end()
|
||||
assert.ok(ended)
|
||||
assert.ok(closed)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
test('end only once', function (t) {
|
||||
|
||||
var ts = through()
|
||||
var ended = false, closed = false
|
||||
|
||||
ts.on('end', function () {
|
||||
t.equal(ended, false)
|
||||
ended = true
|
||||
})
|
||||
|
||||
ts.queue(null)
|
||||
ts.queue(null)
|
||||
ts.queue(null)
|
||||
|
||||
ts.resume()
|
||||
|
||||
t.end()
|
||||
})
|
||||
133
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/index.js
generated
vendored
Normal file
133
node_modules/gulp-remote-src/node_modules/event-stream/node_modules/through/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
|
||||
var test = require('tape')
|
||||
var spec = require('stream-spec')
|
||||
var through = require('../')
|
||||
|
||||
/*
|
||||
I'm using these two functions, and not streams and pipe
|
||||
so there is less to break. if this test fails it must be
|
||||
the implementation of _through_
|
||||
*/
|
||||
|
||||
function write(array, stream) {
|
||||
array = array.slice()
|
||||
function next() {
|
||||
while(array.length)
|
||||
if(stream.write(array.shift()) === false)
|
||||
return stream.once('drain', next)
|
||||
|
||||
stream.end()
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
function read(stream, callback) {
|
||||
var actual = []
|
||||
stream.on('data', function (data) {
|
||||
actual.push(data)
|
||||
})
|
||||
stream.once('end', function () {
|
||||
callback(null, actual)
|
||||
})
|
||||
stream.once('error', function (err) {
|
||||
callback(err)
|
||||
})
|
||||
}
|
||||
|
||||
test('simple defaults', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = through()
|
||||
var s = spec(t).through().pausable()
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected)
|
||||
assert.end()
|
||||
})
|
||||
|
||||
t.on('close', s.validate)
|
||||
|
||||
write(expected, t)
|
||||
});
|
||||
|
||||
test('simple functions', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l * Math.random())
|
||||
|
||||
var t = through(function (data) {
|
||||
this.emit('data', data*2)
|
||||
})
|
||||
var s = spec(t).through().pausable()
|
||||
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected.map(function (data) {
|
||||
return data*2
|
||||
}))
|
||||
assert.end()
|
||||
})
|
||||
|
||||
t.on('close', s.validate)
|
||||
|
||||
write(expected, t)
|
||||
})
|
||||
|
||||
test('pauses', function(assert) {
|
||||
|
||||
var l = 1000
|
||||
, expected = []
|
||||
|
||||
while(l--) expected.push(l) //Math.random())
|
||||
|
||||
var t = through()
|
||||
|
||||
var s = spec(t)
|
||||
.through()
|
||||
.pausable()
|
||||
|
||||
t.on('data', function () {
|
||||
if(Math.random() > 0.1) return
|
||||
t.pause()
|
||||
process.nextTick(function () {
|
||||
t.resume()
|
||||
})
|
||||
})
|
||||
|
||||
read(t, function (err, actual) {
|
||||
assert.ifError(err)
|
||||
assert.deepEqual(actual, expected)
|
||||
})
|
||||
|
||||
t.on('close', function () {
|
||||
s.validate()
|
||||
assert.end()
|
||||
})
|
||||
|
||||
write(expected, t)
|
||||
})
|
||||
|
||||
test('does not soft-end on `undefined`', function(assert) {
|
||||
var stream = through()
|
||||
, count = 0
|
||||
|
||||
stream.on('data', function (data) {
|
||||
count++
|
||||
})
|
||||
|
||||
stream.write(undefined)
|
||||
stream.write(undefined)
|
||||
|
||||
assert.equal(count, 2)
|
||||
|
||||
assert.end()
|
||||
})
|
||||
79
node_modules/gulp-remote-src/node_modules/event-stream/package.json
generated
vendored
Normal file
79
node_modules/gulp-remote-src/node_modules/event-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "event-stream",
|
||||
"version": "3.1.7",
|
||||
"description": "construct pipes of streams of events",
|
||||
"homepage": "http://github.com/dominictarr/event-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/event-stream.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"through": "~2.3.1",
|
||||
"duplexer": "~0.1.1",
|
||||
"from": "~0",
|
||||
"map-stream": "~0.1.0",
|
||||
"pause-stream": "0.0.11",
|
||||
"split": "0.2",
|
||||
"stream-combiner": "~0.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"asynct": "*",
|
||||
"it-is": "1",
|
||||
"ubelt": "~3.2.2",
|
||||
"stream-spec": "~0.3.5",
|
||||
"tape": "~2.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "asynct test/",
|
||||
"test_tap": "set -e; for t in test/*.js; do node $t; done"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": {
|
||||
"ie": [
|
||||
8,
|
||||
9
|
||||
],
|
||||
"firefox": [
|
||||
13
|
||||
],
|
||||
"chrome": [
|
||||
20
|
||||
],
|
||||
"safari": [
|
||||
5.1
|
||||
],
|
||||
"opera": [
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"name": "Dominic Tarr",
|
||||
"email": "dominic.tarr@gmail.com",
|
||||
"url": "http://bit.ly/dominictarr"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dominictarr/event-stream/issues"
|
||||
},
|
||||
"_id": "event-stream@3.1.7",
|
||||
"_shasum": "b4c540012d0fe1498420f3d8946008db6393c37a",
|
||||
"_from": "event-stream@>=3.1.5 <3.2.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dominictarr",
|
||||
"email": "dominic.tarr@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "b4c540012d0fe1498420f3d8946008db6393c37a",
|
||||
"tarball": "http://registry.npmjs.org/event-stream/-/event-stream-3.1.7.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.1.7.tgz"
|
||||
}
|
||||
298
node_modules/gulp-remote-src/node_modules/event-stream/readme.markdown
generated
vendored
Normal file
298
node_modules/gulp-remote-src/node_modules/event-stream/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
# EventStream
|
||||
|
||||
<img src=https://secure.travis-ci.org/dominictarr/event-stream.png?branch=master>
|
||||
|
||||
[]
|
||||
(http://ci.testling.com/dominictarr/event-stream)
|
||||
|
||||
[Streams](http://nodejs.org/api/stream.html "Stream") are node's best and most misunderstood idea, and
|
||||
_<em>EventStream</em>_ is a toolkit to make creating and working with streams <em>easy</em>.
|
||||
|
||||
Normally, streams are only used for IO,
|
||||
but in event stream we send all kinds of objects down the pipe.
|
||||
If your application's <em>input</em> and <em>output</em> are streams,
|
||||
shouldn't the <em>throughput</em> be a stream too?
|
||||
|
||||
The *EventStream* functions resemble the array functions,
|
||||
because Streams are like Arrays, but laid out in time, rather than in memory.
|
||||
|
||||
<em>All the `event-stream` functions return instances of `Stream`</em>.
|
||||
|
||||
`event-stream` creates
|
||||
[0.8 streams](https://github.com/joyent/node/blob/v0.8/doc/api/stream.markdown)
|
||||
, which are compatible with [0.10 streams](http://nodejs.org/api/stream.html "Stream")
|
||||
|
||||
>NOTE: I shall use the term <em>"through stream"</em> to refer to a stream that is writable <em>and</em> readable.
|
||||
|
||||
###[simple example](https://github.com/dominictarr/event-stream/blob/master/examples/pretty.js):
|
||||
|
||||
``` js
|
||||
|
||||
//pretty.js
|
||||
|
||||
if(!module.parent) {
|
||||
var es = require('event-stream')
|
||||
var inspect = require('util').inspect
|
||||
|
||||
process.stdin //connect streams together with `pipe`
|
||||
.pipe(es.split()) //split stream to break on newlines
|
||||
.pipe(es.map(function (data, cb) { //turn this async function into a stream
|
||||
cb(null
|
||||
, inspect(JSON.parse(data))) //render it nicely
|
||||
}))
|
||||
.pipe(process.stdout) // pipe it to stdout !
|
||||
}
|
||||
```
|
||||
run it ...
|
||||
|
||||
``` bash
|
||||
curl -sS registry.npmjs.org/event-stream | node pretty.js
|
||||
```
|
||||
|
||||
[node Stream documentation](http://nodejs.org/api/stream.html)
|
||||
|
||||
## through (write?, end?)
|
||||
|
||||
Re-emits data synchronously. Easy way to create synchronous through streams.
|
||||
Pass in optional `write` and `end` methods. They will be called in the
|
||||
context of the stream. Use `this.pause()` and `this.resume()` to manage flow.
|
||||
Check `this.paused` to see current flow state. (write always returns `!this.paused`)
|
||||
|
||||
this function is the basis for most of the synchronous streams in `event-stream`.
|
||||
|
||||
``` js
|
||||
|
||||
es.through(function write(data) {
|
||||
this.emit('data', data)
|
||||
//this.pause()
|
||||
},
|
||||
function end () { //optional
|
||||
this.emit('end')
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
##map (asyncFunction)
|
||||
|
||||
Create a through stream from an asynchronous function.
|
||||
|
||||
``` js
|
||||
var es = require('event-stream')
|
||||
|
||||
es.map(function (data, callback) {
|
||||
//transform data
|
||||
// ...
|
||||
callback(null, data)
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
Each map MUST call the callback. It may callback with data, with an error or with no arguments,
|
||||
|
||||
* `callback()` drop this data.
|
||||
this makes the map work like `filter`,
|
||||
note:`callback(null,null)` is not the same, and will emit `null`
|
||||
|
||||
* `callback(null, newData)` turn data into newData
|
||||
|
||||
* `callback(error)` emit an error for this item.
|
||||
|
||||
>Note: if a callback is not called, `map` will think that it is still being processed,
|
||||
>every call must be answered or the stream will not know when to end.
|
||||
>
|
||||
>Also, if the callback is called more than once, every call but the first will be ignored.
|
||||
|
||||
## mapSync (syncFunction)
|
||||
|
||||
Same as `map`, but the callback is called synchronously. Based on `es.through`
|
||||
|
||||
## split (matcher)
|
||||
|
||||
Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp`
|
||||
|
||||
Example, read every line in a file ...
|
||||
|
||||
``` js
|
||||
fs.createReadStream(file, {flags: 'r'})
|
||||
.pipe(es.split())
|
||||
.pipe(es.map(function (line, cb) {
|
||||
//do something with the line
|
||||
cb(null, line)
|
||||
}))
|
||||
```
|
||||
|
||||
`split` takes the same arguments as `string.split` except it defaults to '\n' instead of ',', and the optional `limit` parameter is ignored.
|
||||
[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
|
||||
|
||||
## join (separator)
|
||||
|
||||
Create a through stream that emits `separator` between each chunk, just like Array#join.
|
||||
|
||||
(for legacy reasons, if you pass a callback instead of a string, join is a synonym for `es.wait`)
|
||||
|
||||
## merge (stream1,...,streamN)
|
||||
> concat → merge
|
||||
|
||||
Merges streams into one and returns it.
|
||||
Incoming data will be emitted as soon it comes into - no ordering will be applied (for example: `data1 data1 data2 data1 data2` - where `data1` and `data2` is data from two streams).
|
||||
Counts how many streams was passed to it and emits end only when all streams emitted end.
|
||||
|
||||
```js
|
||||
es.merge(
|
||||
process.stdout,
|
||||
process.stderr
|
||||
).pipe(fs.createWriteStream('output.log'));
|
||||
```
|
||||
|
||||
## replace (from, to)
|
||||
|
||||
Replace all occurrences of `from` with `to`. `from` may be a `String` or a `RegExp`.
|
||||
Works just like `string.split(from).join(to)`, but streaming.
|
||||
|
||||
|
||||
## parse
|
||||
|
||||
Convenience function for parsing JSON chunks. For newline separated JSON,
|
||||
use with `es.split`
|
||||
|
||||
``` js
|
||||
fs.createReadStream(filename)
|
||||
.pipe(es.split()) //defaults to lines.
|
||||
.pipe(es.parse())
|
||||
```
|
||||
|
||||
## stringify
|
||||
|
||||
convert javascript objects into lines of text. The text will have whitespace escaped and have a `\n` appended, so it will be compatible with `es.parse`
|
||||
|
||||
``` js
|
||||
objectStream
|
||||
.pipe(es.stringify())
|
||||
.pipe(fs.createWriteStream(filename))
|
||||
```
|
||||
|
||||
##readable (asyncFunction)
|
||||
|
||||
create a readable stream (that respects pause) from an async function.
|
||||
while the stream is not paused,
|
||||
the function will be polled with `(count, callback)`,
|
||||
and `this` will be the readable stream.
|
||||
|
||||
``` js
|
||||
|
||||
es.readable(function (count, callback) {
|
||||
if(streamHasEnded)
|
||||
return this.emit('end')
|
||||
|
||||
//...
|
||||
|
||||
this.emit('data', data) //use this way to emit multiple chunks per call.
|
||||
|
||||
callback() // you MUST always call the callback eventually.
|
||||
// the function will not be called again until you do this.
|
||||
})
|
||||
```
|
||||
you can also pass the data and the error to the callback.
|
||||
you may only call the callback once.
|
||||
calling the same callback more than once will have no effect.
|
||||
|
||||
##readArray (array)
|
||||
|
||||
Create a readable stream from an Array.
|
||||
|
||||
Just emit each item as a data event, respecting `pause` and `resume`.
|
||||
|
||||
``` js
|
||||
var es = require('event-stream')
|
||||
, reader = es.readArray([1,2,3])
|
||||
|
||||
reader.pipe(...)
|
||||
```
|
||||
|
||||
## writeArray (callback)
|
||||
|
||||
create a writeable stream from a callback,
|
||||
all `data` events are stored in an array, which is passed to the callback when the stream ends.
|
||||
|
||||
``` js
|
||||
var es = require('event-stream')
|
||||
, reader = es.readArray([1, 2, 3])
|
||||
, writer = es.writeArray(function (err, array){
|
||||
//array deepEqual [1, 2, 3]
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
```
|
||||
|
||||
## pause ()
|
||||
|
||||
A stream that buffers all chunks when paused.
|
||||
|
||||
|
||||
``` js
|
||||
var ps = es.pause()
|
||||
ps.pause() //buffer the stream, also do not allow 'end'
|
||||
ps.resume() //allow chunks through
|
||||
```
|
||||
|
||||
## duplex (writeStream, readStream)
|
||||
|
||||
Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
|
||||
|
||||
It is assumed that the two streams are connected to each other in some way.
|
||||
|
||||
(This is used by `pipeline` and `child`.)
|
||||
|
||||
``` js
|
||||
var grep = cp.exec('grep Stream')
|
||||
|
||||
es.duplex(grep.stdin, grep.stdout)
|
||||
```
|
||||
|
||||
## child (child_process)
|
||||
|
||||
Create a through stream from a child process ...
|
||||
|
||||
``` js
|
||||
var cp = require('child_process')
|
||||
|
||||
es.child(cp.exec('grep Stream')) // a through stream
|
||||
|
||||
```
|
||||
|
||||
## wait (callback)
|
||||
|
||||
waits for stream to emit 'end'.
|
||||
joins chunks of a stream into a single string.
|
||||
takes an optional callback, which will be passed the
|
||||
complete string when it receives the 'end' event.
|
||||
|
||||
also, emits a single 'data' event.
|
||||
|
||||
``` js
|
||||
|
||||
readStream.pipe(es.wait(function (err, text) {
|
||||
// have complete text here.
|
||||
}))
|
||||
|
||||
```
|
||||
|
||||
# Other Stream Modules
|
||||
|
||||
These modules are not included as a part of *EventStream* but may be
|
||||
useful when working with streams.
|
||||
|
||||
## [reduce (syncFunction, initial)](https://github.com/parshap/node-stream-reduce)
|
||||
|
||||
Like `Array.prototype.reduce` but for streams. Given a sync reduce
|
||||
function and an initial value it will return a through stream that emits
|
||||
a single data event with the reduced value once the input stream ends.
|
||||
|
||||
``` js
|
||||
var reduce = require("stream-reduce");
|
||||
process.stdin.pipe(reduce(function(acc, data) {
|
||||
return acc + data.length;
|
||||
}, 0)).on("data", function(length) {
|
||||
console.log("stdin size:", length);
|
||||
});
|
||||
```
|
||||
86
node_modules/gulp-remote-src/node_modules/event-stream/test/connect.asynct.js
generated
vendored
Normal file
86
node_modules/gulp-remote-src/node_modules/event-stream/test/connect.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
|
||||
function makeExamplePipe() {
|
||||
|
||||
return es.connect(
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data * 2)
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
d.delay(callback)(null, data)
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data + 2)
|
||||
}))
|
||||
}
|
||||
|
||||
exports['simple pipe'] = function (test) {
|
||||
|
||||
var pipe = makeExamplePipe()
|
||||
|
||||
pipe.on('data', function (data) {
|
||||
it(data).equal(18)
|
||||
test.done()
|
||||
})
|
||||
|
||||
pipe.write(8)
|
||||
|
||||
}
|
||||
|
||||
exports['read array then map'] = function (test) {
|
||||
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
, first = es.readArray(readThis)
|
||||
, read = []
|
||||
, pipe =
|
||||
es.connect(
|
||||
first,
|
||||
es.map(function (data, callback) {
|
||||
callback(null, {data: data})
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
callback(null, {data: data})
|
||||
}),
|
||||
es.writeArray(function (err, array) {
|
||||
it(array).deepEqual(d.map(readThis, function (data) {
|
||||
return {data: {data: data}}
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
exports ['connect returns a stream'] = function (test) {
|
||||
|
||||
var rw =
|
||||
es.connect(
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data * 2)
|
||||
}),
|
||||
es.map(function (data, callback) {
|
||||
callback(null, data * 5)
|
||||
})
|
||||
)
|
||||
|
||||
it(rw).has({readable: true, writable: true})
|
||||
|
||||
var array = [190, 24, 6, 7, 40, 57, 4, 6]
|
||||
, _array = []
|
||||
, c =
|
||||
es.connect(
|
||||
es.readArray(array),
|
||||
rw,
|
||||
es.log('after rw:'),
|
||||
es.writeArray(function (err, _array) {
|
||||
it(_array).deepEqual(array.map(function (e) { return e * 10 }))
|
||||
test.done()
|
||||
})
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
require('./helper')(module)
|
||||
|
||||
12
node_modules/gulp-remote-src/node_modules/event-stream/test/helper/index.js
generated
vendored
Normal file
12
node_modules/gulp-remote-src/node_modules/event-stream/test/helper/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var tape = require('tape')
|
||||
|
||||
module.exports = function (m) {
|
||||
if(m.parent) return
|
||||
for(var name in m.exports) {
|
||||
tape(name, function (t) {
|
||||
console.log('start', name)
|
||||
t.done = t.end
|
||||
m.exports[name](t)
|
||||
})
|
||||
}
|
||||
}
|
||||
21
node_modules/gulp-remote-src/node_modules/event-stream/test/merge.asynct.js
generated
vendored
Normal file
21
node_modules/gulp-remote-src/node_modules/event-stream/test/merge.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
|
||||
exports.merge = function (t) {
|
||||
var odd = d.map(1, 3, 100, d.id) //array of multiples of 3 < 100
|
||||
var even = d.map(2, 4, 100, d.id) //array of multiples of 3 < 100
|
||||
|
||||
var r1 = es.readArray(even)
|
||||
var r2 = es.readArray(odd)
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err //unpossible
|
||||
it(array.sort()).deepEqual(even.concat(odd).sort())
|
||||
t.done()
|
||||
})
|
||||
|
||||
es.merge(r1, r2).pipe(writer)
|
||||
|
||||
}
|
||||
require('./helper')(module)
|
||||
39
node_modules/gulp-remote-src/node_modules/event-stream/test/pause.asynct.js
generated
vendored
Normal file
39
node_modules/gulp-remote-src/node_modules/event-stream/test/pause.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
var es = require('../')
|
||||
, it = require('it-is')
|
||||
, d = require('ubelt')
|
||||
|
||||
exports ['gate buffers when shut'] = function (test) {
|
||||
|
||||
var hundy = d.map(1,100, d.id)
|
||||
, gate = es.pause()
|
||||
, ten = 10
|
||||
es.connect(
|
||||
es.readArray(hundy),
|
||||
es.log('after readArray'),
|
||||
gate,
|
||||
//es.log('after gate'),
|
||||
es.map(function (num, next) {
|
||||
//stick a map in here to check that gate never emits when open
|
||||
it(gate.paused).equal(false)
|
||||
console.log('data', num)
|
||||
if(!--ten) {
|
||||
console.log('PAUSE')
|
||||
gate.pause()//.resume()
|
||||
d.delay(gate.resume.bind(gate), 10)()
|
||||
ten = 10
|
||||
}
|
||||
|
||||
next(null, num)
|
||||
}),
|
||||
es.writeArray(function (err, array) { //just realized that I should remove the error param. errors will be emitted
|
||||
console.log('eonuhoenuoecbulc')
|
||||
it(array).deepEqual(hundy)
|
||||
test.done()
|
||||
})
|
||||
)
|
||||
|
||||
gate.resume()
|
||||
|
||||
}
|
||||
require('./helper')(module)
|
||||
52
node_modules/gulp-remote-src/node_modules/event-stream/test/pipeline.asynct.js
generated
vendored
Normal file
52
node_modules/gulp-remote-src/node_modules/event-stream/test/pipeline.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
var es = require('..')
|
||||
|
||||
exports['do not duplicate errors'] = function (test) {
|
||||
|
||||
var errors = 0;
|
||||
var pipe = es.pipeline(
|
||||
es.through(function(data) {
|
||||
return this.emit('data', data);
|
||||
}),
|
||||
es.through(function(data) {
|
||||
return this.emit('error', new Error(data));
|
||||
})
|
||||
)
|
||||
|
||||
pipe.on('error', function(err) {
|
||||
errors++
|
||||
console.log('error count', errors)
|
||||
process.nextTick(function () {
|
||||
return test.done();
|
||||
})
|
||||
})
|
||||
|
||||
return pipe.write('meh');
|
||||
|
||||
}
|
||||
|
||||
exports['3 pipe do not duplicate errors'] = function (test) {
|
||||
|
||||
var errors = 0;
|
||||
var pipe = es.pipeline(
|
||||
es.through(function(data) {
|
||||
return this.emit('data', data);
|
||||
}),
|
||||
es.through(function(data) {
|
||||
return this.emit('error', new Error(data));
|
||||
}),
|
||||
es.through()
|
||||
)
|
||||
|
||||
pipe.on('error', function(err) {
|
||||
errors++
|
||||
console.log('error count', errors)
|
||||
process.nextTick(function () {
|
||||
return test.done();
|
||||
})
|
||||
})
|
||||
|
||||
return pipe.write('meh');
|
||||
|
||||
}
|
||||
|
||||
require('./helper')(module)
|
||||
89
node_modules/gulp-remote-src/node_modules/event-stream/test/readArray.asynct.js
generated
vendored
Normal file
89
node_modules/gulp-remote-src/node_modules/event-stream/test/readArray.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
|
||||
function readStream(stream, pauseAt, done) {
|
||||
if(!done) done = pauseAt, pauseAt = -1
|
||||
var array = []
|
||||
stream.on('data', function (data) {
|
||||
array.push(data)
|
||||
if(!--pauseAt )
|
||||
stream.pause(), done(null, array)
|
||||
})
|
||||
stream.on('error', done)
|
||||
stream.on('end', function (data) {
|
||||
done(null, array)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports ['read an array'] = function (test) {
|
||||
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
|
||||
var reader = es.readArray(readThis)
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err //unpossible
|
||||
it(array).deepEqual(readThis)
|
||||
test.done()
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
}
|
||||
|
||||
exports ['read an array and pause it.'] = function (test) {
|
||||
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
|
||||
var reader = es.readArray(readThis)
|
||||
|
||||
readStream(reader, 10, function (err, data) {
|
||||
if(err) throw err
|
||||
it(data).deepEqual([3, 6, 9, 12, 15, 18, 21, 24, 27, 30])
|
||||
readStream(reader, 10, function (err, data) {
|
||||
it(data).deepEqual([33, 36, 39, 42, 45, 48, 51, 54, 57, 60])
|
||||
test.done()
|
||||
})
|
||||
reader.resume()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports ['reader is readable, but not writeable'] = function (test) {
|
||||
var reader = es.readArray([1])
|
||||
it(reader).has({
|
||||
readable: true,
|
||||
writable: false
|
||||
})
|
||||
|
||||
test.done()
|
||||
}
|
||||
|
||||
|
||||
exports ['read one item per tick'] = function (test) {
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
var drains = 0
|
||||
var reader = es.readArray(readThis)
|
||||
var tickMapper = es.map(function (data,callback) {
|
||||
process.nextTick(function () {
|
||||
callback(null, data)
|
||||
})
|
||||
//since tickMapper is returning false
|
||||
//pipe should pause the writer until a drain occurs
|
||||
return false
|
||||
})
|
||||
reader.pipe(tickMapper)
|
||||
readStream(tickMapper, function (err, array) {
|
||||
it(array).deepEqual(readThis)
|
||||
it(array.length).deepEqual(readThis.length)
|
||||
it(drains).equal(readThis.length)
|
||||
test.done()
|
||||
})
|
||||
tickMapper.on('drain', function () {
|
||||
drains ++
|
||||
})
|
||||
|
||||
}
|
||||
require('./helper')(module)
|
||||
197
node_modules/gulp-remote-src/node_modules/event-stream/test/readable.asynct.js
generated
vendored
Normal file
197
node_modules/gulp-remote-src/node_modules/event-stream/test/readable.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, u = require('ubelt')
|
||||
|
||||
exports ['read an array'] = function (test) {
|
||||
|
||||
|
||||
console.log('readable')
|
||||
return test.end()
|
||||
var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
|
||||
|
||||
console.log('readable')
|
||||
|
||||
var reader =
|
||||
es.readable(function (i, callback) {
|
||||
if(i >= readThis.length)
|
||||
return this.emit('end')
|
||||
console.log('readable')
|
||||
callback(null, readThis[i])
|
||||
})
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err
|
||||
it(array).deepEqual(readThis)
|
||||
test.done()
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
}
|
||||
|
||||
exports ['read an array - async'] = function (test) {
|
||||
|
||||
var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
|
||||
|
||||
var reader =
|
||||
es.readable(function (i, callback) {
|
||||
if(i >= readThis.length)
|
||||
return this.emit('end')
|
||||
u.delay(callback)(null, readThis[i])
|
||||
})
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err
|
||||
it(array).deepEqual(readThis)
|
||||
test.done()
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
}
|
||||
|
||||
|
||||
exports ['emit data then call next() also works'] = function (test) {
|
||||
|
||||
var readThis = u.map(3, 6, 100, u.id) //array of multiples of 3 < 100
|
||||
|
||||
var reader =
|
||||
es.readable(function (i, next) {
|
||||
if(i >= readThis.length)
|
||||
return this.emit('end')
|
||||
this.emit('data', readThis[i])
|
||||
next()
|
||||
})
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err
|
||||
it(array).deepEqual(readThis)
|
||||
test.done()
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
}
|
||||
|
||||
|
||||
exports ['callback emits error, then stops'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, called = 0
|
||||
|
||||
var reader =
|
||||
es.readable(function (i, callback) {
|
||||
if(called++)
|
||||
return
|
||||
callback(err)
|
||||
})
|
||||
|
||||
reader.on('error', function (_err){
|
||||
it(_err).deepEqual(err)
|
||||
u.delay(function() {
|
||||
it(called).equal(1)
|
||||
test.done()
|
||||
}, 50)()
|
||||
})
|
||||
}
|
||||
|
||||
exports['readable does not call read concurrently'] = function (test) {
|
||||
|
||||
var current = 0
|
||||
var source = es.readable(function(count, cb){
|
||||
current ++
|
||||
if(count > 100)
|
||||
return this.emit('end')
|
||||
u.delay(function(){
|
||||
current --
|
||||
it(current).equal(0)
|
||||
cb(null, {ok: true, n: count});
|
||||
})();
|
||||
});
|
||||
|
||||
var destination = es.map(function(data, cb){
|
||||
//console.info(data);
|
||||
cb();
|
||||
});
|
||||
|
||||
var all = es.connect(source, destination);
|
||||
|
||||
destination.on('end', test.done)
|
||||
}
|
||||
|
||||
exports ['does not raise a warning: Recursive process.nextTick detected'] = function (test) {
|
||||
var readThisDelayed;
|
||||
|
||||
u.delay(function () {
|
||||
readThisDelayed = [1, 3, 5];
|
||||
})();
|
||||
|
||||
es.readable(function (count, callback) {
|
||||
|
||||
if (readThisDelayed) {
|
||||
var that = this;
|
||||
readThisDelayed.forEach(function (item) {
|
||||
that.emit('data', item);
|
||||
});
|
||||
|
||||
this.emit('end');
|
||||
test.done();
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// emitting multiple errors is not supported by stream.
|
||||
//
|
||||
// I do not think that this is a good idea, at least, there should be an option to pipe to
|
||||
// continue on error. it makes alot ef sense, if you are using Stream like I am, to be able to emit multiple errors.
|
||||
// an error might not necessarily mean the end of the stream. it depends on the error, at least.
|
||||
//
|
||||
// I will start a thread on the mailing list. I'd rather that than use a custom `pipe` implementation.
|
||||
//
|
||||
// basically, I want to be able use pipe to transform objects, and if one object is invalid,
|
||||
// the next might still be good, so I should get to choose if it's gonna stop.
|
||||
// re-enstate this test when this issue progresses.
|
||||
//
|
||||
// hmm. I could add this to es.connect by deregistering the error listener,
|
||||
// but I would rather it be an option in core.
|
||||
|
||||
/*
|
||||
exports ['emit multiple errors, with 2nd parameter (continueOnError)'] = function (test) {
|
||||
|
||||
var readThis = d.map(1, 100, d.id)
|
||||
, errors = 0
|
||||
var reader =
|
||||
es.readable(function (i, callback) {
|
||||
console.log(i, readThis.length)
|
||||
if(i >= readThis.length)
|
||||
return this.emit('end')
|
||||
if(!(readThis[i] % 7))
|
||||
return callback(readThis[i])
|
||||
callback(null, readThis[i])
|
||||
}, true)
|
||||
|
||||
var writer = es.writeArray(function (err, array) {
|
||||
if(err) throw err
|
||||
it(array).every(function (u){
|
||||
it(u % 7).notEqual(0)
|
||||
}).property('length', 80)
|
||||
it(errors).equal(14)
|
||||
test.done()
|
||||
})
|
||||
|
||||
reader.on('error', function (u) {
|
||||
errors ++
|
||||
console.log(u)
|
||||
if('number' !== typeof u)
|
||||
throw u
|
||||
|
||||
it(u % 7).equal(0)
|
||||
|
||||
})
|
||||
|
||||
reader.pipe(writer)
|
||||
}
|
||||
*/
|
||||
|
||||
require('./helper')(module)
|
||||
51
node_modules/gulp-remote-src/node_modules/event-stream/test/replace.asynct.js
generated
vendored
Normal file
51
node_modules/gulp-remote-src/node_modules/event-stream/test/replace.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
, spec = require('stream-spec')
|
||||
|
||||
var next = process.nextTick
|
||||
|
||||
var fizzbuzz = '12F4BF78FB11F1314FB1617F19BF2223FB26F2829FB3132F34BF3738FB41F4344FB4647F49BF5253FB56F5859FB6162F64BF6768FB71F7374FB7677F79BF8283FB86F8889FB9192F94BF9798FB'
|
||||
, fizz7buzz = '12F4BFseven8FB11F1314FB161sevenF19BF2223FB26F2829FB3132F34BF3seven38FB41F4344FB464sevenF49BF5253FB56F5859FB6162F64BF6seven68FBseven1Fseven3seven4FBseven6sevensevenFseven9BF8283FB86F8889FB9192F94BF9seven98FB'
|
||||
|
||||
exports ['fizz buzz'] = function (test) {
|
||||
|
||||
var readThis = d.map(1, 100, function (i) {
|
||||
return (
|
||||
! (i % 3 || i % 5) ? "FB" :
|
||||
!(i % 3) ? "F" :
|
||||
!(i % 5) ? "B" :
|
||||
''+i
|
||||
)
|
||||
}) //array of multiples of 3 < 100
|
||||
|
||||
var reader = es.readArray(readThis)
|
||||
var join = es.wait(function (err, string){
|
||||
it(string).equal(fizzbuzz)
|
||||
test.done()
|
||||
})
|
||||
reader.pipe(join)
|
||||
|
||||
}
|
||||
|
||||
|
||||
exports ['fizz buzz replace'] = function (test) {
|
||||
var split = es.split(/(1)/)
|
||||
var replace = es.replace('7', 'seven')
|
||||
// var x = spec(replace).through()
|
||||
split
|
||||
.pipe(replace)
|
||||
.pipe(es.join(function (err, string) {
|
||||
it(string).equal(fizz7buzz)
|
||||
}))
|
||||
|
||||
replace.on('close', function () {
|
||||
// x.validate()
|
||||
test.done()
|
||||
})
|
||||
|
||||
split.write(fizzbuzz)
|
||||
split.end()
|
||||
|
||||
}
|
||||
require('./helper')(module)
|
||||
343
node_modules/gulp-remote-src/node_modules/event-stream/test/simple-map.asynct.js
generated
vendored
Normal file
343
node_modules/gulp-remote-src/node_modules/event-stream/test/simple-map.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,343 @@
|
||||
'use strict';
|
||||
|
||||
var es = require('../')
|
||||
, it = require('it-is')
|
||||
, u = require('ubelt')
|
||||
, spec = require('stream-spec')
|
||||
, Stream = require('stream')
|
||||
, from = require('from')
|
||||
, through = require('through')
|
||||
|
||||
//REFACTOR THIS TEST TO USE es.readArray and es.writeArray
|
||||
|
||||
function writeArray(array, stream) {
|
||||
|
||||
array.forEach( function (j) {
|
||||
stream.write(j)
|
||||
})
|
||||
stream.end()
|
||||
|
||||
}
|
||||
|
||||
function readStream(stream, done) {
|
||||
|
||||
var array = []
|
||||
stream.on('data', function (data) {
|
||||
array.push(data)
|
||||
})
|
||||
stream.on('error', done)
|
||||
stream.on('end', function (data) {
|
||||
done(null, array)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//call sink on each write,
|
||||
//and complete when finished.
|
||||
|
||||
function pauseStream (prob, delay) {
|
||||
var pauseIf = (
|
||||
'number' == typeof prob
|
||||
? function () {
|
||||
return Math.random() < prob
|
||||
}
|
||||
: 'function' == typeof prob
|
||||
? prob
|
||||
: 0.1
|
||||
)
|
||||
var delayer = (
|
||||
!delay
|
||||
? process.nextTick
|
||||
: 'number' == typeof delay
|
||||
? function (next) { setTimeout(next, delay) }
|
||||
: delay
|
||||
)
|
||||
|
||||
return es.through(function (data) {
|
||||
if(!this.paused && pauseIf()) {
|
||||
console.log('PAUSE STREAM PAUSING')
|
||||
this.pause()
|
||||
var self = this
|
||||
delayer(function () {
|
||||
console.log('PAUSE STREAM RESUMING')
|
||||
self.resume()
|
||||
})
|
||||
}
|
||||
console.log("emit ('data', " + data + ')')
|
||||
this.emit('data', data)
|
||||
})
|
||||
}
|
||||
|
||||
exports ['simple map'] = function (test) {
|
||||
|
||||
var input = u.map(1, 1000, function () {
|
||||
return Math.random()
|
||||
})
|
||||
var expected = input.map(function (v) {
|
||||
return v * 2
|
||||
})
|
||||
|
||||
var pause = pauseStream(0.1)
|
||||
var fs = from(input)
|
||||
var ts = es.writeArray(function (err, ar) {
|
||||
it(ar).deepEqual(expected)
|
||||
test.done()
|
||||
})
|
||||
var map = es.through(function (data) {
|
||||
this.emit('data', data * 2)
|
||||
})
|
||||
|
||||
spec(map).through().validateOnExit()
|
||||
spec(pause).through().validateOnExit()
|
||||
|
||||
fs.pipe(map).pipe(pause).pipe(ts)
|
||||
}
|
||||
|
||||
exports ['simple map applied to a stream'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
//create event stream from
|
||||
|
||||
var doubler = es.map(function (data, cb) {
|
||||
cb(null, data * 2)
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
//a map is only a middle man, so it is both readable and writable
|
||||
|
||||
it(doubler).has({
|
||||
readable: true,
|
||||
writable: true,
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
// process.nextTick(x.validate)
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
exports['pipe two maps together'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
//create event stream from
|
||||
function dd (data, cb) {
|
||||
cb(null, data * 2)
|
||||
}
|
||||
var doubler1 = es.map(dd), doubler2 = es.map(dd)
|
||||
|
||||
doubler1.pipe(doubler2)
|
||||
|
||||
spec(doubler1).through().validateOnExit()
|
||||
spec(doubler2).through().validateOnExit()
|
||||
|
||||
readStream(doubler2, function (err, output) {
|
||||
it(output).deepEqual(input.map(function (j) {
|
||||
return j * 4
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
writeArray(input, doubler1)
|
||||
|
||||
}
|
||||
|
||||
//next:
|
||||
//
|
||||
// test pause, resume and drian.
|
||||
//
|
||||
|
||||
// then make a pipe joiner:
|
||||
//
|
||||
// plumber (evStr1, evStr2, evStr3, evStr4, evStr5)
|
||||
//
|
||||
// will return a single stream that write goes to the first
|
||||
|
||||
exports ['map will not call end until the callback'] = function (test) {
|
||||
|
||||
var ticker = es.map(function (data, cb) {
|
||||
process.nextTick(function () {
|
||||
cb(null, data * 2)
|
||||
})
|
||||
})
|
||||
|
||||
spec(ticker).through().validateOnExit()
|
||||
|
||||
ticker.write('x')
|
||||
ticker.end()
|
||||
|
||||
ticker.on('end', function () {
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
exports ['emit error thrown'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, mapper =
|
||||
es.map(function () {
|
||||
throw err
|
||||
})
|
||||
|
||||
mapper.on('error', function (_err) {
|
||||
it(_err).equal(err)
|
||||
test.done()
|
||||
})
|
||||
|
||||
// onExit(spec(mapper).basic().validate)
|
||||
//need spec that says stream may error.
|
||||
|
||||
mapper.write('hello')
|
||||
|
||||
}
|
||||
|
||||
exports ['emit error calledback'] = function (test) {
|
||||
|
||||
var err = new Error('INTENSIONAL ERROR')
|
||||
, mapper =
|
||||
es.map(function (data, callback) {
|
||||
callback(err)
|
||||
})
|
||||
|
||||
mapper.on('error', function (_err) {
|
||||
it(_err).equal(err)
|
||||
test.done()
|
||||
})
|
||||
|
||||
mapper.write('hello')
|
||||
|
||||
}
|
||||
|
||||
exports ['do not emit drain if not paused'] = function (test) {
|
||||
|
||||
var map = es.map(function (data, callback) {
|
||||
u.delay(callback)(null, 1)
|
||||
return true
|
||||
})
|
||||
|
||||
spec(map).through().pausable().validateOnExit()
|
||||
|
||||
map.on('drain', function () {
|
||||
it(false).ok('should not emit drain unless the stream is paused')
|
||||
})
|
||||
|
||||
it(map.write('hello')).equal(true)
|
||||
it(map.write('hello')).equal(true)
|
||||
it(map.write('hello')).equal(true)
|
||||
setTimeout(function () {map.end()},10)
|
||||
map.on('end', test.done)
|
||||
}
|
||||
|
||||
exports ['emits drain if paused, when all '] = function (test) {
|
||||
var active = 0
|
||||
var drained = false
|
||||
var map = es.map(function (data, callback) {
|
||||
active ++
|
||||
u.delay(function () {
|
||||
active --
|
||||
callback(null, 1)
|
||||
})()
|
||||
console.log('WRITE', false)
|
||||
return false
|
||||
})
|
||||
|
||||
spec(map).through().validateOnExit()
|
||||
|
||||
map.on('drain', function () {
|
||||
drained = true
|
||||
it(active).equal(0, 'should emit drain when all maps are done')
|
||||
})
|
||||
|
||||
it(map.write('hello')).equal(false)
|
||||
it(map.write('hello')).equal(false)
|
||||
it(map.write('hello')).equal(false)
|
||||
|
||||
process.nextTick(function () {map.end()},10)
|
||||
|
||||
map.on('end', function () {
|
||||
console.log('end')
|
||||
it(drained).ok('shoud have emitted drain before end')
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports ['map applied to a stream with filtering'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
|
||||
var doubler = es.map(function (data, callback) {
|
||||
if (data % 2)
|
||||
callback(null, data * 2)
|
||||
else
|
||||
callback()
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.filter(function (j) {
|
||||
return j % 2
|
||||
}).map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
exports ['simple mapSync applied to a stream'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
|
||||
var doubler = es.mapSync(function (data) {
|
||||
return data * 2
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
exports ['mapSync applied to a stream with filtering'] = function (test) {
|
||||
|
||||
var input = [1,2,3,7,5,3,1,9,0,2,4,6]
|
||||
|
||||
var doubler = es.mapSync(function (data) {
|
||||
if (data % 2)
|
||||
return data * 2
|
||||
})
|
||||
|
||||
readStream(doubler, function (err, output) {
|
||||
it(output).deepEqual(input.filter(function (j) {
|
||||
return j % 2
|
||||
}).map(function (j) {
|
||||
return j * 2
|
||||
}))
|
||||
test.done()
|
||||
})
|
||||
|
||||
spec(doubler).through().validateOnExit()
|
||||
|
||||
writeArray(input, doubler)
|
||||
|
||||
}
|
||||
|
||||
require('./helper')(module)
|
||||
86
node_modules/gulp-remote-src/node_modules/event-stream/test/spec.asynct.js
generated
vendored
Normal file
86
node_modules/gulp-remote-src/node_modules/event-stream/test/spec.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
assert that data is called many times
|
||||
assert that end is called eventually
|
||||
|
||||
assert that when stream enters pause state,
|
||||
on drain is emitted eventually.
|
||||
*/
|
||||
|
||||
var es = require('..')
|
||||
var it = require('it-is').style('colour')
|
||||
var spec = require('stream-spec')
|
||||
|
||||
exports['simple stream'] = function (test) {
|
||||
|
||||
var stream = es.through()
|
||||
var x = spec(stream).basic().pausable()
|
||||
|
||||
stream.write(1)
|
||||
stream.write(1)
|
||||
stream.pause()
|
||||
stream.write(1)
|
||||
stream.resume()
|
||||
stream.write(1)
|
||||
stream.end(2) //this will call write()
|
||||
|
||||
process.nextTick(function (){
|
||||
x.validate()
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
|
||||
exports['throw on write when !writable'] = function (test) {
|
||||
|
||||
var stream = es.through()
|
||||
var x = spec(stream).basic().pausable()
|
||||
|
||||
stream.write(1)
|
||||
stream.write(1)
|
||||
stream.end(2) //this will call write()
|
||||
stream.write(1) //this will be throwing..., but the spec will catch it.
|
||||
|
||||
process.nextTick(function () {
|
||||
x.validate()
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
exports['end fast'] = function (test) {
|
||||
|
||||
var stream = es.through()
|
||||
var x = spec(stream).basic().pausable()
|
||||
|
||||
stream.end() //this will call write()
|
||||
|
||||
process.nextTick(function () {
|
||||
x.validate()
|
||||
test.done()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
okay, that was easy enough, whats next?
|
||||
|
||||
say, after you call paused(), write should return false
|
||||
until resume is called.
|
||||
|
||||
simple way to implement this:
|
||||
write must return !paused
|
||||
after pause() paused = true
|
||||
after resume() paused = false
|
||||
|
||||
on resume, if !paused drain is emitted again.
|
||||
after drain, !paused
|
||||
|
||||
there are lots of subtle ordering bugs in streams.
|
||||
|
||||
example, set !paused before emitting drain.
|
||||
|
||||
the stream api is stateful.
|
||||
*/
|
||||
|
||||
|
||||
require('./helper')(module)
|
||||
47
node_modules/gulp-remote-src/node_modules/event-stream/test/split.asynct.js
generated
vendored
Normal file
47
node_modules/gulp-remote-src/node_modules/event-stream/test/split.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
, join = require('path').join
|
||||
, fs = require('fs')
|
||||
, Stream = require('stream').Stream
|
||||
, spec = require('stream-spec')
|
||||
|
||||
exports ['es.split() works like String#split'] = function (test) {
|
||||
var readme = join(__filename)
|
||||
, expected = fs.readFileSync(readme, 'utf-8').split('\n')
|
||||
, cs = es.split()
|
||||
, actual = []
|
||||
, ended = false
|
||||
, x = spec(cs).through()
|
||||
|
||||
var a = new Stream ()
|
||||
|
||||
a.write = function (l) {
|
||||
actual.push(l.trim())
|
||||
}
|
||||
a.end = function () {
|
||||
|
||||
ended = true
|
||||
expected.forEach(function (v,k) {
|
||||
//String.split will append an empty string ''
|
||||
//if the string ends in a split pattern.
|
||||
//es.split doesn't which was breaking this test.
|
||||
//clearly, appending the empty string is correct.
|
||||
//tests are passing though. which is the current job.
|
||||
if(v)
|
||||
it(actual[k]).like(v)
|
||||
})
|
||||
//give the stream time to close
|
||||
process.nextTick(function () {
|
||||
test.done()
|
||||
x.validate()
|
||||
})
|
||||
}
|
||||
a.writable = true
|
||||
|
||||
fs.createReadStream(readme, {flags: 'r'}).pipe(cs)
|
||||
cs.pipe(a)
|
||||
|
||||
}
|
||||
|
||||
require('./helper')(module)
|
||||
15
node_modules/gulp-remote-src/node_modules/event-stream/test/stringify.js
generated
vendored
Normal file
15
node_modules/gulp-remote-src/node_modules/event-stream/test/stringify.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
|
||||
var es = require('../')
|
||||
|
||||
exports['handle buffer'] = function (t) {
|
||||
|
||||
|
||||
es.stringify().on('data', function (d) {
|
||||
t.equal(d.trim(), JSON.stringify('HELLO'))
|
||||
t.end()
|
||||
}).write(new Buffer('HELLO'))
|
||||
|
||||
}
|
||||
require('./helper')(module)
|
||||
31
node_modules/gulp-remote-src/node_modules/event-stream/test/writeArray.asynct.js
generated
vendored
Normal file
31
node_modules/gulp-remote-src/node_modules/event-stream/test/writeArray.asynct.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
var es = require('../')
|
||||
, it = require('it-is').style('colour')
|
||||
, d = require('ubelt')
|
||||
|
||||
exports ['write an array'] = function (test) {
|
||||
|
||||
var readThis = d.map(3, 6, 100, d.id) //array of multiples of 3 < 100
|
||||
|
||||
var writer = es.writeArray(function (err, array){
|
||||
if(err) throw err //unpossible
|
||||
it(array).deepEqual(readThis)
|
||||
test.done()
|
||||
})
|
||||
|
||||
d.each(readThis, writer.write.bind(writer))
|
||||
writer.end()
|
||||
|
||||
}
|
||||
|
||||
|
||||
exports ['writer is writable, but not readable'] = function (test) {
|
||||
var reader = es.writeArray(function () {})
|
||||
it(reader).has({
|
||||
readable: false,
|
||||
writable: true
|
||||
})
|
||||
|
||||
test.done()
|
||||
}
|
||||
require('./helper')(module)
|
||||
68
node_modules/gulp-remote-src/node_modules/node.extend/.jscs.json
generated
vendored
Normal file
68
node_modules/gulp-remote-src/node_modules/node.extend/.jscs.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"additionalRules": [],
|
||||
|
||||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
|
||||
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
|
||||
|
||||
"disallowSpaceAfterKeywords": [],
|
||||
|
||||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
|
||||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
|
||||
|
||||
"requireSpaceBetweenArguments": true,
|
||||
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
|
||||
"disallowQuotedKeysInObjects": "allButReserved",
|
||||
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"requireSpaceAfterPrefixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforePostfixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforeBinaryOperators": [],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
|
||||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"disallowSpaceAfterBinaryOperators": [],
|
||||
|
||||
"disallowImplicitTypeConversion": ["binary", "string"],
|
||||
|
||||
"disallowKeywords": ["with", "eval"],
|
||||
|
||||
"requireKeywordsOnNewLine": [],
|
||||
"disallowKeywordsOnNewLine": ["else"],
|
||||
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
|
||||
"disallowTrailingWhitespace": true,
|
||||
|
||||
"disallowTrailingComma": true,
|
||||
|
||||
"excludeFiles": ["node_modules/**", "vendor/**"],
|
||||
|
||||
"disallowMultipleLineStrings": true,
|
||||
|
||||
"requireDotNotation": true,
|
||||
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
|
||||
"validateLineBreaks": "LF",
|
||||
|
||||
"validateQuoteMarks": {
|
||||
"escape": true,
|
||||
"mark": "'"
|
||||
}
|
||||
}
|
||||
|
||||
4
node_modules/gulp-remote-src/node_modules/node.extend/.npmignore
generated
vendored
Normal file
4
node_modules/gulp-remote-src/node_modules/node.extend/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
||||
22
node_modules/gulp-remote-src/node_modules/node.extend/.travis.yml
generated
vendored
Normal file
22
node_modules/gulp-remote-src/node_modules/node.extend/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "iojs-v1.1"
|
||||
- "iojs-v1.0"
|
||||
- "0.12"
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.9"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
- "0.4"
|
||||
before_install:
|
||||
- '[ "${TRAVIS_NODE_VERSION}" == "0.6" ] || npm install -g npm@~1.4.6'
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- node_js: "0.11"
|
||||
- node_js: "0.9"
|
||||
- node_js: "0.8"
|
||||
- node_js: "0.6"
|
||||
- node_js: "0.4"
|
||||
sudo: false
|
||||
21
node_modules/gulp-remote-src/node_modules/node.extend/History.md
generated
vendored
Normal file
21
node_modules/gulp-remote-src/node_modules/node.extend/History.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
## 1.0.1 / 2013-04-02
|
||||
|
||||
- Fix tests
|
||||
|
||||
|
||||
|
||||
## 1.0.0 / 2012-02-28
|
||||
|
||||
- Add tests for the stable release
|
||||
|
||||
|
||||
|
||||
## 0.0.2 / 2012-01-11
|
||||
|
||||
- Add repository to package.json
|
||||
|
||||
|
||||
|
||||
## 0.0.1 / 2012-01-10
|
||||
|
||||
- Initial release
|
||||
77
node_modules/gulp-remote-src/node_modules/node.extend/Readme.md
generated
vendored
Normal file
77
node_modules/gulp-remote-src/node_modules/node.extend/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# node.extend
|
||||
|
||||
A port of jQuery.extend that **actually works** on node.js
|
||||
|
||||
[![Build Status][travis-svg]][travis-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
|
||||
[![browser support][testling-png]][testling-url]
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
None of the existing ones on npm really work therefore I ported it myself.
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To install this module in your current working directory (which should already contain a package.json), run
|
||||
|
||||
```
|
||||
npm install node.extend
|
||||
```
|
||||
|
||||
You can additionally just list the module in your [package.json](https://npmjs.org/doc/json.html) and run npm install.
|
||||
|
||||
Then, require this package where you need it:
|
||||
|
||||
```
|
||||
var extend = require('node.extend');
|
||||
```
|
||||
|
||||
The syntax for merging two objects is as follows:
|
||||
|
||||
```
|
||||
var destObject = extend({}, sourceObject);
|
||||
// Where sourceObject is the object whose properties will be copied into another.
|
||||
// NOTE: In this situation, this is not a deep merge. See below on how to handle a deep merge.
|
||||
```
|
||||
|
||||
For information about how the clone works internally, view source in lib/extend.js or checkout the doc from [jQuery][]
|
||||
|
||||
### A Note About Deep Merge (avoiding pass-by-reference cloning)
|
||||
|
||||
In order to force a deep merge, when extending an object, you must pass boolean true as the first argument to extend:
|
||||
|
||||
```
|
||||
var destObject = extend(true, {}, sourceObject);
|
||||
// Where sourceObject is the object whose properties will be copied into another.
|
||||
```
|
||||
|
||||
See [this article](http://www.jon-carlos.com/2013/is-javascript-call-by-value-or-call-by-reference/) for more information about the need for deep merges in JavaScript.
|
||||
|
||||
## Credit
|
||||
|
||||
- Jordan Harband [@ljharb][]
|
||||
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2011, John Resig
|
||||
Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
http://jquery.org/license
|
||||
|
||||
[testling-png]: https://ci.testling.com/dreamerslab/node.extend.png
|
||||
[testling-url]: https://ci.testling.com/dreamerslab/node.extend
|
||||
[travis-svg]: https://travis-ci.org/dreamerslab/node.extend.svg
|
||||
[travis-url]: https://travis-ci.org/dreamerslab/node.extend
|
||||
[deps-svg]: https://david-dm.org/dreamerslab/node.extend.svg
|
||||
[deps-url]: https://david-dm.org/dreamerslab/node.extend
|
||||
[dev-deps-svg]: https://david-dm.org/dreamerslab/node.extend/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/dreamerslab/node.extend#info=devDependencies
|
||||
[jQuery]: http://api.jquery.com/jQuery.extend/
|
||||
[@ljharb]: https://twitter.com/ljharb
|
||||
|
||||
2
node_modules/gulp-remote-src/node_modules/node.extend/index.js
generated
vendored
Normal file
2
node_modules/gulp-remote-src/node_modules/node.extend/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./lib/extend');
|
||||
|
||||
82
node_modules/gulp-remote-src/node_modules/node.extend/lib/extend.js
generated
vendored
Normal file
82
node_modules/gulp-remote-src/node_modules/node.extend/lib/extend.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/*!
|
||||
* node.extend
|
||||
* Copyright 2011, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* @fileoverview
|
||||
* Port of jQuery.extend that actually works on node.js
|
||||
*/
|
||||
var is = require('is');
|
||||
|
||||
function extend() {
|
||||
var target = arguments[0] || {};
|
||||
var i = 1;
|
||||
var length = arguments.length;
|
||||
var deep = false;
|
||||
var options, name, src, copy, copy_is_array, clone;
|
||||
|
||||
// Handle a deep copy situation
|
||||
if (typeof target === 'boolean') {
|
||||
deep = target;
|
||||
target = arguments[1] || {};
|
||||
// skip the boolean and the target
|
||||
i = 2;
|
||||
}
|
||||
|
||||
// Handle case when target is a string or something (possible in deep copy)
|
||||
if (typeof target !== 'object' && !is.fn(target)) {
|
||||
target = {};
|
||||
}
|
||||
|
||||
for (; i < length; i++) {
|
||||
// Only deal with non-null/undefined values
|
||||
options = arguments[i]
|
||||
if (options != null) {
|
||||
if (typeof options === 'string') {
|
||||
options = options.split('');
|
||||
}
|
||||
// Extend the base object
|
||||
for (name in options) {
|
||||
src = target[name];
|
||||
copy = options[name];
|
||||
|
||||
// Prevent never-ending loop
|
||||
if (target === copy) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Recurse if we're merging plain objects or arrays
|
||||
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
|
||||
if (copy_is_array) {
|
||||
copy_is_array = false;
|
||||
clone = src && is.array(src) ? src : [];
|
||||
} else {
|
||||
clone = src && is.hash(src) ? src : {};
|
||||
}
|
||||
|
||||
// Never move original objects, clone them
|
||||
target[name] = extend(deep, clone, copy);
|
||||
|
||||
// Don't bring in undefined values
|
||||
} else if (typeof copy !== 'undefined') {
|
||||
target[name] = copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the modified object
|
||||
return target;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
extend.version = '1.1.3';
|
||||
|
||||
/**
|
||||
* Exports module.
|
||||
*/
|
||||
module.exports = extend;
|
||||
|
||||
100
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/CHANGELOG.md
generated
vendored
Normal file
100
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
3.1.0 / 2015-09-20
|
||||
==================
|
||||
* [Enhancement]: `is.array`: Prefer `Array.isArray` when present
|
||||
* [Fix] Deprecate `is.boolean`/`is.int` (ES3 syntax errors)
|
||||
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
|
||||
* [Refactor] Don't use yoda conditions
|
||||
* [Refactor] `is.equal` can return earlier in some cases (#16)
|
||||
* [Tests] Quote "throws" (ES3 syntax error)
|
||||
* [Tests] up to `io.js` `v3.3`, up to `node` `v4.1`
|
||||
* [Dev Deps] add `npm run eslint`
|
||||
* [Dev Deps] update `tape`, `covert`, `jscs`
|
||||
|
||||
3.0.1 / 2015-02-22
|
||||
==================
|
||||
* Version bump to resolve npm bug with v3.0.0
|
||||
|
||||
3.0.0 / 2015-02-21
|
||||
==================
|
||||
* is.empty should return true for falsy values ([#13](https://github.com/enricomarino/is/issues/13), [#14](https://github.com/enricomarino/is/issues/14))
|
||||
* All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`.
|
||||
* Test on `iojs` `v1.2` and `v1.3`, `node` `v0.12`; speed up builds; allow failures on all but two latest minor versions.
|
||||
* Update `jscs`
|
||||
|
||||
2.2.1 / 2015-02-06
|
||||
==================
|
||||
* Update `tape`, `jscs`
|
||||
* `toString` breaks in some browsers; using `toStr` instead.
|
||||
|
||||
2.2.0 / 2014-11-29
|
||||
==================
|
||||
* Update `tape`, `jscs`
|
||||
* Add `is.symbol`
|
||||
|
||||
2.1.0 / 2014-10-21
|
||||
==================
|
||||
* Add `CHANGELOG.md`
|
||||
* Add `is.hex` and `is.base64` [#12](https://github.com/enricomarino/is/issues/12)
|
||||
* Update `tape`, `jscs`
|
||||
* Lock `covert` to v1.0.0 [substack/covert#9](https://github.com/substack/covert/issues/9)
|
||||
|
||||
2.0.2 / 2014-10-05
|
||||
==================
|
||||
* `undefined` can be redefined in ES3 browsers.
|
||||
* Update `jscs.json` and make style consistent
|
||||
* Update `foreach`, `jscs`, `tape`
|
||||
* Naming URLs in README
|
||||
|
||||
2.0.1 / 2014-09-02
|
||||
==================
|
||||
* Add the license to package.json
|
||||
* Add license and downloads badges
|
||||
* Update `jscs`
|
||||
|
||||
2.0.0 / 2014-08-25
|
||||
==================
|
||||
* Add `make release`
|
||||
* Update copyright notice.
|
||||
* Fix is.empty(new String())
|
||||
|
||||
1.1.0 / 2014-08-22
|
||||
==================
|
||||
* Removing redundant license
|
||||
* Add a non-deprecated method for is.null
|
||||
* Use a more reliable valueOf coercion for is.false/is.true
|
||||
* Clean up `README.md`
|
||||
* Running `npm run lint` as part of tests.
|
||||
* Fixing lint errors.
|
||||
* Adding `npm run lint`
|
||||
* Updating `covert`
|
||||
|
||||
1.0.0 / 2014-08-07
|
||||
==================
|
||||
* Update `tape`, `covert`
|
||||
* Increase code coverage
|
||||
* Update `LICENSE.md`, `README.md`
|
||||
|
||||
0.3.0 / 2014-03-02
|
||||
==================
|
||||
* Update `tape`, `covert`
|
||||
* Adding `npm run coverage`
|
||||
* is.arguments -> is.args, because reserved words.
|
||||
* "undefined" is a reserved word in ES3 browsers.
|
||||
* Optimizing is.equal to return early if value and other are strictly equal.
|
||||
* Fixing is.equal for objects.
|
||||
* Test improvements
|
||||
|
||||
0.2.7 / 2013-12-26
|
||||
==================
|
||||
* Update `tape`, `foreach`
|
||||
* is.decimal(Infinity) shouldn't be true [#11](https://github.com/enricomarino/is/issues/11)
|
||||
|
||||
0.2.6 / 2013-05-06
|
||||
==================
|
||||
* Fix lots of tests [#9](https://github.com/enricomarino/is/issues/9)
|
||||
* Update tape [#8](https://github.com/enricomarino/is/issues/8)
|
||||
|
||||
0.2.5 / 2013-04-24
|
||||
==================
|
||||
* Use `tap` instead of `tape` [#7](https://github.com/enricomarino/is/issues/7)
|
||||
|
||||
23
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/LICENSE.md
generated
vendored
Normal file
23
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Enrico Marino
|
||||
Copyright (c) 2014 Enrico Marino and Jordan Harband
|
||||
|
||||
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.
|
||||
17
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/Makefile
generated
vendored
Normal file
17
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/Makefile
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
.PHONY: verify-tag release
|
||||
|
||||
default: release
|
||||
|
||||
verify-tag:
|
||||
ifndef TAG
|
||||
$(error TAG is undefined)
|
||||
endif
|
||||
|
||||
release: verify-tag
|
||||
@ OLD_TAG=`git describe --abbrev=0 --tags` && \
|
||||
npm run minify && \
|
||||
replace "$${OLD_TAG/v/}" "$(TAG)" -- *.json README.md && \
|
||||
git commit -m "v$(TAG)" *.js *.json README.md && \
|
||||
git tag "v$(TAG)"
|
||||
|
||||
140
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/README.md
generated
vendored
Normal file
140
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/README.md
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
# is <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
|
||||
|
||||
[![Build Status][travis-svg]][travis-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][npm-url]
|
||||
|
||||
[![browser support][testling-png]][testling-url]
|
||||
|
||||
The definitive JavaScript type testing library
|
||||
|
||||
To be or not to be? This is the library!
|
||||
|
||||
## Installation
|
||||
|
||||
As a node.js module
|
||||
|
||||
```shell
|
||||
$ npm install is
|
||||
```
|
||||
|
||||
As a component
|
||||
```shell
|
||||
$ component install enricomarino/is
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### general
|
||||
|
||||
- ``is.a`` (value, type) or ``is.type`` (value, type)
|
||||
- ``is.defined`` (value)
|
||||
- ``is.empty`` (value)
|
||||
- ``is.equal`` (value, other)
|
||||
- ``is.hosted`` (value, host)
|
||||
- ``is.instance`` (value, constructor)
|
||||
- ``is.instanceof`` (value, constructor) - deprecated, because in ES3 browsers, "instanceof" is a reserved word
|
||||
- ``is.nil`` (value)
|
||||
- ``is.null`` (value) - deprecated, because in ES3 browsers, "null" is a reserved word
|
||||
- ``is.undef`` (value)
|
||||
- ``is.undefined`` (value) - deprecated, because in ES3 browsers, "undefined" is a reserved word
|
||||
|
||||
### arguments
|
||||
|
||||
- ``is.args`` (value)
|
||||
- ``is.arguments`` (value) - deprecated, because "arguments" is a reserved word
|
||||
- ``is.args.empty`` (value)
|
||||
|
||||
### array
|
||||
|
||||
- ``is.array`` (value)
|
||||
- ``is.array.empty`` (value)
|
||||
- ``is.arraylike`` (value)
|
||||
|
||||
### boolean
|
||||
|
||||
- ``is.bool`` (value)
|
||||
- ``is.boolean`` (value) - deprecated, because in ES3 browsers, "boolean" is a reserved word
|
||||
- ``is.false`` (value) - deprecated, because in ES3 browsers, "false" is a reserved word
|
||||
- ``is.true`` (value) - deprecated, because in ES3 browsers, "true" is a reserved word
|
||||
|
||||
### date
|
||||
|
||||
- ``is.date`` (value)
|
||||
|
||||
### element
|
||||
|
||||
- ``is.element`` (value)
|
||||
|
||||
### error
|
||||
|
||||
- is.error (value)
|
||||
|
||||
### function
|
||||
|
||||
- ``is.fn`` (value)
|
||||
- ``is.function`` (value) - deprecated, because in ES3 browsers, "function" is a reserved word
|
||||
|
||||
### number
|
||||
|
||||
- ``is.number`` (value)
|
||||
- ``is.infinite`` (value)
|
||||
- ``is.decimal`` (value)
|
||||
- ``is.divisibleBy`` (value, n)
|
||||
- ``is.integer`` (value)
|
||||
- ``is.int`` (value) - deprecated, because in ES3 browsers, "int" is a reserved word
|
||||
- ``is.maximum`` (value, others)
|
||||
- ``is.minimum`` (value, others)
|
||||
- ``is.nan`` (value)
|
||||
- ``is.even`` (value)
|
||||
- ``is.odd`` (value)
|
||||
- ``is.ge`` (value, other)
|
||||
- ``is.gt`` (value, other)
|
||||
- ``is.le`` (value, other)
|
||||
- ``is.lt`` (value, other)
|
||||
- ``is.within`` (value, start, finish)
|
||||
|
||||
### object
|
||||
|
||||
- ``is.object`` (value)
|
||||
|
||||
### regexp
|
||||
|
||||
- ``is.regexp`` (value)
|
||||
|
||||
### string
|
||||
|
||||
- ``is.string`` (value)
|
||||
|
||||
### encoded binary
|
||||
|
||||
- ``is.base64`` (value)
|
||||
- ``is.hex`` (value)
|
||||
|
||||
### ES6 Symbols
|
||||
- ``is.symbol`` (value)
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Jordan Harband](https://github.com/ljharb)
|
||||
|
||||
[npm-url]: https://npmjs.org/package/is
|
||||
[npm-version-svg]: http://versionbadg.es/enricomarino/is.svg
|
||||
[travis-svg]: https://travis-ci.org/enricomarino/is.svg
|
||||
[travis-url]: https://travis-ci.org/enricomarino/is
|
||||
[deps-svg]: https://david-dm.org/enricomarino/is.svg
|
||||
[deps-url]: https://david-dm.org/enricomarino/is
|
||||
[dev-deps-svg]: https://david-dm.org/enricomarino/is/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/enricomarino/is#info=devDependencies
|
||||
[testling-png]: https://ci.testling.com/enricomarino/is.png
|
||||
[testling-url]: https://ci.testling.com/enricomarino/is
|
||||
[npm-badge-png]: https://nodei.co/npm/is.png?downloads=true&stars=true
|
||||
[license-image]: http://img.shields.io/npm/l/is.svg
|
||||
[license-url]: LICENSE.md
|
||||
[downloads-image]: http://img.shields.io/npm/dm/is.svg
|
||||
[downloads-url]: http://npm-stat.com/charts.html?package=is
|
||||
8
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/component.json
generated
vendored
Normal file
8
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/component.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "is",
|
||||
"repo": "enricomarino/is",
|
||||
"description": "The definitive type testing library",
|
||||
"version": "2.2.0",
|
||||
"dependencies": {},
|
||||
"scripts": ["index.js"]
|
||||
}
|
||||
761
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/index.js
generated
vendored
Normal file
761
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/index.js
generated
vendored
Normal file
@@ -0,0 +1,761 @@
|
||||
/* globals window, HTMLElement */
|
||||
/**!
|
||||
* is
|
||||
* the definitive JavaScript type testing library
|
||||
*
|
||||
* @copyright 2013-2014 Enrico Marino / Jordan Harband
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
var objProto = Object.prototype;
|
||||
var owns = objProto.hasOwnProperty;
|
||||
var toStr = objProto.toString;
|
||||
var symbolValueOf;
|
||||
if (typeof Symbol === 'function') {
|
||||
symbolValueOf = Symbol.prototype.valueOf;
|
||||
}
|
||||
var isActualNaN = function (value) {
|
||||
return value !== value;
|
||||
};
|
||||
var NON_HOST_TYPES = {
|
||||
'boolean': 1,
|
||||
number: 1,
|
||||
string: 1,
|
||||
undefined: 1
|
||||
};
|
||||
|
||||
var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
|
||||
var hexRegex = /^[A-Fa-f0-9]+$/;
|
||||
|
||||
/**
|
||||
* Expose `is`
|
||||
*/
|
||||
|
||||
var is = module.exports = {};
|
||||
|
||||
/**
|
||||
* Test general.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.type
|
||||
* Test if `value` is a type of `type`.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @param {String} type type
|
||||
* @return {Boolean} true if `value` is a type of `type`, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.a = is.type = function (value, type) {
|
||||
return typeof value === type;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.defined
|
||||
* Test if `value` is defined.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if 'value' is defined, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.defined = function (value) {
|
||||
return typeof value !== 'undefined';
|
||||
};
|
||||
|
||||
/**
|
||||
* is.empty
|
||||
* Test if `value` is empty.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is empty, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.empty = function (value) {
|
||||
var type = toStr.call(value);
|
||||
var key;
|
||||
|
||||
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {
|
||||
return value.length === 0;
|
||||
}
|
||||
|
||||
if (type === '[object Object]') {
|
||||
for (key in value) {
|
||||
if (owns.call(value, key)) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return !value;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.equal
|
||||
* Test if `value` is equal to `other`.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @param {Mixed} other value to compare with
|
||||
* @return {Boolean} true if `value` is equal to `other`, false otherwise
|
||||
*/
|
||||
|
||||
is.equal = function equal(value, other) {
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var type = toStr.call(value);
|
||||
var key;
|
||||
|
||||
if (type !== toStr.call(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type === '[object Object]') {
|
||||
for (key in value) {
|
||||
if (!is.equal(value[key], other[key]) || !(key in other)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (key in other) {
|
||||
if (!is.equal(value[key], other[key]) || !(key in value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type === '[object Array]') {
|
||||
key = value.length;
|
||||
if (key !== other.length) {
|
||||
return false;
|
||||
}
|
||||
while (--key) {
|
||||
if (!is.equal(value[key], other[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type === '[object Function]') {
|
||||
return value.prototype === other.prototype;
|
||||
}
|
||||
|
||||
if (type === '[object Date]') {
|
||||
return value.getTime() === other.getTime();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.hosted
|
||||
* Test if `value` is hosted by `host`.
|
||||
*
|
||||
* @param {Mixed} value to test
|
||||
* @param {Mixed} host host to test with
|
||||
* @return {Boolean} true if `value` is hosted by `host`, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.hosted = function (value, host) {
|
||||
var type = typeof host[value];
|
||||
return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
|
||||
};
|
||||
|
||||
/**
|
||||
* is.instance
|
||||
* Test if `value` is an instance of `constructor`.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an instance of `constructor`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.instance = is['instanceof'] = function (value, constructor) {
|
||||
return value instanceof constructor;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.nil / is.null
|
||||
* Test if `value` is null.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is null, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.nil = is['null'] = function (value) {
|
||||
return value === null;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.undef / is.undefined
|
||||
* Test if `value` is undefined.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is undefined, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.undef = is.undefined = function (value) {
|
||||
return typeof value === 'undefined';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test arguments.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.args
|
||||
* Test if `value` is an arguments object.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.args = is.arguments = function (value) {
|
||||
var isStandardArguments = toStr.call(value) === '[object Arguments]';
|
||||
var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
|
||||
return isStandardArguments || isOldArguments;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test array.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.array
|
||||
* Test if 'value' is an array.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an array, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.array = Array.isArray || function (value) {
|
||||
return toStr.call(value) === '[object Array]';
|
||||
};
|
||||
|
||||
/**
|
||||
* is.arguments.empty
|
||||
* Test if `value` is an empty arguments object.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an empty arguments object, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
is.args.empty = function (value) {
|
||||
return is.args(value) && value.length === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.array.empty
|
||||
* Test if `value` is an empty array.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an empty array, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
is.array.empty = function (value) {
|
||||
return is.array(value) && value.length === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.arraylike
|
||||
* Test if `value` is an arraylike object.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.arraylike = function (value) {
|
||||
return !!value && !is.bool(value)
|
||||
&& owns.call(value, 'length')
|
||||
&& isFinite(value.length)
|
||||
&& is.number(value.length)
|
||||
&& value.length >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test boolean.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.bool
|
||||
* Test if `value` is a boolean.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a boolean, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.bool = is['boolean'] = function (value) {
|
||||
return toStr.call(value) === '[object Boolean]';
|
||||
};
|
||||
|
||||
/**
|
||||
* is.false
|
||||
* Test if `value` is false.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is false, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is['false'] = function (value) {
|
||||
return is.bool(value) && Boolean(Number(value)) === false;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.true
|
||||
* Test if `value` is true.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is true, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is['true'] = function (value) {
|
||||
return is.bool(value) && Boolean(Number(value)) === true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test date.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.date
|
||||
* Test if `value` is a date.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a date, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.date = function (value) {
|
||||
return toStr.call(value) === '[object Date]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test element.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.element
|
||||
* Test if `value` is an html element.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an HTML Element, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.element = function (value) {
|
||||
return value !== undefined
|
||||
&& typeof HTMLElement !== 'undefined'
|
||||
&& value instanceof HTMLElement
|
||||
&& value.nodeType === 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test error.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.error
|
||||
* Test if `value` is an error object.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an error object, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.error = function (value) {
|
||||
return toStr.call(value) === '[object Error]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.fn / is.function (deprecated)
|
||||
* Test if `value` is a function.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a function, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.fn = is['function'] = function (value) {
|
||||
var isAlert = typeof window !== 'undefined' && value === window.alert;
|
||||
return isAlert || toStr.call(value) === '[object Function]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test number.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.number
|
||||
* Test if `value` is a number.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a number, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.number = function (value) {
|
||||
return toStr.call(value) === '[object Number]';
|
||||
};
|
||||
|
||||
/**
|
||||
* is.infinite
|
||||
* Test if `value` is positive or negative infinity.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
is.infinite = function (value) {
|
||||
return value === Infinity || value === -Infinity;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.decimal
|
||||
* Test if `value` is a decimal number.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a decimal number, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.decimal = function (value) {
|
||||
return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.divisibleBy
|
||||
* Test if `value` is divisible by `n`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} n dividend
|
||||
* @return {Boolean} true if `value` is divisible by `n`, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.divisibleBy = function (value, n) {
|
||||
var isDividendInfinite = is.infinite(value);
|
||||
var isDivisorInfinite = is.infinite(n);
|
||||
var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
|
||||
return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* is.integer
|
||||
* Test if `value` is an integer.
|
||||
*
|
||||
* @param value to test
|
||||
* @return {Boolean} true if `value` is an integer, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.integer = is['int'] = function (value) {
|
||||
return is.number(value) && !isActualNaN(value) && value % 1 === 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.maximum
|
||||
* Test if `value` is greater than 'others' values.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Array} others values to compare with
|
||||
* @return {Boolean} true if `value` is greater than `others` values
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.maximum = function (value, others) {
|
||||
if (isActualNaN(value)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
} else if (!is.arraylike(others)) {
|
||||
throw new TypeError('second argument must be array-like');
|
||||
}
|
||||
var len = others.length;
|
||||
|
||||
while (--len >= 0) {
|
||||
if (value < others[len]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.minimum
|
||||
* Test if `value` is less than `others` values.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Array} others values to compare with
|
||||
* @return {Boolean} true if `value` is less than `others` values
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.minimum = function (value, others) {
|
||||
if (isActualNaN(value)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
} else if (!is.arraylike(others)) {
|
||||
throw new TypeError('second argument must be array-like');
|
||||
}
|
||||
var len = others.length;
|
||||
|
||||
while (--len >= 0) {
|
||||
if (value > others[len]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.nan
|
||||
* Test if `value` is not a number.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is not a number, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.nan = function (value) {
|
||||
return !is.number(value) || value !== value;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.even
|
||||
* Test if `value` is an even number.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @return {Boolean} true if `value` is an even number, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.even = function (value) {
|
||||
return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* is.odd
|
||||
* Test if `value` is an odd number.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @return {Boolean} true if `value` is an odd number, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.odd = function (value) {
|
||||
return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* is.ge
|
||||
* Test if `value` is greater than or equal to `other`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} other value to compare with
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.ge = function (value, other) {
|
||||
if (isActualNaN(value) || isActualNaN(other)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
}
|
||||
return !is.infinite(value) && !is.infinite(other) && value >= other;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.gt
|
||||
* Test if `value` is greater than `other`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} other value to compare with
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.gt = function (value, other) {
|
||||
if (isActualNaN(value) || isActualNaN(other)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
}
|
||||
return !is.infinite(value) && !is.infinite(other) && value > other;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.le
|
||||
* Test if `value` is less than or equal to `other`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} other value to compare with
|
||||
* @return {Boolean} if 'value' is less than or equal to 'other'
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.le = function (value, other) {
|
||||
if (isActualNaN(value) || isActualNaN(other)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
}
|
||||
return !is.infinite(value) && !is.infinite(other) && value <= other;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.lt
|
||||
* Test if `value` is less than `other`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} other value to compare with
|
||||
* @return {Boolean} if `value` is less than `other`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.lt = function (value, other) {
|
||||
if (isActualNaN(value) || isActualNaN(other)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
}
|
||||
return !is.infinite(value) && !is.infinite(other) && value < other;
|
||||
};
|
||||
|
||||
/**
|
||||
* is.within
|
||||
* Test if `value` is within `start` and `finish`.
|
||||
*
|
||||
* @param {Number} value value to test
|
||||
* @param {Number} start lower bound
|
||||
* @param {Number} finish upper bound
|
||||
* @return {Boolean} true if 'value' is is within 'start' and 'finish'
|
||||
* @api public
|
||||
*/
|
||||
is.within = function (value, start, finish) {
|
||||
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
|
||||
throw new TypeError('NaN is not a valid value');
|
||||
} else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
|
||||
throw new TypeError('all arguments must be numbers');
|
||||
}
|
||||
var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
|
||||
return isAnyInfinite || (value >= start && value <= finish);
|
||||
};
|
||||
|
||||
/**
|
||||
* Test object.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.object
|
||||
* Test if `value` is an object.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is an object, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.object = function (value) {
|
||||
return toStr.call(value) === '[object Object]';
|
||||
};
|
||||
|
||||
/**
|
||||
* is.hash
|
||||
* Test if `value` is a hash - a plain object literal.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a hash, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.hash = function (value) {
|
||||
return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test regexp.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.regexp
|
||||
* Test if `value` is a regular expression.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a regexp, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.regexp = function (value) {
|
||||
return toStr.call(value) === '[object RegExp]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test string.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.string
|
||||
* Test if `value` is a string.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if 'value' is a string, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.string = function (value) {
|
||||
return toStr.call(value) === '[object String]';
|
||||
};
|
||||
|
||||
/**
|
||||
* Test base64 string.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.base64
|
||||
* Test if `value` is a valid base64 encoded string.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.base64 = function (value) {
|
||||
return is.string(value) && (!value.length || base64Regex.test(value));
|
||||
};
|
||||
|
||||
/**
|
||||
* Test base64 string.
|
||||
*/
|
||||
|
||||
/**
|
||||
* is.hex
|
||||
* Test if `value` is a valid hex encoded string.
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if 'value' is a hex encoded string, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.hex = function (value) {
|
||||
return is.string(value) && (!value.length || hexRegex.test(value));
|
||||
};
|
||||
|
||||
/**
|
||||
* is.symbol
|
||||
* Test if `value` is an ES6 Symbol
|
||||
*
|
||||
* @param {Mixed} value value to test
|
||||
* @return {Boolean} true if `value` is a Symbol, false otherise
|
||||
* @api public
|
||||
*/
|
||||
|
||||
is.symbol = function (value) {
|
||||
return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';
|
||||
};
|
||||
93
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/package.json
generated
vendored
Normal file
93
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "is",
|
||||
"version": "3.1.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "npm run lint && node test/index.js",
|
||||
"coverage": "covert test/index.js",
|
||||
"coverage-quiet": "covert test/index.js --quiet",
|
||||
"lint": "npm run jscs && npm run eslint",
|
||||
"jscs": "jscs *.js */*.js",
|
||||
"eslint": "eslint *.js */*.js"
|
||||
},
|
||||
"author": {
|
||||
"name": "Enrico Marino",
|
||||
"url": "http://onirame.com"
|
||||
},
|
||||
"description": "the definitive JavaScript type testing library",
|
||||
"homepage": "https://github.com/enricomarino/is",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/enricomarino/is.git"
|
||||
},
|
||||
"keywords": [
|
||||
"util",
|
||||
"type",
|
||||
"test"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"url": "https://github.com/ljharb"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "^4.2.0",
|
||||
"foreach": "^2.0.5",
|
||||
"covert": "^1.1.0",
|
||||
"jscs": "^2.1.1",
|
||||
"eslint": "^1.5.0",
|
||||
"@ljharb/eslint-config": "^1.2.0"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0",
|
||||
"chrome/22.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/5.0.5..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"gitHead": "7b3ba15898119e90c3a8ef3b9d347fa70a4e8255",
|
||||
"bugs": {
|
||||
"url": "https://github.com/enricomarino/is/issues"
|
||||
},
|
||||
"_id": "is@3.1.0",
|
||||
"_shasum": "2945d205d691cbfe4833e3f8a11c8ae94673f2a7",
|
||||
"_from": "is@>=3.0.1 <4.0.0",
|
||||
"_npmVersion": "2.14.3",
|
||||
"_nodeVersion": "4.1.0",
|
||||
"_npmUser": {
|
||||
"name": "ljharb",
|
||||
"email": "ljharb@gmail.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "2945d205d691cbfe4833e3f8a11c8ae94673f2a7",
|
||||
"tarball": "http://registry.npmjs.org/is/-/is-3.1.0.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "ljharb",
|
||||
"email": "ljharb@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "enricomarino",
|
||||
"email": "enrico.marino@email.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/is/-/is-3.1.0.tgz"
|
||||
}
|
||||
636
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/test/index.js
generated
vendored
Normal file
636
node_modules/gulp-remote-src/node_modules/node.extend/node_modules/is/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,636 @@
|
||||
/* globals window, document */
|
||||
|
||||
var test = require('tape');
|
||||
var is = require('../index.js');
|
||||
|
||||
var forEach = require('foreach');
|
||||
var toStr = Object.prototype.toString;
|
||||
|
||||
test('is.type', function (t) {
|
||||
var booleans = [true, false];
|
||||
forEach(booleans, function (boolean) {
|
||||
t.ok(is.type(boolean, 'boolean'), '"' + boolean + '" is a boolean');
|
||||
});
|
||||
|
||||
var numbers = [1, 0 / 1, 0 / -1, NaN, Infinity, -Infinity];
|
||||
forEach(numbers, function (number) {
|
||||
t.ok(is.type(number, 'number'), '"' + number + '" is a number');
|
||||
});
|
||||
|
||||
var objects = [{}, null, new Date()];
|
||||
forEach(objects, function (object) {
|
||||
t.ok(is.type(object, 'object'), '"' + object + '" is an object');
|
||||
});
|
||||
|
||||
var strings = ['', 'abc'];
|
||||
forEach(strings, function (string) {
|
||||
t.ok(is.type(string, 'string'), '"' + string + '" is a string');
|
||||
});
|
||||
|
||||
t.ok(is.type(undefined, 'undefined'), 'undefined is undefined');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.undef', function (t) {
|
||||
t.ok(is.undef(), 'absent undefined is undefined');
|
||||
t.ok(is.undef(undefined), 'literal undefined is undefined');
|
||||
t.notOk(is.undef(null), 'null is not undefined');
|
||||
t.notOk(is.undef({}), 'object is not undefined');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.defined', function (t) {
|
||||
t.notOk(is.defined(), 'undefined is not defined');
|
||||
t.ok(is.defined(null), 'null is defined');
|
||||
t.ok(is.defined({}), 'object is undefined');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.empty', function (t) {
|
||||
t.ok(is.empty(''), 'empty string is empty');
|
||||
t.ok(is.empty(Object('')), 'empty String object is empty');
|
||||
t.ok(is.empty([]), 'empty array is empty');
|
||||
t.ok(is.empty({}), 'empty object is empty');
|
||||
t.ok(is.empty(null), 'null is empty');
|
||||
t.ok(is.empty(), 'undefined is empty');
|
||||
t.ok(is.empty(undefined), 'undefined is empty');
|
||||
t.ok(is.empty(false), 'false is empty');
|
||||
t.ok(is.empty(0), '0 is empty');
|
||||
t.ok(is.empty(NaN), 'nan is empty');
|
||||
(function () { t.ok(is.empty(arguments), 'empty arguments is empty'); }());
|
||||
t.notOk(is.empty({ a: 1 }), 'nonempty object is not empty');
|
||||
t.notOk(is.empty(true), 'true is not empty');
|
||||
t.notOk(is.empty(/a/g), 'regex is not empty');
|
||||
t.notOk(is.empty(new Date()), 'date is not empty');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.equal', function (t) {
|
||||
t.test('primitives', function (pt) {
|
||||
var primitives = [true, false, undefined, null, '', 'foo', 0, Infinity, -Infinity];
|
||||
pt.plan(primitives.length);
|
||||
for (var i = 0; i < primitives.length; ++i) {
|
||||
pt.ok(is.equal(primitives[i], primitives[i]), 'primitives are equal to themselves: ' + primitives[i]);
|
||||
}
|
||||
pt.end();
|
||||
});
|
||||
|
||||
t.test('arrays', function (at) {
|
||||
at.ok(is.equal([1, 2, 3], [1, 2, 3]), 'arrays are shallowly equal');
|
||||
at.ok(is.equal([1, 2, [3, 4]], [1, 2, [3, 4]]), 'arrays are deep equal');
|
||||
at.notOk(is.equal([1, 2], [2, 3]), 'inequal arrays are not equal');
|
||||
at.notOk(is.equal([1, 2, 3], [2, 3]), 'inequal length arrays are not equal');
|
||||
|
||||
var arr = [1, 2];
|
||||
at.ok(is.equal(arr, arr), 'array is equal to itself');
|
||||
|
||||
at.end();
|
||||
});
|
||||
|
||||
t.test('dates', function (dt) {
|
||||
dt.plan(2);
|
||||
var now = new Date();
|
||||
dt.ok(is.equal(now, new Date(now.getTime())), 'two equal date objects are equal');
|
||||
setTimeout(function () {
|
||||
dt.notOk(is.equal(now, new Date()), 'two inequal date objects are not equal');
|
||||
dt.end();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
t.test('plain objects', function (ot) {
|
||||
ot.ok(is.equal({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 }), 'objects are shallowly equal');
|
||||
ot.ok(is.equal({ a: { b: 1 } }, { a: { b: 1 } }), 'objects are deep equal');
|
||||
ot.notOk(is.equal({ a: 1 }, { a: 2 }), 'inequal objects are not equal');
|
||||
ot.end();
|
||||
});
|
||||
|
||||
t.test('object instances', function (ot) {
|
||||
var F = function F() {
|
||||
this.foo = 'bar';
|
||||
};
|
||||
F.prototype = {};
|
||||
var G = function G() {
|
||||
this.foo = 'bar';
|
||||
};
|
||||
var f = new F();
|
||||
var g = new G();
|
||||
|
||||
ot.ok(is.equal(f, f), 'the same object instances are equal');
|
||||
ot.ok(is.equal(f, new F()), 'two object instances are equal when the prototype and props are the same');
|
||||
ot.ok(is.equal(f, new G()), 'two object instances are equal when the prototype is not the same, but props are');
|
||||
|
||||
g.bar = 'baz';
|
||||
ot.notOk(is.equal(f, g), 'object instances are not equal when the prototype and props are not the same');
|
||||
ot.notOk(is.equal(g, f), 'object instances are not equal when the prototype and props are not the same');
|
||||
ot.end();
|
||||
});
|
||||
|
||||
t.test('functions', function (ft) {
|
||||
var F = function () {};
|
||||
F.prototype = {};
|
||||
var G = function () {};
|
||||
G.prototype = new Date();
|
||||
|
||||
ft.notEqual(F.prototype, G.prototype, 'F and G have different prototypes');
|
||||
ft.notOk(is.equal(F, G), 'two functions are not equal when the prototype is not the same');
|
||||
|
||||
var H = function () {};
|
||||
H.prototype = F.prototype;
|
||||
|
||||
ft.equal(F.prototype, H.prototype, 'F and H have the same prototype');
|
||||
ft.ok(is.equal(F, H), 'two functions are equal when the prototype is the same');
|
||||
ft.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.hosted', function (t) {
|
||||
t.ok(is.hosted('a', { a: {} }), 'object is hosted');
|
||||
t.ok(is.hosted('a', { a: [] }), 'array is hosted');
|
||||
t.ok(is.hosted('a', { a: function () {} }), 'function is hosted');
|
||||
t.notOk(is.hosted('a', { a: true }), 'boolean value is not hosted');
|
||||
t.notOk(is.hosted('a', { a: false }), 'boolean value is not hosted');
|
||||
t.notOk(is.hosted('a', { a: 3 }), 'number value is not hosted');
|
||||
t.notOk(is.hosted('a', { a: undefined }), 'undefined value is not hosted');
|
||||
t.notOk(is.hosted('a', { a: 'abc' }), 'string value is not hosted');
|
||||
t.notOk(is.hosted('a', { a: null }), 'null value is not hosted');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.instance', function (t) {
|
||||
t.ok(is.instance(new Date(), Date), 'new Date is instanceof Date');
|
||||
var F = function () {};
|
||||
t.ok(is.instance(new F(), F), 'new constructor is instanceof constructor');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.nil', function (t) {
|
||||
var isNull = is.nil;
|
||||
t.equal(isNull, is['null'], 'is.nil is the same as is.null');
|
||||
t.ok(isNull(null), 'null is null');
|
||||
t.notOk(isNull(undefined), 'undefined is not null');
|
||||
t.notOk(isNull({}), 'object is not null');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.args', function (t) {
|
||||
t.notOk(is.args([]), 'array is not arguments');
|
||||
(function () { t.ok(is.args(arguments), 'arguments is arguments'); }());
|
||||
(function () { t.notOk(is.args(Array.prototype.slice.call(arguments)), 'sliced arguments is not arguments'); }());
|
||||
var fakeOldArguments = {
|
||||
callee: function () {},
|
||||
length: 3
|
||||
};
|
||||
t.ok(is.args(fakeOldArguments), 'old-style arguments object is arguments');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.args.empty', function (t) {
|
||||
t.notOk(is.args.empty([]), 'empty array is not empty arguments');
|
||||
(function () { t.ok(is.args.empty(arguments), 'empty arguments is empty arguments'); }());
|
||||
(function () { t.notOk(is.args.empty(Array.prototype.slice.call(arguments)), 'empty sliced arguments is not empty arguments'); }());
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.array', function (t) {
|
||||
t.ok(is.array([]), 'array is array');
|
||||
(function () { t.ok(is.array(Array.prototype.slice.call(arguments)), 'sliced arguments is array'); }());
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.array.empty', function (t) {
|
||||
t.ok(is.array.empty([]), 'empty array is empty array');
|
||||
(function () { t.notOk(is.array.empty(arguments), 'empty arguments is not empty array'); }());
|
||||
(function () { t.ok(is.array.empty(Array.prototype.slice.call(arguments)), 'empty sliced arguments is empty array'); }());
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.isarraylike', function (t) {
|
||||
t.notOk(is.arraylike(), 'undefined is not array-like');
|
||||
t.notOk(is.arraylike(null), 'null is not array-like');
|
||||
t.notOk(is.arraylike(false), 'false is not array-like');
|
||||
t.notOk(is.arraylike(true), 'true is not array-like');
|
||||
t.ok(is.arraylike({ length: 0 }), 'object with zero length is array-like');
|
||||
t.ok(is.arraylike({ length: 1 }), 'object with positive length is array-like');
|
||||
t.notOk(is.arraylike({ length: -1 }), 'object with negative length is not array-like');
|
||||
t.notOk(is.arraylike({ length: NaN }), 'object with NaN length is not array-like');
|
||||
t.notOk(is.arraylike({ length: 'foo' }), 'object with string length is not array-like');
|
||||
t.notOk(is.arraylike({ length: '' }), 'object with empty string length is not array-like');
|
||||
t.ok(is.arraylike([]), 'array is array-like');
|
||||
(function () { t.ok(is.arraylike(arguments), 'empty arguments is array-like'); }());
|
||||
(function () { t.ok(is.arraylike(arguments), 'nonempty arguments is array-like'); }(1, 2, 3));
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.bool', function (t) {
|
||||
t.ok(is.bool(true), 'literal true is a boolean');
|
||||
t.ok(is.bool(false), 'literal false is a boolean');
|
||||
t.ok(is.bool(Object(true)), 'object true is a boolean');
|
||||
t.ok(is.bool(Object(false)), 'object false is a boolean');
|
||||
t.notOk(is.bool(), 'undefined is not a boolean');
|
||||
t.notOk(is.bool(null), 'null is not a boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.false', function (t) {
|
||||
var isFalse = is['false'];
|
||||
t.ok(isFalse(false), 'false is false');
|
||||
t.ok(isFalse(Object(false)), 'object false is false');
|
||||
t.notOk(isFalse(true), 'true is not false');
|
||||
t.notOk(isFalse(), 'undefined is not false');
|
||||
t.notOk(isFalse(null), 'null is not false');
|
||||
t.notOk(isFalse(''), 'empty string is not false');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.true', function (t) {
|
||||
var isTrue = is['true'];
|
||||
t.ok(isTrue(true), 'true is true');
|
||||
t.ok(isTrue(Object(true)), 'object true is true');
|
||||
t.notOk(isTrue(false), 'false is not true');
|
||||
t.notOk(isTrue(), 'undefined is not true');
|
||||
t.notOk(isTrue(null), 'null is not true');
|
||||
t.notOk(isTrue(''), 'empty string is not true');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.date', function (t) {
|
||||
t.ok(is.date(new Date()), 'new Date is date');
|
||||
t.notOk(is.date(), 'undefined is not date');
|
||||
t.notOk(is.date(null), 'null is not date');
|
||||
t.notOk(is.date(''), 'empty string is not date');
|
||||
var nowTS = (new Date()).getTime();
|
||||
t.notOk(is.date(nowTS), 'timestamp is not date');
|
||||
var F = function () {};
|
||||
F.prototype = new Date();
|
||||
t.notOk(is.date(new F()), 'Date subtype is not date');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.element', function (t) {
|
||||
t.notOk(is.element(), 'undefined is not element');
|
||||
if (typeof HTMLElement !== 'undefined') {
|
||||
var element = document.createElement('div');
|
||||
t.ok(is.element(element), 'HTMLElement is element');
|
||||
t.notOk(is.element({ nodeType: 1 }), 'object with nodeType is not element');
|
||||
} else {
|
||||
t.ok(true, 'Skipping is.element test in a non-browser environment');
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.error', function (t) {
|
||||
var err = new Error('foo');
|
||||
t.ok(is.error(err), 'Error is error');
|
||||
t.notOk(is.error({}), 'object is not error');
|
||||
var objWithErrorToString = { toString: function () { return '[object Error]'; } };
|
||||
t.equal(String(objWithErrorToString), toStr.call(new Error()), 'obj has Error\'s toString');
|
||||
t.notOk(is.error(objWithErrorToString), 'object with Error\'s toString is not error');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.fn', function (t) {
|
||||
t.equal(is['function'], is.fn, 'alias works');
|
||||
t.ok(is.fn(function () {}), 'function is function');
|
||||
if (typeof window !== 'undefined') {
|
||||
// in IE7/8, typeof alert === 'object'
|
||||
t.ok(is.fn(window.alert), 'window.alert is function');
|
||||
}
|
||||
t.notOk(is.fn({}), 'object is not function');
|
||||
t.notOk(is.fn(null), 'null is not function');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.number', function (t) {
|
||||
t.ok(is.number(0), 'positive zero is number');
|
||||
t.ok(is.number(0 / -1), 'negative zero is number');
|
||||
t.ok(is.number(3), 'three is number');
|
||||
t.ok(is.number(NaN), 'NaN is number');
|
||||
t.ok(is.number(Infinity), 'infinity is number');
|
||||
t.ok(is.number(-Infinity), 'negative infinity is number');
|
||||
t.ok(is.number(Object(42)), 'object number is number');
|
||||
t.notOk(is.number(), 'undefined is not number');
|
||||
t.notOk(is.number(null), 'null is not number');
|
||||
t.notOk(is.number(true), 'true is not number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.infinite', function (t) {
|
||||
t.ok(is.infinite(Infinity), 'positive infinity is infinite');
|
||||
t.ok(is.infinite(-Infinity), 'negative infinity is infinite');
|
||||
t.notOk(is.infinite(NaN), 'NaN is not infinite');
|
||||
t.notOk(is.infinite(0), 'a number is not infinite');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.decimal', function (t) {
|
||||
t.ok(is.decimal(1.1), 'decimal is decimal');
|
||||
t.notOk(is.decimal(0), 'zero is not decimal');
|
||||
t.notOk(is.decimal(1), 'integer is not decimal');
|
||||
t.notOk(is.decimal(NaN), 'NaN is not decimal');
|
||||
t.notOk(is.decimal(Infinity), 'Infinity is not decimal');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.divisibleBy', function (t) {
|
||||
t.ok(is.divisibleBy(4, 2), '4 is divisible by 2');
|
||||
t.ok(is.divisibleBy(4, 2), '4 is divisible by 2');
|
||||
t.ok(is.divisibleBy(0, 1), '0 is divisible by 1');
|
||||
t.ok(is.divisibleBy(Infinity, 1), 'infinity is divisible by anything');
|
||||
t.ok(is.divisibleBy(1, Infinity), 'anything is divisible by infinity');
|
||||
t.ok(is.divisibleBy(Infinity, Infinity), 'infinity is divisible by infinity');
|
||||
t.notOk(is.divisibleBy(1, 0), '1 is not divisible by 0');
|
||||
t.notOk(is.divisibleBy(NaN, 1), 'NaN is not divisible by 1');
|
||||
t.notOk(is.divisibleBy(1, NaN), '1 is not divisible by NaN');
|
||||
t.notOk(is.divisibleBy(NaN, NaN), 'NaN is not divisible by NaN');
|
||||
t.notOk(is.divisibleBy(1, 3), '1 is not divisible by 3');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.integer', function (t) {
|
||||
t.ok(is.integer(0), '0 is integer');
|
||||
t.ok(is.integer(3), '3 is integer');
|
||||
t.notOk(is.integer(1.1), '1.1 is not integer');
|
||||
t.notOk(is.integer(NaN), 'NaN is not integer');
|
||||
t.notOk(is.integer(Infinity), 'infinity is not integer');
|
||||
t.notOk(is.integer(null), 'null is not integer');
|
||||
t.notOk(is.integer(), 'undefined is not integer');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.maximum', function (t) {
|
||||
t.ok(is.maximum(3, [3, 2, 1]), '3 is maximum of [3,2,1]');
|
||||
t.ok(is.maximum(3, [1, 2, 3]), '3 is maximum of [1,2,3]');
|
||||
t.ok(is.maximum(4, [1, 2, 3]), '4 is maximum of [1,2,3]');
|
||||
t.ok(is.maximum('c', ['a', 'b', 'c']), 'c is maximum of [a,b,c]');
|
||||
t.notOk(is.maximum(2, [1, 2, 3]), '2 is not maximum of [1,2,3]');
|
||||
|
||||
var nanError = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.maximum(NaN); }, nanError, 'throws when first value is NaN');
|
||||
|
||||
var error = new TypeError('second argument must be array-like');
|
||||
t['throws'](function () { return is.maximum(2, null); }, error, 'throws when second value is not array-like');
|
||||
t['throws'](function () { return is.maximum(2, {}); }, error, 'throws when second value is not array-like');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.minimum', function (t) {
|
||||
t.ok(is.minimum(1, [1, 2, 3]), '1 is minimum of [1,2,3]');
|
||||
t.ok(is.minimum(0, [1, 2, 3]), '0 is minimum of [1,2,3]');
|
||||
t.ok(is.minimum('a', ['a', 'b', 'c']), 'a is minimum of [a,b,c]');
|
||||
t.notOk(is.minimum(2, [1, 2, 3]), '2 is not minimum of [1,2,3]');
|
||||
|
||||
var nanError = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.minimum(NaN); }, nanError, 'throws when first value is NaN');
|
||||
|
||||
var error = new TypeError('second argument must be array-like');
|
||||
t['throws'](function () { return is.minimum(2, null); }, error, 'throws when second value is not array-like');
|
||||
t['throws'](function () { return is.minimum(2, {}); }, error, 'throws when second value is not array-like');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.nan', function (t) {
|
||||
t.ok(is.nan(NaN), 'NaN is not a number');
|
||||
t.ok(is.nan('abc'), 'string is not a number');
|
||||
t.ok(is.nan(true), 'boolean is not a number');
|
||||
t.ok(is.nan({}), 'object is not a number');
|
||||
t.ok(is.nan([]), 'array is not a number');
|
||||
t.ok(is.nan(function () {}), 'function is not a number');
|
||||
t.notOk(is.nan(0), 'zero is a number');
|
||||
t.notOk(is.nan(3), 'three is a number');
|
||||
t.notOk(is.nan(1.1), '1.1 is a number');
|
||||
t.notOk(is.nan(Infinity), 'infinity is a number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.even', function (t) {
|
||||
t.ok(is.even(0), 'zero is even');
|
||||
t.ok(is.even(2), 'two is even');
|
||||
t.ok(is.even(Infinity), 'infinity is even');
|
||||
t.notOk(is.even(1), '1 is not even');
|
||||
t.notOk(is.even(), 'undefined is not even');
|
||||
t.notOk(is.even(null), 'null is not even');
|
||||
t.notOk(is.even(NaN), 'NaN is not even');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.odd', function (t) {
|
||||
t.ok(is.odd(1), 'zero is odd');
|
||||
t.ok(is.odd(3), 'two is odd');
|
||||
t.ok(is.odd(Infinity), 'infinity is odd');
|
||||
t.notOk(is.odd(0), '0 is not odd');
|
||||
t.notOk(is.odd(2), '2 is not odd');
|
||||
t.notOk(is.odd(), 'undefined is not odd');
|
||||
t.notOk(is.odd(null), 'null is not odd');
|
||||
t.notOk(is.odd(NaN), 'NaN is not odd');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.ge', function (t) {
|
||||
t.ok(is.ge(3, 2), '3 is greater than 2');
|
||||
t.notOk(is.ge(2, 3), '2 is not greater than 3');
|
||||
t.ok(is.ge(3, 3), '3 is greater than or equal to 3');
|
||||
t.ok(is.ge('abc', 'a'), 'abc is greater than a');
|
||||
t.ok(is.ge('abc', 'abc'), 'abc is greater than or equal to abc');
|
||||
t.notOk(is.ge('a', 'abc'), 'a is not greater than abc');
|
||||
t.notOk(is.ge(Infinity, 0), 'infinity is not greater than anything');
|
||||
t.notOk(is.ge(0, Infinity), 'anything is not greater than infinity');
|
||||
var error = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.ge(NaN, 2); }, error, 'throws when first value is NaN');
|
||||
t['throws'](function () { return is.ge(2, NaN); }, error, 'throws when second value is NaN');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.gt', function (t) {
|
||||
t.ok(is.gt(3, 2), '3 is greater than 2');
|
||||
t.notOk(is.gt(2, 3), '2 is not greater than 3');
|
||||
t.notOk(is.gt(3, 3), '3 is not greater than 3');
|
||||
t.ok(is.gt('abc', 'a'), 'abc is greater than a');
|
||||
t.notOk(is.gt('abc', 'abc'), 'abc is not greater than abc');
|
||||
t.notOk(is.gt('a', 'abc'), 'a is not greater than abc');
|
||||
t.notOk(is.gt(Infinity, 0), 'infinity is not greater than anything');
|
||||
t.notOk(is.gt(0, Infinity), 'anything is not greater than infinity');
|
||||
var error = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.gt(NaN, 2); }, error, 'throws when first value is NaN');
|
||||
t['throws'](function () { return is.gt(2, NaN); }, error, 'throws when second value is NaN');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.le', function (t) {
|
||||
t.ok(is.le(2, 3), '2 is lesser than or equal to 3');
|
||||
t.notOk(is.le(3, 2), '3 is not lesser than or equal to 2');
|
||||
t.ok(is.le(3, 3), '3 is lesser than or equal to 3');
|
||||
t.ok(is.le('a', 'abc'), 'a is lesser than or equal to abc');
|
||||
t.ok(is.le('abc', 'abc'), 'abc is lesser than or equal to abc');
|
||||
t.notOk(is.le('abc', 'a'), 'abc is not lesser than or equal to a');
|
||||
t.notOk(is.le(Infinity, 0), 'infinity is not lesser than or equal to anything');
|
||||
t.notOk(is.le(0, Infinity), 'anything is not lesser than or equal to infinity');
|
||||
var error = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.le(NaN, 2); }, error, 'throws when first value is NaN');
|
||||
t['throws'](function () { return is.le(2, NaN); }, error, 'throws when second value is NaN');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.lt', function (t) {
|
||||
t.ok(is.lt(2, 3), '2 is lesser than 3');
|
||||
t.notOk(is.lt(3, 2), '3 is not lesser than 2');
|
||||
t.notOk(is.lt(3, 3), '3 is not lesser than 3');
|
||||
t.ok(is.lt('a', 'abc'), 'a is lesser than abc');
|
||||
t.notOk(is.lt('abc', 'abc'), 'abc is not lesser than abc');
|
||||
t.notOk(is.lt('abc', 'a'), 'abc is not lesser than a');
|
||||
t.notOk(is.lt(Infinity, 0), 'infinity is not lesser than anything');
|
||||
t.notOk(is.lt(0, Infinity), 'anything is not lesser than infinity');
|
||||
var error = new TypeError('NaN is not a valid value');
|
||||
t['throws'](function () { return is.lt(NaN, 2); }, error, 'throws when first value is NaN');
|
||||
t['throws'](function () { return is.lt(2, NaN); }, error, 'throws when second value is NaN');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.within', function (t) {
|
||||
t.test('throws on NaN', function (st) {
|
||||
var nanError = new TypeError('NaN is not a valid value');
|
||||
st['throws'](function () { return is.within(NaN, 0, 0); }, nanError, 'throws when first value is NaN');
|
||||
st['throws'](function () { return is.within(0, NaN, 0); }, nanError, 'throws when second value is NaN');
|
||||
st['throws'](function () { return is.within(0, 0, NaN); }, nanError, 'throws when third value is NaN');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('throws on non-number', function (st) {
|
||||
var error = new TypeError('all arguments must be numbers');
|
||||
st['throws'](function () { return is.within('', 0, 0); }, error, 'throws when first value is string');
|
||||
st['throws'](function () { return is.within(0, '', 0); }, error, 'throws when second value is string');
|
||||
st['throws'](function () { return is.within(0, 0, ''); }, error, 'throws when third value is string');
|
||||
st['throws'](function () { return is.within({}, 0, 0); }, error, 'throws when first value is object');
|
||||
st['throws'](function () { return is.within(0, {}, 0); }, error, 'throws when second value is object');
|
||||
st['throws'](function () { return is.within(0, 0, {}); }, error, 'throws when third value is object');
|
||||
st['throws'](function () { return is.within(null, 0, 0); }, error, 'throws when first value is null');
|
||||
st['throws'](function () { return is.within(0, null, 0); }, error, 'throws when second value is null');
|
||||
st['throws'](function () { return is.within(0, 0, null); }, error, 'throws when third value is null');
|
||||
st['throws'](function () { return is.within(undefined, 0, 0); }, error, 'throws when first value is undefined');
|
||||
st['throws'](function () { return is.within(0, undefined, 0); }, error, 'throws when second value is undefined');
|
||||
st['throws'](function () { return is.within(0, 0, undefined); }, error, 'throws when third value is undefined');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.ok(is.within(2, 1, 3), '2 is between 1 and 3');
|
||||
t.ok(is.within(0, -1, 1), '0 is between -1 and 1');
|
||||
t.ok(is.within(2, 0, Infinity), 'infinity always returns true');
|
||||
t.ok(is.within(2, Infinity, 2), 'infinity always returns true');
|
||||
t.ok(is.within(Infinity, 0, 1), 'infinity always returns true');
|
||||
t.notOk(is.within(2, -1, -1), '2 is not between -1 and 1');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.object', function (t) {
|
||||
t.ok(is.object({}), 'object literal is object');
|
||||
t.notOk(is.object(), 'undefined is not an object');
|
||||
t.notOk(is.object(null), 'null is not an object');
|
||||
t.notOk(is.object(true), 'true is not an object');
|
||||
t.notOk(is.object(''), 'string is not an object');
|
||||
t.notOk(is.object(NaN), 'NaN is not an object');
|
||||
t.notOk(is.object(Object), 'object constructor is not an object');
|
||||
t.notOk(is.object(function () {}), 'function is not an object');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.hash', function (t) {
|
||||
t.ok(is.hash({}), 'empty object literal is hash');
|
||||
t.ok(is.hash({ 1: 2, a: 'b' }), 'object literal is hash');
|
||||
t.notOk(is.hash(), 'undefined is not a hash');
|
||||
t.notOk(is.hash(null), 'null is not a hash');
|
||||
t.notOk(is.hash(new Date()), 'date is not a hash');
|
||||
t.notOk(is.hash(Object('')), 'string object is not a hash');
|
||||
t.notOk(is.hash(''), 'string literal is not a hash');
|
||||
t.notOk(is.hash(Object(0)), 'number object is not a hash');
|
||||
t.notOk(is.hash(1), 'number literal is not a hash');
|
||||
t.notOk(is.hash(true), 'true is not a hash');
|
||||
t.notOk(is.hash(false), 'false is not a hash');
|
||||
t.notOk(is.hash(Object(false)), 'boolean obj is not hash');
|
||||
t.notOk(is.hash(false), 'literal false is not hash');
|
||||
t.notOk(is.hash(true), 'literal true is not hash');
|
||||
|
||||
t.test('commonJS environment', { skip: typeof module === 'undefined' }, function (st) {
|
||||
st.ok(is.hash(module.exports), 'module.exports is a hash');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('browser stuff', { skip: typeof window === 'undefined' }, function (st) {
|
||||
st.notOk(is.hash(window), 'window is not a hash');
|
||||
st.notOk(is.hash(document.createElement('div')), 'element is not a hash');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('node stuff', { skip: typeof process === 'undefined' }, function (st) {
|
||||
st.notOk(is.hash(global), 'global is not a hash');
|
||||
st.notOk(is.hash(process), 'process is not a hash');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.regexp', function (t) {
|
||||
t.ok(is.regexp(/a/g), 'regex literal is regex');
|
||||
t.ok(is.regexp(new RegExp('a', 'g')), 'regex object is regex');
|
||||
t.notOk(is.regexp(), 'undefined is not regex');
|
||||
t.notOk(is.regexp(function () {}), 'function is not regex');
|
||||
t.notOk(is.regexp('/a/g'), 'string regex is not regex');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.string', function (t) {
|
||||
t.ok(is.string('foo'), 'string literal is string');
|
||||
t.ok(is.string(Object('foo')), 'string object is string');
|
||||
t.notOk(is.string(), 'undefined is not string');
|
||||
t.notOk(is.string(String), 'string constructor is not string');
|
||||
var F = function () {};
|
||||
F.prototype = Object('');
|
||||
t.notOk(is.string(F), 'string subtype is not string');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.base64', function (t) {
|
||||
t.ok(is.base64('wxyzWXYZ/+=='), 'string is base64 encoded');
|
||||
t.ok(is.base64(''), 'zero length string is base64 encoded');
|
||||
t.notOk(is.base64('wxyzWXYZ123/+=='), 'string length not a multiple of four is not base64 encoded');
|
||||
t.notOk(is.base64('wxyzWXYZ1234|]=='), 'string with invalid characters is not base64 encoded');
|
||||
t.notOk(is.base64('wxyzWXYZ1234==/+'), 'string with = not at end is not base64 encoded');
|
||||
t.notOk(is.base64('wxyzWXYZ1234/==='), 'string ending with === is not base64 encoded');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.hex', function (t) {
|
||||
t.ok(is.hex('abcdABCD1234'), 'string is hex encoded');
|
||||
t.ok(is.hex(''), 'zero length string is hex encoded');
|
||||
t.notOk(is.hex('wxyzWXYZ1234/+=='), 'string with invalid characters is not hex encoded');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('is.symbol', function (t) {
|
||||
t.test('not symbols', function (st) {
|
||||
var notSymbols = [true, false, null, undefined, {}, [], function () {}, 42, NaN, Infinity, /a/g, '', 0, -0, new Error('error')];
|
||||
forEach(notSymbols, function (notSymbol) {
|
||||
st.notOk(is.symbol(notSymbol), notSymbol + ' is not symbol');
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('symbols', { skip: typeof Symbol !== 'function' }, function (st) {
|
||||
st.ok(is.symbol(Symbol('foo')), 'Symbol("foo") is symbol');
|
||||
|
||||
var notKnownSymbols = ['length', 'name', 'arguments', 'caller', 'prototype', 'for', 'keyFor'];
|
||||
var symbolKeys = Object.getOwnPropertyNames(Symbol).filter(function (name) {
|
||||
return notKnownSymbols.indexOf(name) < 0;
|
||||
});
|
||||
forEach(symbolKeys, function (symbolKey) {
|
||||
st.ok(is.symbol(Symbol[symbolKey]), symbolKey + ' is symbol');
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
92
node_modules/gulp-remote-src/node_modules/node.extend/package.json
generated
vendored
Normal file
92
node_modules/gulp-remote-src/node_modules/node.extend/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "node.extend",
|
||||
"version": "1.1.5",
|
||||
"description": "A port of jQuery.extend that actually works on node.js",
|
||||
"keywords": [
|
||||
"extend",
|
||||
"jQuery",
|
||||
"jQuery extend",
|
||||
"clone",
|
||||
"copy",
|
||||
"inherit"
|
||||
],
|
||||
"author": {
|
||||
"name": "dreamerslab",
|
||||
"email": "ben@dreamerslab.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"is": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^4.0.0",
|
||||
"covert": "^1.1.0",
|
||||
"jscs": "^1.13.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dreamerslab/node.extend.git"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband"
|
||||
}
|
||||
],
|
||||
"main": "index",
|
||||
"scripts": {
|
||||
"test": "npm run lint && node test/index.js && npm run coverage-quiet",
|
||||
"coverage": "covert test/index.js",
|
||||
"coverage-quiet": "covert test/index.js --quiet",
|
||||
"lint": "jscs *.js */*.js"
|
||||
},
|
||||
"engines": [
|
||||
"node >= 0.4"
|
||||
],
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest"
|
||||
]
|
||||
},
|
||||
"license": "(MIT OR GPL-2.0)",
|
||||
"gitHead": "e92f03dc1d62d8d18245a4200720f7e181663c0f",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dreamerslab/node.extend/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dreamerslab/node.extend#readme",
|
||||
"_id": "node.extend@1.1.5",
|
||||
"_shasum": "336bd4d9bf9f8a13028c153e67bf5dc506ac0093",
|
||||
"_from": "node.extend@>=1.1.2 <1.2.0",
|
||||
"_npmVersion": "2.10.1",
|
||||
"_nodeVersion": "2.1.0",
|
||||
"_npmUser": {
|
||||
"name": "ljharb",
|
||||
"email": "ljharb@gmail.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "336bd4d9bf9f8a13028c153e67bf5dc506ac0093",
|
||||
"tarball": "http://registry.npmjs.org/node.extend/-/node.extend-1.1.5.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dreamerslab",
|
||||
"email": "ben@dreamerslab.com"
|
||||
},
|
||||
{
|
||||
"name": "ljharb",
|
||||
"email": "ljharb@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.5.tgz"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user