forked from enviPath/enviPy
Current Dev State
This commit is contained in:
21
static/js/ketcher2/node_modules/map-limit/LICENSE.md
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/map-limit/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
## The MIT License (MIT) ##
|
||||
|
||||
Copyright (c) 2014 Hugh Kennedy
|
||||
|
||||
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.
|
||||
32
static/js/ketcher2/node_modules/map-limit/README.md
generated
vendored
Normal file
32
static/js/ketcher2/node_modules/map-limit/README.md
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# map-limit [](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/map-limit&title=map-limit&description=hughsk/map-limit%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[](http://github.com/hughsk/stability-badges) #
|
||||
|
||||
[async.mapLimit](https://github.com/caolan/async#maplimitarr-limit-iterator-callback)'s
|
||||
functionality available as a standalone npm module.
|
||||
|
||||
I often find myself pulling in [async](http://github.com/caolan/async) for this
|
||||
method alone, so in the spirit of breaking things into smaller pieces here's
|
||||
that method as a single thing you can require.
|
||||
|
||||
## Usage ##
|
||||
|
||||
[](https://nodei.co/npm/map-limit)
|
||||
|
||||
### `mapLimit(arr, limit, iterator, callback)` ###
|
||||
|
||||
The same as map only no more than "limit" iterators will be simultaneously
|
||||
running at any time.
|
||||
|
||||
Note that the items are not processed in batches, so there is no guarantee
|
||||
that the first "limit" iterator functions will complete before any others are
|
||||
started.
|
||||
|
||||
#### Arguments ####
|
||||
|
||||
* **arr** - An array to iterate over.
|
||||
* **limit** - The maximum number of iterators to run at any time.
|
||||
* **iterator(item, callback)** - A function to apply to each item in the array. The iterator is passed a callback(err, transformed) which must be called once it has completed with an error (which can be null) and a transformed item.
|
||||
* **callback(err, results)** - A callback which is called after all the iterator functions have finished, or an error has occurred. Results is an array of the transformed items from the original array.
|
||||
|
||||
## License ##
|
||||
|
||||
MIT. See [LICENSE.md](http://github.com/hughsk/map-limit/blob/master/LICENSE.md) for details.
|
||||
54
static/js/ketcher2/node_modules/map-limit/index.js
generated
vendored
Normal file
54
static/js/ketcher2/node_modules/map-limit/index.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
var once = require('once')
|
||||
var noop = function noop(){}
|
||||
|
||||
module.exports = mapLimit
|
||||
|
||||
function mapLimit(arr, limit, iterator, callback) {
|
||||
var complete = 0
|
||||
var aborted = false
|
||||
var results = []
|
||||
var queued = 0
|
||||
var l = arr.length
|
||||
var i = 0
|
||||
|
||||
callback = once(callback || noop)
|
||||
if (typeof iterator !== 'function') throw new Error(
|
||||
'Iterator function must be passed as the third argument'
|
||||
)
|
||||
|
||||
for (var r = 0; r < l; r++) {
|
||||
results[r] = null
|
||||
}
|
||||
|
||||
flush()
|
||||
|
||||
function flush() {
|
||||
if (complete === l)
|
||||
return callback(null, results)
|
||||
|
||||
while (queued < limit) {
|
||||
if (aborted) break
|
||||
if (i === l) break
|
||||
push()
|
||||
}
|
||||
}
|
||||
|
||||
function abort(err) {
|
||||
aborted = true
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
function push() {
|
||||
var idx = i++
|
||||
|
||||
queued += 1
|
||||
|
||||
iterator(arr[idx], function(err, result) {
|
||||
if (err) return abort(err)
|
||||
results[idx] = result
|
||||
complete += 1
|
||||
queued -= 1
|
||||
flush()
|
||||
})
|
||||
}
|
||||
}
|
||||
15
static/js/ketcher2/node_modules/map-limit/node_modules/once/LICENSE
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/map-limit/node_modules/once/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
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.
|
||||
51
static/js/ketcher2/node_modules/map-limit/node_modules/once/README.md
generated
vendored
Normal file
51
static/js/ketcher2/node_modules/map-limit/node_modules/once/README.md
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# once
|
||||
|
||||
Only call a function once.
|
||||
|
||||
## usage
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (file, cb) {
|
||||
cb = once(cb)
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Or add to the Function.prototype in a responsible way:
|
||||
|
||||
```javascript
|
||||
// only has to be done once
|
||||
require('once').proto()
|
||||
|
||||
function load (file, cb) {
|
||||
cb = cb.once()
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Ironically, the prototype feature makes this module twice as
|
||||
complicated as necessary.
|
||||
|
||||
To check whether you function has been called, use `fn.called`. Once the
|
||||
function is called for the first time the return value of the original
|
||||
function is saved in `fn.value` and subsequent calls will continue to
|
||||
return this value.
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (cb) {
|
||||
cb = once(cb)
|
||||
var stream = createStream()
|
||||
stream.once('data', cb)
|
||||
stream.once('end', function () {
|
||||
if (!cb.called) cb(new Error('not found'))
|
||||
})
|
||||
}
|
||||
```
|
||||
21
static/js/ketcher2/node_modules/map-limit/node_modules/once/once.js
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/map-limit/node_modules/once/once.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
var wrappy = require('wrappy')
|
||||
module.exports = wrappy(once)
|
||||
|
||||
once.proto = once(function () {
|
||||
Object.defineProperty(Function.prototype, 'once', {
|
||||
value: function () {
|
||||
return once(this)
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
})
|
||||
|
||||
function once (fn) {
|
||||
var f = function () {
|
||||
if (f.called) return f.value
|
||||
f.called = true
|
||||
return f.value = fn.apply(this, arguments)
|
||||
}
|
||||
f.called = false
|
||||
return f
|
||||
}
|
||||
66
static/js/ketcher2/node_modules/map-limit/node_modules/once/package.json
generated
vendored
Normal file
66
static/js/ketcher2/node_modules/map-limit/node_modules/once/package.json
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"_from": "once@~1.3.0",
|
||||
"_id": "once@1.3.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=",
|
||||
"_location": "/map-limit/once",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "once@~1.3.0",
|
||||
"name": "once",
|
||||
"escapedName": "once",
|
||||
"rawSpec": "~1.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/map-limit"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz",
|
||||
"_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20",
|
||||
"_spec": "once@~1.3.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/map-limit",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/once/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Run a function exactly one time",
|
||||
"devDependencies": {
|
||||
"tap": "^1.2.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"once.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/once#readme",
|
||||
"keywords": [
|
||||
"once",
|
||||
"function",
|
||||
"one",
|
||||
"single"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "once.js",
|
||||
"name": "once",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/once.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.3.3"
|
||||
}
|
||||
62
static/js/ketcher2/node_modules/map-limit/package.json
generated
vendored
Normal file
62
static/js/ketcher2/node_modules/map-limit/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "map-limit@0.0.1",
|
||||
"_id": "map-limit@0.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-63lhAxwPDo0AG/LVb6toXViCLzg=",
|
||||
"_location": "/map-limit",
|
||||
"_phantomChildren": {
|
||||
"wrappy": "1.0.2"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "map-limit@0.0.1",
|
||||
"name": "map-limit",
|
||||
"escapedName": "map-limit",
|
||||
"rawSpec": "0.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/get-ports"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/map-limit/-/map-limit-0.0.1.tgz",
|
||||
"_shasum": "eb7961031c0f0e8d001bf2d56fab685d58822f38",
|
||||
"_spec": "map-limit@0.0.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/get-ports",
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
"url": "http://hughsk.io/"
|
||||
},
|
||||
"browser": "index.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hughsk/map-limit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"once": "~1.3.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "async.mapLimit's functionality available as a standalone npm module",
|
||||
"devDependencies": {
|
||||
"tape": "~2.4.2"
|
||||
},
|
||||
"homepage": "https://github.com/hughsk/map-limit",
|
||||
"keywords": [
|
||||
"async",
|
||||
"map",
|
||||
"limit"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "map-limit",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hughsk/map-limit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
||||
39
static/js/ketcher2/node_modules/map-limit/test.js
generated
vendored
Normal file
39
static/js/ketcher2/node_modules/map-limit/test.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
var test = require('tape')
|
||||
var mapl = require('./')
|
||||
|
||||
test('basic', function(t) {
|
||||
var items = [1, 2, 3, 4, 5]
|
||||
var goals = [2, 4, 6, 8,10]
|
||||
|
||||
t.plan(2)
|
||||
|
||||
mapl(items, 5, function(item, next) {
|
||||
next(null, item * 2)
|
||||
}, function(err, results) {
|
||||
t.ifError(err)
|
||||
t.deepEqual(results, goals)
|
||||
})
|
||||
})
|
||||
|
||||
test('stalled', function(t) {
|
||||
var items = [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
var goals = [2, 4, 6, 8,10,12,14,16]
|
||||
var n = 0
|
||||
|
||||
t.plan(6)
|
||||
|
||||
mapl(items, 2, function(item, next) {
|
||||
setTimeout(function() {
|
||||
n += 1
|
||||
next(null, item * 2)
|
||||
}, 150)
|
||||
}, function(err, results) {
|
||||
t.ifError(err)
|
||||
t.deepEqual(results, goals)
|
||||
})
|
||||
|
||||
setTimeout(function() { t.equal(n, 2) }, 225)
|
||||
setTimeout(function() { t.equal(n, 4) }, 350)
|
||||
setTimeout(function() { t.equal(n, 6) }, 475)
|
||||
setTimeout(function() { t.equal(n, 8) }, 625)
|
||||
})
|
||||
Reference in New Issue
Block a user