forked from enviPath/enviPy
Current Dev State
This commit is contained in:
15
static/js/ketcher2/node_modules/yapool/LICENSE
generated
vendored
Normal file
15
static/js/ketcher2/node_modules/yapool/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.
|
||||
28
static/js/ketcher2/node_modules/yapool/README.md
generated
vendored
Normal file
28
static/js/ketcher2/node_modules/yapool/README.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# yapool
|
||||
|
||||
Yet Another object pool in JavaScript
|
||||
|
||||
Because [yallist](http://npm.im/yallist) is sometimes too featureful,
|
||||
this is a very dead-simple linked-list pool thingie in JavaScript that
|
||||
lets you add and remove objects in a set.
|
||||
|
||||
Not suitable for very long lists, because all searches are `O(n)`, but
|
||||
for small `n`, it has very low complexity.
|
||||
|
||||
## API
|
||||
|
||||
`p = new Pool()`
|
||||
|
||||
Constructor takes no arguments
|
||||
|
||||
`p.add(someObject)`
|
||||
|
||||
put an object in the pool
|
||||
|
||||
`p.length`
|
||||
|
||||
return the number of things in the pool.
|
||||
|
||||
`p.remove(someObject)`
|
||||
|
||||
remove that object from the pool.
|
||||
56
static/js/ketcher2/node_modules/yapool/index.js
generated
vendored
Normal file
56
static/js/ketcher2/node_modules/yapool/index.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
module.exports = Pool
|
||||
|
||||
function Pool () {
|
||||
this.length = 0
|
||||
this.head = null
|
||||
this.tail = null
|
||||
}
|
||||
|
||||
Pool.prototype.add = function (data) {
|
||||
this.tail = new Item(data, this.tail, null)
|
||||
if (!this.head)
|
||||
this.head = this.tail
|
||||
this.length ++
|
||||
}
|
||||
|
||||
Pool.prototype.remove = function (data) {
|
||||
if (this.length === 0)
|
||||
return
|
||||
|
||||
var i = this.head.find(data)
|
||||
|
||||
if (!i)
|
||||
return
|
||||
|
||||
if (i === this.head)
|
||||
this.head = this.head.next
|
||||
|
||||
if (i === this.tail)
|
||||
this.tail = this.tail.prev
|
||||
|
||||
i.remove()
|
||||
this.length --
|
||||
}
|
||||
|
||||
function Item (data, prev) {
|
||||
this.prev = prev
|
||||
if (prev)
|
||||
prev.next = this
|
||||
|
||||
this.next = null
|
||||
this.data = data
|
||||
}
|
||||
|
||||
Item.prototype.remove = function () {
|
||||
if (this.next)
|
||||
this.next.prev = this.prev
|
||||
if (this.prev)
|
||||
this.prev.next = this.next
|
||||
this.prev = this.next = this.data = null
|
||||
}
|
||||
|
||||
Item.prototype.find = function (data) {
|
||||
return data === this.data ? this
|
||||
: this.next ? this.next.find(data)
|
||||
: null
|
||||
}
|
||||
52
static/js/ketcher2/node_modules/yapool/package.json
generated
vendored
Normal file
52
static/js/ketcher2/node_modules/yapool/package.json
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"_from": "yapool@^1.0.0",
|
||||
"_id": "yapool@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=",
|
||||
"_location": "/yapool",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "yapool@^1.0.0",
|
||||
"name": "yapool",
|
||||
"escapedName": "yapool",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/yapool/-/yapool-1.0.0.tgz",
|
||||
"_shasum": "f693f29a315b50d9a9da2646a7a6645c96985b6a",
|
||||
"_spec": "yapool@^1.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/tap",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/yapool/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Yet Another object pool in JavaScript",
|
||||
"devDependencies": {
|
||||
"tap": "^9.0.3 || 10"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/yapool#readme",
|
||||
"keywords": [],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "yapool",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/yapool.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js --100"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
58
static/js/ketcher2/node_modules/yapool/test.js
generated
vendored
Normal file
58
static/js/ketcher2/node_modules/yapool/test.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
var assert = require('assert')
|
||||
var P = require('./index.js')
|
||||
var a = { a: 1 }
|
||||
var b = { b: 1 }
|
||||
|
||||
var t = require('tap')
|
||||
t.jobs = 64
|
||||
process.env.TAP_BUFFER = 1
|
||||
|
||||
t.test(function removeFirstItem (t) {
|
||||
var p = new P
|
||||
p.add(a)
|
||||
p.add(b)
|
||||
p.remove(a)
|
||||
t.equal(p.length, 1)
|
||||
t.equal(p.head, p.tail)
|
||||
t.equal(p.head.data, b)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test(function removeTail (t) {
|
||||
var p = new P
|
||||
p.add(a)
|
||||
p.add(b)
|
||||
p.remove(b)
|
||||
t.equal(p.length, 1)
|
||||
t.equal(p.head, p.tail)
|
||||
t.equal(p.head.data, a)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test(function removeAll (t) {
|
||||
var p = new P
|
||||
p.add(a)
|
||||
p.add(b)
|
||||
p.remove(a)
|
||||
p.remove(b)
|
||||
t.equal(p.length, 0)
|
||||
t.equal(p.head, p.tail)
|
||||
t.equal(p.head, null)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test(function removeExtra (t) {
|
||||
var p = new P
|
||||
p.add(a)
|
||||
p.add(b)
|
||||
p.remove(b)
|
||||
p.remove({some: 'thing not in there'})
|
||||
p.remove(a)
|
||||
p.remove(a)
|
||||
p.remove(a)
|
||||
p.remove(a)
|
||||
t.equal(p.length, 0)
|
||||
t.equal(p.head, p.tail)
|
||||
t.equal(p.head, null)
|
||||
t.end()
|
||||
})
|
||||
Reference in New Issue
Block a user