mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-10-30 21:58:32 +00:00 
			
		
		
		
	update
This commit is contained in:
		
							
								
								
									
										2
									
								
								node_modules/async-limiter/.eslintignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/async-limiter/.eslintignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| coverage | ||||
| .nyc_output | ||||
							
								
								
									
										10
									
								
								node_modules/async-limiter/.nycrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								node_modules/async-limiter/.nycrc
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| { | ||||
|   "check-coverage": false, | ||||
|   "lines": 99, | ||||
|   "statements": 99, | ||||
|   "functions": 99, | ||||
|   "branches": 99, | ||||
|   "include": [ | ||||
|      "index.js" | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										9
									
								
								node_modules/async-limiter/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/async-limiter/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| language: node_js | ||||
| node_js: | ||||
|   - "6" | ||||
|   - "8" | ||||
|   - "10" | ||||
|   - "node" | ||||
| script: npm run travis | ||||
| cache: | ||||
|   yarn: true | ||||
							
								
								
									
										8
									
								
								node_modules/async-limiter/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/async-limiter/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| The MIT License (MIT) | ||||
| Copyright (c) 2017 Samuel Reed <samuel.trace.reed@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. | ||||
							
								
								
									
										67
									
								
								node_modules/async-limiter/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								node_modules/async-limiter/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| function Queue(options) { | ||||
|   if (!(this instanceof Queue)) { | ||||
|     return new Queue(options); | ||||
|   } | ||||
|  | ||||
|   options = options || {}; | ||||
|   this.concurrency = options.concurrency || Infinity; | ||||
|   this.pending = 0; | ||||
|   this.jobs = []; | ||||
|   this.cbs = []; | ||||
|   this._done = done.bind(this); | ||||
| } | ||||
|  | ||||
| var arrayAddMethods = [ | ||||
|   'push', | ||||
|   'unshift', | ||||
|   'splice' | ||||
| ]; | ||||
|  | ||||
| arrayAddMethods.forEach(function(method) { | ||||
|   Queue.prototype[method] = function() { | ||||
|     var methodResult = Array.prototype[method].apply(this.jobs, arguments); | ||||
|     this._run(); | ||||
|     return methodResult; | ||||
|   }; | ||||
| }); | ||||
|  | ||||
| Object.defineProperty(Queue.prototype, 'length', { | ||||
|   get: function() { | ||||
|     return this.pending + this.jobs.length; | ||||
|   } | ||||
| }); | ||||
|  | ||||
| Queue.prototype._run = function() { | ||||
|   if (this.pending === this.concurrency) { | ||||
|     return; | ||||
|   } | ||||
|   if (this.jobs.length) { | ||||
|     var job = this.jobs.shift(); | ||||
|     this.pending++; | ||||
|     job(this._done); | ||||
|     this._run(); | ||||
|   } | ||||
|  | ||||
|   if (this.pending === 0) { | ||||
|     while (this.cbs.length !== 0) { | ||||
|       var cb = this.cbs.pop(); | ||||
|       process.nextTick(cb); | ||||
|     } | ||||
|   } | ||||
| }; | ||||
|  | ||||
| Queue.prototype.onDone = function(cb) { | ||||
|   if (typeof cb === 'function') { | ||||
|     this.cbs.push(cb); | ||||
|     this._run(); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| function done() { | ||||
|   this.pending--; | ||||
|   this._run(); | ||||
| } | ||||
|  | ||||
| module.exports = Queue; | ||||
							
								
								
									
										74
									
								
								node_modules/async-limiter/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								node_modules/async-limiter/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| { | ||||
|   "_args": [ | ||||
|     [ | ||||
|       "async-limiter@1.0.1", | ||||
|       "/Users/tatiana/selfdefined" | ||||
|     ] | ||||
|   ], | ||||
|   "_from": "async-limiter@1.0.1", | ||||
|   "_id": "async-limiter@1.0.1", | ||||
|   "_inBundle": false, | ||||
|   "_integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", | ||||
|   "_location": "/async-limiter", | ||||
|   "_phantomChildren": {}, | ||||
|   "_requested": { | ||||
|     "type": "version", | ||||
|     "registry": true, | ||||
|     "raw": "async-limiter@1.0.1", | ||||
|     "name": "async-limiter", | ||||
|     "escapedName": "async-limiter", | ||||
|     "rawSpec": "1.0.1", | ||||
|     "saveSpec": null, | ||||
|     "fetchSpec": "1.0.1" | ||||
|   }, | ||||
|   "_requiredBy": [ | ||||
|     "/engine.io/ws", | ||||
|     "/socket.io/ws", | ||||
|     "/ws" | ||||
|   ], | ||||
|   "_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", | ||||
|   "_spec": "1.0.1", | ||||
|   "_where": "/Users/tatiana/selfdefined", | ||||
|   "author": { | ||||
|     "name": "Samuel Reed" | ||||
|   }, | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/strml/async-limiter/issues" | ||||
|   }, | ||||
|   "dependencies": {}, | ||||
|   "description": "asynchronous function queue with adjustable concurrency", | ||||
|   "devDependencies": { | ||||
|     "coveralls": "^3.0.3", | ||||
|     "eslint": "^5.16.0", | ||||
|     "eslint-plugin-mocha": "^5.3.0", | ||||
|     "intelli-espower-loader": "^1.0.1", | ||||
|     "mocha": "^6.1.4", | ||||
|     "nyc": "^14.1.1", | ||||
|     "power-assert": "^1.6.1" | ||||
|   }, | ||||
|   "homepage": "https://github.com/strml/async-limiter#readme", | ||||
|   "keywords": [ | ||||
|     "throttle", | ||||
|     "async", | ||||
|     "limiter", | ||||
|     "asynchronous", | ||||
|     "job", | ||||
|     "task", | ||||
|     "concurrency", | ||||
|     "concurrent" | ||||
|   ], | ||||
|   "license": "MIT", | ||||
|   "name": "async-limiter", | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git+https://github.com/strml/async-limiter.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls", | ||||
|     "example": "node example", | ||||
|     "lint": "eslint .", | ||||
|     "test": "mocha --require intelli-espower-loader test/", | ||||
|     "travis": "npm run lint && npm run test" | ||||
|   }, | ||||
|   "version": "1.0.1" | ||||
| } | ||||
							
								
								
									
										132
									
								
								node_modules/async-limiter/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								node_modules/async-limiter/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | ||||
| # Async-Limiter | ||||
|  | ||||
| A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue). | ||||
|  | ||||
| [](http://www.npmjs.org/async-limiter) | ||||
| [](https://travis-ci.org/STRML/async-limiter) | ||||
| [](https://coveralls.io/r/STRML/async-limiter) | ||||
|  | ||||
| This module exports a class `Limiter` that implements some of the `Array` API. | ||||
| Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods. | ||||
|  | ||||
| ## Motivation | ||||
|  | ||||
| Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when | ||||
| run at infinite concurrency. | ||||
|  | ||||
| In this case, it is actually faster, and takes far less memory, to limit concurrency. | ||||
|  | ||||
| This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would | ||||
| make this module faster or lighter, but new functionality is not desired. | ||||
|  | ||||
| Style should confirm to nodejs/node style. | ||||
|  | ||||
| ## Example | ||||
|  | ||||
| ``` javascript | ||||
| var Limiter = require('async-limiter') | ||||
|  | ||||
| var t = new Limiter({concurrency: 2}); | ||||
| var results = [] | ||||
|  | ||||
| // add jobs using the familiar Array API | ||||
| t.push(function (cb) { | ||||
|   results.push('two') | ||||
|   cb() | ||||
| }) | ||||
|  | ||||
| t.push( | ||||
|   function (cb) { | ||||
|     results.push('four') | ||||
|     cb() | ||||
|   }, | ||||
|   function (cb) { | ||||
|     results.push('five') | ||||
|     cb() | ||||
|   } | ||||
| ) | ||||
|  | ||||
| t.unshift(function (cb) { | ||||
|   results.push('one') | ||||
|   cb() | ||||
| }) | ||||
|  | ||||
| t.splice(2, 0, function (cb) { | ||||
|   results.push('three') | ||||
|   cb() | ||||
| }) | ||||
|  | ||||
| // Jobs run automatically. If you want a callback when all are done, | ||||
| // call 'onDone()'. | ||||
| t.onDone(function () { | ||||
|   console.log('all done:', results) | ||||
| }) | ||||
| ``` | ||||
|  | ||||
| ## Zlib Example | ||||
|  | ||||
| ```js | ||||
| const zlib = require('zlib'); | ||||
| const Limiter = require('async-limiter'); | ||||
|  | ||||
| const message = {some: "data"}; | ||||
| const payload = new Buffer(JSON.stringify(message)); | ||||
|  | ||||
| // Try with different concurrency values to see how this actually | ||||
| // slows significantly with higher concurrency! | ||||
| // | ||||
| // 5:        1398.607ms | ||||
| // 10:       1375.668ms | ||||
| // Infinity: 4423.300ms | ||||
| // | ||||
| const t = new Limiter({concurrency: 5}); | ||||
| function deflate(payload, cb) { | ||||
|   t.push(function(done) { | ||||
|     zlib.deflate(payload, function(err, buffer) { | ||||
|       done(); | ||||
|       cb(err, buffer); | ||||
|     }); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| console.time('deflate'); | ||||
| for(let i = 0; i < 30000; ++i) { | ||||
|   deflate(payload, function (err, buffer) {}); | ||||
| } | ||||
| t.onDone(function() { | ||||
|   console.timeEnd('deflate'); | ||||
| }); | ||||
| ``` | ||||
|  | ||||
| ## Install | ||||
|  | ||||
| `npm install async-limiter` | ||||
|  | ||||
| ## Test | ||||
|  | ||||
| `npm test` | ||||
|  | ||||
| ## API | ||||
|  | ||||
| ### `var t = new Limiter([opts])` | ||||
| Constructor. `opts` may contain inital values for: | ||||
| * `t.concurrency` | ||||
|  | ||||
| ## Instance methods | ||||
|  | ||||
| ### `t.onDone(fn)` | ||||
| `fn` will be called once and only once, when the queue is empty. | ||||
|  | ||||
| ## Instance methods mixed in from `Array` | ||||
| Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). | ||||
| ### `t.push(element1, ..., elementN)` | ||||
| ### `t.unshift(element1, ..., elementN)` | ||||
| ### `t.splice(index , howMany[, element1[, ...[, elementN]]])` | ||||
|  | ||||
| ## Properties | ||||
| ### `t.concurrency` | ||||
| Max number of jobs the queue should process concurrently, defaults to `Infinity`. | ||||
|  | ||||
| ### `t.length` | ||||
| Jobs pending + jobs to process (readonly). | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 tatianamac
					tatianamac