Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
'use strict';
var onetime = require('onetime');
var setImmediateShim = require('set-immediate-shim');
module.exports = function (arr, next, cb) {
var failed = false;
var count = 0;
cb = cb || function () {};
if (!Array.isArray(arr)) {
throw new TypeError('First argument must be an array');
}
if (typeof next !== 'function') {
throw new TypeError('Second argument must be a function');
}
var len = arr.length;
if (!len) {
cb();
return;
}
function callback(err) {
if (failed) {
return;
}
if (err !== undefined && err !== null) {
failed = true;
cb(err);
return;
}
if (++count === len) {
cb();
return;
}
}
for (var i = 0; i < len; i++) {
setImmediateShim(next, arr[i], i, onetime(callback, true));
}
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.

View File

@@ -0,0 +1,75 @@
{
"_from": "each-async@^1.0.0",
"_id": "each-async@1.1.1",
"_inBundle": false,
"_integrity": "sha1-3uUim98KtrogEqOV4bhpq/iBNHM=",
"_location": "/each-async",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "each-async@^1.0.0",
"name": "each-async",
"escapedName": "each-async",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/bin-wrapper",
"/download"
],
"_resolved": "https://registry.npmjs.org/each-async/-/each-async-1.1.1.tgz",
"_shasum": "dee5229bdf0ab6ba2012a395e1b869abf8813473",
"_spec": "each-async@^1.0.0",
"_where": "D:\\developments\\teaser-inertia\\nova-components\\NovaLeader\\node_modules\\download",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/each-async/issues"
},
"bundleDependencies": false,
"dependencies": {
"onetime": "^1.0.0",
"set-immediate-shim": "^1.0.0"
},
"deprecated": false,
"description": "Async concurrent iterator (async forEach)",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/each-async#readme",
"keywords": [
"each",
"async",
"asynchronous",
"iteration",
"iterate",
"loop",
"foreach",
"parallel",
"concurrent",
"array",
"flow",
"control flow"
],
"license": "MIT",
"name": "each-async",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/each-async.git"
},
"scripts": {
"test": "mocha --timeout 20000"
},
"version": "1.1.1"
}

View File

@@ -0,0 +1,62 @@
# each-async [![Build Status](https://travis-ci.org/sindresorhus/each-async.svg?branch=master)](https://travis-ci.org/sindresorhus/each-async)
> Async concurrent iterator (async forEach)
Like [async.each()](https://github.com/caolan/async#eacharr-iterator-callback), but tiny.
I often use `async.each()` for doing async operations when iterating, but I almost never use the other gadzillion methods in `async`.
Async iteration is one of the most used async control flow patterns.
## Install
```sh
$ npm install --save each-async
```
## Usage
```js
var eachAsync = require('each-async');
eachAsync(['foo','bar','baz'], function (item, index, done) {
console.log(item, index);
done();
}, function (error) {
console.log('finished');
});
//=> foo 0
//=> bar 1
//=> baz 2
//=> finished
```
## API
### eachAsync(array, callback, finishedCallback)
#### array
The array you want to iterate.
#### callback(item, index, done)
A function which is called for each item in the array with the following arguments:
- `item`: the current item in the array
- `index`: the current index
- `done([error])`: call this when you're done with an optional error. Supplying anything other than `undefined`/`null` will stop the iteration.
Note that order is not guaranteed since each item is handled concurrently.
#### finishedCallback(error)
A function which is called when the iteration is finished or on the first error. First argument is the error passed from `done()` in the `callback`.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)