Projektstart

This commit is contained in:
2026-01-22 15:49:12 +01:00
parent 7212eb6f7a
commit 57e5f652f8
10637 changed files with 2598792 additions and 64 deletions

28
backend/node_modules/fastseries/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,28 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
# Users Environment Variables
.lock-wscript

12
backend/node_modules/fastseries/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs"
- "4"
- "5"
after_script:
npm run coverage

14
backend/node_modules/fastseries/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,14 @@
Copyright (c) 2015, Matteo Collina <matteo.collina@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

128
backend/node_modules/fastseries/README.md generated vendored Normal file
View File

@@ -0,0 +1,128 @@
# fastseries
[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]
[![Coverage Status][coveralls-badge]][coveralls-url]
[![Dependency Status][david-badge]][david-url]
Zero-overhead series function call for node.js.
Also supports `each` and `map`!
Benchmark for doing 3 calls `setImmediate` 1 million times:
* non-reusable `setImmediate`: 3887ms
* `async.series`: 5981ms
* `async.eachSeries`: 5087ms
* `async.mapSeries`: 5540ms
* `neoAsync.series`: 4338ms
* `neoAsync.eachSeries`: 4195ms
* `neoAsync.mapSeries`: 4237ms
* `tiny-each-async`: 4575ms
* `fastseries` with results: 4096ms
* `fastseries` without results: 4063ms
* `fastseries` map: 4032ms
* `fastseries` each: 4168ms
These benchmarks where taken via `bench.js` on node 4.2.2, on a MacBook
Pro Retina 2014.
If you need zero-overhead parallel function call, check out
[fastparallel](http://npm.im/fastparallel).
[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)
## Example for series call
```js
var series = require('fastseries')({
// this is a function that will be called
// when a series completes
released: completed,
// if you want the results, then here you are
results: true
})
series(
{}, // what will be this in the functions
[something, something, something], // functions to call
42, // the first argument of the functions
done // the function to be called when the series ends
)
function late (arg, cb) {
console.log('finishing', arg)
cb(null, 'myresult-' + arg)
}
function something (arg, cb) {
setTimeout(late, 1000, arg, cb)
}
function done (err, results) {
console.log('series completed, results:', results)
}
function completed () {
console.log('series completed!')
}
```
## Example for each and map calls
```js
var series = require('fastseries')({
// this is a function that will be called
// when a series completes
released: completed,
// if you want the results, then here you are
// passing false disables map
results: true
})
series(
{}, // what will be this in the functions
something, // functions to call
[1, 2, 3], // the first argument of the functions
done // the function to be called when the series ends
)
function late (arg, cb) {
console.log('finishing', arg)
cb(null, 'myresult-' + arg)
}
function something (arg, cb) {
setTimeout(late, 1000, arg, cb)
}
function done (err, results) {
console.log('series completed, results:', results)
}
function completed () {
console.log('series completed!')
}
```
## Caveats
The `done` function will be called only once, even if more than one error happen.
This library works by caching the latest used function, so that running a new series
does not cause **any memory allocations**.
## License
ISC
[npm-badge]: https://badge.fury.io/js/fastseries.svg
[npm-url]: https://badge.fury.io/js/fastseries
[travis-badge]: https://api.travis-ci.org/mcollina/fastseries.svg
[travis-url]: https://travis-ci.org/mcollina/fastseries
[coveralls-badge]:https://coveralls.io/repos/mcollina/fastseries/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/mcollina/fastseries?branch=master
[david-badge]: https://david-dm.org/mcollina/fastseries.svg
[david-url]: https://david-dm.org/mcollina/fastseries

94
backend/node_modules/fastseries/bench.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
var max = 1000000
var series = require('./')()
var seriesNoResults = require('./')({ results: false })
var async = require('async')
var neo = require('neo-async')
var bench = require('fastbench')
var tinyEachAsync = require('tiny-each-async')
function benchFastSeries (done) {
series(null, [somethingP, somethingP, somethingP], 42, done)
}
function benchFastSeriesNoResults (done) {
seriesNoResults(null, [somethingP, somethingP, somethingP], 42, done)
}
function benchFastSeriesEach (done) {
seriesNoResults(null, somethingP, [1, 2, 3], done)
}
function benchFastSeriesEachResults (done) {
series(null, somethingP, [1, 2, 3], done)
}
function benchAsyncSeries (done) {
async.series([somethingA, somethingA, somethingA], done)
}
function benchAsyncEachSeries (done) {
async.eachSeries([1, 2, 3], somethingP, done)
}
function benchAsyncMapSeries (done) {
async.mapSeries([1, 2, 3], somethingP, done)
}
function benchNeoSeries (done) {
neo.series([somethingA, somethingA, somethingA], done)
}
function benchNeoEachSeries (done) {
neo.eachSeries([1, 2, 3], somethingP, done)
}
function benchNeoMapSeries (done) {
neo.mapSeries([1, 2, 3], somethingP, done)
}
function benchTinyEachAsync (done) {
tinyEachAsync([1, 2, 3], 1, somethingP, done)
}
var nextDone
var nextCount
function benchSetImmediate (done) {
nextCount = 3
nextDone = done
setImmediate(somethingImmediate)
}
function somethingImmediate () {
nextCount--
if (nextCount === 0) {
nextDone()
} else {
setImmediate(somethingImmediate)
}
}
function somethingP (arg, cb) {
setImmediate(cb)
}
function somethingA (cb) {
setImmediate(cb)
}
var run = bench([
benchSetImmediate,
benchAsyncSeries,
benchAsyncEachSeries,
benchAsyncMapSeries,
benchNeoSeries,
benchNeoEachSeries,
benchNeoMapSeries,
benchTinyEachAsync,
benchFastSeries,
benchFastSeriesNoResults,
benchFastSeriesEach,
benchFastSeriesEachResults
], max)
run(run)

45
backend/node_modules/fastseries/example.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
var series = require('./')({
// this is a function that will be called
// when a series completes
released: completed,
// we want results and errors
// passing false will make it faster!
results: true
})
series(
{}, // what will be this in the functions
[something, something, something], // functions to call
42, // the first argument of the functions
next // the function to be called when the series ends
)
function late (arg, cb) {
console.log('finishing', arg)
cb(null, 'myresult-' + arg)
}
function something (arg, cb) {
setTimeout(late, 1000, arg, cb)
}
function next (err, results) {
if (err) {
// do something here!
}
console.log('series completed, results:', results)
series({}, something, [1, 2, 3], done)
}
function done (err, results) {
if (err) {
// do something here!
}
console.log('series completed, results:', results)
}
function completed () {
console.log('series completed!')
}

46
backend/node_modules/fastseries/package.json generated vendored Normal file
View File

@@ -0,0 +1,46 @@
{
"name": "fastseries",
"version": "1.7.2",
"description": "Zero-overhead asynchronous series/each/map function calls",
"main": "series.js",
"scripts": {
"lint": "standard",
"test": "tape test.js | faucet",
"coverage": "istanbul cover tape test.js; cat coverage/lcov.info | coveralls"
},
"pre-commit": [
"lint",
"test"
],
"repository": {
"type": "git",
"url": "https://github.com/mcollina/fastseries.git"
},
"keywords": [
"series",
"fast",
"async"
],
"author": "Matteo Collina <hello@matteocollina.com>",
"license": "ISC",
"bugs": {
"url": "https://github.com/mcollina/fastseries/issues"
},
"homepage": "https://github.com/mcollina/fastseries",
"devDependencies": {
"async": "^1.5.0",
"coveralls": "^2.11.6",
"fastbench": "^1.0.0",
"faucet": "0.0.1",
"istanbul": "^0.4.1",
"neo-async": "^1.7.0",
"pre-commit": "^1.0.6",
"standard": "^5.4.1",
"tape": "^4.2.2",
"tiny-each-async": "^2.0.2"
},
"dependencies": {
"reusify": "^1.0.0",
"xtend": "^4.0.0"
}
}

126
backend/node_modules/fastseries/series.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
'use strict'
var xtend = require('xtend')
var reusify = require('reusify')
var defaults = {
released: nop,
results: true
}
function fastseries (options) {
options = xtend(defaults, options)
var released = options.released
var queue = reusify(options.results ? ResultsHolder : NoResultsHolder)
return series
function series (that, toCall, arg, done) {
var holder = queue.get()
holder._released = release
done = done || nop
if (toCall.length === 0) {
done.call(that)
release(holder)
} else {
holder._callback = done
if (toCall.call) {
holder._list = arg
holder._each = toCall
} else {
holder._list = toCall
holder._arg = arg
}
holder._callThat = that
holder.release()
}
}
function release (holder) {
queue.release(holder)
released()
}
}
function reset () {
this._list = null
this._arg = null
this._callThat = null
this._callback = nop
this._each = null
}
function NoResultsHolder () {
reset.call(this)
this.next = null
this._released = null
var that = this
var i = 0
this.release = function () {
if (i < that._list.length) {
if (that._each) {
makeCall(that._callThat, that._each, that._list[i++], that.release)
} else {
makeCall(that._callThat, that._list[i++], that._arg, that.release)
}
} else {
that._callback.call(that._callThat)
reset.call(that)
i = 0
that._released(that)
}
}
}
function ResultsHolder (_release) {
reset.call(this)
this._results = []
this.next = null
this._released = null
var that = this
var i = 0
this.release = function (err, result) {
if (i !== 0) that._results[i - 1] = result
if (!err && i < that._list.length) {
if (that._each) {
makeCall(that._callThat, that._each, that._list[i++], that.release)
} else {
makeCall(that._callThat, that._list[i++], that._arg, that.release)
}
} else {
that._callback.call(that._callThat, err, that._results)
reset.call(that)
that._results = []
i = 0
that._released(that)
}
}
}
function makeCall (that, cb, arg, release) {
if (that) {
if (cb.length === 1) {
cb.call(that, release)
} else {
cb.call(that, arg, release)
}
} else {
if (cb.length === 1) {
cb(release)
} else {
cb(arg, release)
}
}
}
function nop () { }
module.exports = fastseries

280
backend/node_modules/fastseries/test.js generated vendored Normal file
View File

@@ -0,0 +1,280 @@
var test = require('tape')
var series = require('./')
test('basically works', function (t) {
t.plan(8)
var instance = series({
released: released
})
var count = 0
var obj = {}
instance(obj, [build(0), build(1)], 42, function done () {
t.equal(count, 2, 'all functions must have completed')
})
function build (expected) {
return function something (arg, cb) {
t.equal(obj, this)
t.equal(arg, 42)
t.equal(expected, count)
setImmediate(function () {
count++
cb()
})
}
}
function released () {
t.pass()
}
})
test('accumulates results', function (t) {
t.plan(8)
var instance = series({
released: released
})
var count = 0
var obj = {}
instance(obj, [something, something], 42, function done (err, results) {
t.notOk(err, 'no error')
t.equal(count, 2, 'all functions must have completed')
t.deepEqual(results, [1, 2])
})
function something (arg, cb) {
t.equal(obj, this)
t.equal(arg, 42)
setImmediate(function () {
count++
cb(null, count)
})
}
function released () {
t.pass()
}
})
test('fowards errs', function (t) {
t.plan(4)
var instance = series({
released: released
})
var count = 0
var obj = {}
instance(obj, [somethingErr, something], 42, function done (err, results) {
t.ok(err, 'error exists')
t.equal(err.message, 'this is an err!')
t.equal(count, 1, 'only the first function must have completed')
})
function something (arg, cb) {
setImmediate(function () {
count++
cb(null, count)
})
}
function somethingErr (arg, cb) {
setImmediate(function () {
count++
cb(new Error('this is an err!'))
})
}
function released () {
t.pass()
}
})
test('does not forward errors or result with results:false flag', function (t) {
t.plan(8)
var instance = series({
released: released,
results: false
})
var count = 0
var obj = {}
instance(obj, [something, something], 42, function done (err, results) {
t.equal(err, undefined, 'no err')
t.equal(results, undefined, 'no err')
t.equal(count, 2, 'all functions must have completed')
})
function something (arg, cb) {
t.equal(obj, this)
t.equal(arg, 42)
setImmediate(function () {
count++
cb()
})
}
function released () {
t.pass()
}
})
test('should call done and released if an empty is passed', function (t) {
t.plan(2)
var instance = series({
released: released
})
var obj = {}
instance(obj, [], 42, function done () {
t.pass()
})
function released () {
t.pass()
}
})
test('each support', function (t) {
t.plan(8)
var instance = series({
released: released
})
var count = 0
var obj = {}
var args = [1, 2, 3]
var i = 0
instance(obj, something, [].concat(args), function done () {
t.equal(count, 3, 'all functions must have completed')
})
function something (arg, cb) {
t.equal(obj, this, 'this matches')
t.equal(args[i++], arg, 'the arg is correct')
setImmediate(function () {
count++
cb()
})
}
function released () {
t.pass()
}
})
test('call the callback with the given this', function (t) {
t.plan(1)
var instance = series()
var obj = {}
instance(obj, [build(), build()], 42, function done () {
t.equal(obj, this, 'this matches')
})
function build () {
return function something (arg, cb) {
setImmediate(cb)
}
}
})
test('call the callback with the given this with no results', function (t) {
t.plan(1)
var instance = series({ results: false })
var obj = {}
instance(obj, [build(), build()], 42, function done () {
t.equal(obj, this, 'this matches')
})
function build () {
return function something (arg, cb) {
setImmediate(cb)
}
}
})
test('call the callback with the given this with no data', function (t) {
t.plan(1)
var instance = series()
var obj = {}
instance(obj, [], 42, function done () {
t.equal(obj, this, 'this matches')
})
})
test('support no final callback', function (t) {
t.plan(6)
var instance = series()
var count = 0
var obj = {}
instance(obj, [build(0), build(1)], 42)
function build (expected) {
return function something (arg, cb) {
t.equal(obj, this)
t.equal(arg, 42)
t.equal(expected, count)
setImmediate(function () {
count++
cb()
})
}
}
})
test('call without arg if there is no arg with no results', function (t) {
t.plan(3)
var instance = series({
results: false
})
var count = 0
var obj = {}
instance(obj, [something, something], 42, function done () {
t.equal(count, 2, 'all functions must have completed')
})
function something (cb) {
t.equal(obj, this)
setImmediate(function () {
count++
cb()
})
}
})
test('call without arg if there is no arg with results', function (t) {
t.plan(3)
var instance = series()
var count = 0
var obj = {}
instance(obj, [something, something], 42, function done () {
t.equal(count, 2, 'all functions must have completed')
})
function something (cb) {
t.equal(obj, this)
setImmediate(function () {
count++
cb()
})
}
})