forked from enviPath/enviPy
Current Dev State
This commit is contained in:
19
static/js/ketcher2/node_modules/individual/LICENCE
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/individual/LICENCE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012 Raynos.
|
||||
|
||||
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.
|
||||
69
static/js/ketcher2/node_modules/individual/README.md
generated
vendored
Normal file
69
static/js/ketcher2/node_modules/individual/README.md
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
# individual
|
||||
|
||||
[![build status][build-png]][build] [![Coverage Status][cover-png]][cover] [![Davis Dependency status][dep-png]][dep]
|
||||
|
||||
[![NPM][npm-png]][npm]
|
||||
|
||||
[![browser support][test-png]][test]
|
||||
|
||||
Garantueed individual values
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var Individual = require("individual")
|
||||
|
||||
var moduleCache = Individual("__MY_MODULE_CACHE", {})
|
||||
|
||||
// moduleCache is a individual variable local to this file.
|
||||
// It will always be the same value and defaults to {}.
|
||||
```
|
||||
|
||||
This gives you a singleton value by a unique name (it stores it
|
||||
as a global variable).
|
||||
|
||||
## Use cases
|
||||
|
||||
Your module has an internal cache. If your module is loaded
|
||||
twice, (someone didn't npm dedup and has two copies of your
|
||||
module) you would have two seperate caches that dont talk
|
||||
to each other.
|
||||
|
||||
Best case your cache is less efficient. Worst case you have a
|
||||
cache because the native C++ extension you talk to crashes
|
||||
if you instantiate something twice.
|
||||
|
||||
You need a garantuee that this value is an individual, there is
|
||||
only one of it.
|
||||
|
||||
I use it myself because opening a SockJS websocket to the same
|
||||
URI twice causes an infinite loop. I need a garantuee that
|
||||
I have an individual value for the SockJS connection so I
|
||||
can see whether I already have an open connection.
|
||||
|
||||
## WHY GLOBALS >:(
|
||||
|
||||
I can't imagine any other way to do it. I hate it too. Make a
|
||||
pull request if you know the real solution
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install individual`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[build-png]: https://secure.travis-ci.org/Raynos/individual.png
|
||||
[build]: https://travis-ci.org/Raynos/individual
|
||||
[cover-png]: https://coveralls.io/repos/Raynos/individual/badge.png
|
||||
[cover]: https://coveralls.io/r/Raynos/individual
|
||||
[dep-png]: https://david-dm.org/Raynos/individual.png
|
||||
[dep]: https://david-dm.org/Raynos/individual
|
||||
[test-png]: https://ci.testling.com/Raynos/individual.png
|
||||
[test]: https://ci.testling.com/Raynos/individual
|
||||
[npm-png]: https://nodei.co/npm/individual.png?stars&downloads
|
||||
[npm]: https://nodei.co/npm/individual
|
||||
|
||||
19
static/js/ketcher2/node_modules/individual/index.js
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/individual/index.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
/*global window, global*/
|
||||
|
||||
var root = typeof window !== 'undefined' ?
|
||||
window : typeof global !== 'undefined' ?
|
||||
global : {};
|
||||
|
||||
module.exports = Individual;
|
||||
|
||||
function Individual(key, value) {
|
||||
if (key in root) {
|
||||
return root[key];
|
||||
}
|
||||
|
||||
root[key] = value;
|
||||
|
||||
return value;
|
||||
}
|
||||
22
static/js/ketcher2/node_modules/individual/one-version.js
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/individual/one-version.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var Individual = require('./index.js');
|
||||
|
||||
module.exports = OneVersion;
|
||||
|
||||
function OneVersion(moduleName, version, defaultValue) {
|
||||
var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
|
||||
var enforceKey = key + '_ENFORCE_SINGLETON';
|
||||
|
||||
var versionValue = Individual(enforceKey, version);
|
||||
|
||||
if (versionValue !== version) {
|
||||
throw new Error('Can only have one copy of ' +
|
||||
moduleName + '.\n' +
|
||||
'You already have version ' + versionValue +
|
||||
' installed.\n' +
|
||||
'This means you cannot install version ' + version);
|
||||
}
|
||||
|
||||
return Individual(key, defaultValue);
|
||||
}
|
||||
84
static/js/ketcher2/node_modules/individual/package.json
generated
vendored
Normal file
84
static/js/ketcher2/node_modules/individual/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "individual@>=3.0.0 <3.1.0-0",
|
||||
"_id": "individual@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-58pPhfiVewGHNPKFdQ3CLsL5hi0=",
|
||||
"_location": "/individual",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "individual@>=3.0.0 <3.1.0-0",
|
||||
"name": "individual",
|
||||
"escapedName": "individual",
|
||||
"rawSpec": ">=3.0.0 <3.1.0-0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": ">=3.0.0 <3.1.0-0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bole"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/individual/-/individual-3.0.0.tgz",
|
||||
"_shasum": "e7ca4f85f8957b018734f285750dc22ec2f9862d",
|
||||
"_spec": "individual@>=3.0.0 <3.1.0-0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/bole",
|
||||
"author": {
|
||||
"name": "Raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/individual/issues",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jake Verbaten"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Garantueed individual values",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.10.0",
|
||||
"istanbul": "^0.2.7",
|
||||
"run-browser": "^1.3.1",
|
||||
"tape": "^2.12.3"
|
||||
},
|
||||
"homepage": "https://github.com/Raynos/individual",
|
||||
"keywords": [],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/Raynos/individual/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "index",
|
||||
"name": "individual",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Raynos/individual.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cover": "istanbul cover --report none --print detail test.js",
|
||||
"test": "node test.js",
|
||||
"travis": "npm run cover -s && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/16..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
||||
25
static/js/ketcher2/node_modules/individual/test.js
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/individual/test.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
var test = require('tape');
|
||||
|
||||
var Individual = require('./index.js');
|
||||
|
||||
test('can create Individual', function (assert) {
|
||||
var obj = Individual('someName', 42);
|
||||
|
||||
assert.equal(obj, 42);
|
||||
|
||||
var obj2 = Individual('someName', 50);
|
||||
|
||||
assert.equal(obj, 42);
|
||||
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('different keys', function (assert) {
|
||||
var obj = Individual('someName2', 42);
|
||||
var obj2 = Individual('otherName2', 50);
|
||||
|
||||
assert.equal(obj, 42);
|
||||
assert.equal(obj2, 50);
|
||||
|
||||
assert.end();
|
||||
});
|
||||
Reference in New Issue
Block a user