Initial import with skill sheet working
This commit is contained in:
21
node_modules/lead/LICENSE
generated
vendored
Normal file
21
node_modules/lead/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017, 2020-2021 Blaine Bublitz <blaine.bublitz@gmail.com> and Eric Schoffstall <yo@contra.io>
|
||||
|
||||
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.
|
52
node_modules/lead/README.md
generated
vendored
Normal file
52
node_modules/lead/README.md
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
<p align="center">
|
||||
<a href="https://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# lead
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Sink your streams.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var { Readable, Transform } = require('streamx');
|
||||
var sink = require('lead');
|
||||
|
||||
// Might be used as a Transform or Writeable
|
||||
var maybeThrough = new Transform({
|
||||
transform(chunk, cb) {
|
||||
// processing
|
||||
cb(null, chunk);
|
||||
},
|
||||
});
|
||||
|
||||
Readable.from(['hello', 'world'])
|
||||
// Sink it to behave like a Writeable
|
||||
.pipe(sink(maybeThrough));
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `sink(stream)`
|
||||
|
||||
Takes a `stream` to sink and returns the same stream. Sets up event listeners to infer if the stream is being used as a `Transform` or `Writeable` stream and sinks it on `nextTick` if necessary. If the stream is being used as a `Transform` stream but becomes unpiped, it will be sunk. Respects `pipe`, `on('data')` and `on('readable')` handlers.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[downloads-image]: https://img.shields.io/npm/dm/lead.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/lead
|
||||
[npm-image]: https://img.shields.io/npm/v/lead.svg?style=flat-square
|
||||
|
||||
[ci-url]: https://github.com/gulpjs/lead/actions?query=workflow:dev
|
||||
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/lead/dev?style=flat-square
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/lead
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/lead/master.svg?style=flat-square
|
||||
<!-- prettier-ignore-end -->
|
50
node_modules/lead/index.js
generated
vendored
Normal file
50
node_modules/lead/index.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
function hasListeners(stream) {
|
||||
return !!(stream.listenerCount('readable') || stream.listenerCount('data'));
|
||||
}
|
||||
|
||||
function sink(stream) {
|
||||
var sinkAdded = false;
|
||||
|
||||
function addSink() {
|
||||
if (sinkAdded) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasListeners(stream)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sinkAdded = true;
|
||||
stream.resume();
|
||||
}
|
||||
|
||||
function removeSink(evt) {
|
||||
if (evt !== 'readable' && evt !== 'data') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasListeners(stream)) {
|
||||
sinkAdded = false;
|
||||
}
|
||||
|
||||
process.nextTick(addSink);
|
||||
}
|
||||
|
||||
function markSink() {
|
||||
sinkAdded = true;
|
||||
}
|
||||
|
||||
stream.on('newListener', removeSink);
|
||||
stream.on('removeListener', removeSink);
|
||||
stream.on('piping', markSink);
|
||||
|
||||
// Sink the stream to start flowing
|
||||
// Do this on nextTick, it will flow at slowest speed of piped streams
|
||||
process.nextTick(addSink);
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
module.exports = sink;
|
50
node_modules/lead/package.json
generated
vendored
Normal file
50
node_modules/lead/package.json
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "lead",
|
||||
"version": "4.0.0",
|
||||
"description": "Sink your streams.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/lead",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-gulp": "^5.0.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"expect": "^27.4.2",
|
||||
"mocha": "^8.4.0",
|
||||
"nyc": "^15.1.0",
|
||||
"readable-stream": "^3.6.0",
|
||||
"streamx": "^2.12.0"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true
|
||||
},
|
||||
"keywords": [
|
||||
"streams",
|
||||
"sink",
|
||||
"through",
|
||||
"writeable"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user