forked from enviPath/enviPy
Current Dev State
This commit is contained in:
39
static/js/ketcher2/node_modules/prr/LICENSE
generated
vendored
Normal file
39
static/js/ketcher2/node_modules/prr/LICENSE
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
Copyright 2013, Rod Vagg (the "Original Author")
|
||||
All rights reserved.
|
||||
|
||||
MIT +no-false-attribs License
|
||||
|
||||
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.
|
||||
|
||||
Distributions of all or part of the Software intended to be used
|
||||
by the recipients as they would use the unmodified Software,
|
||||
containing modifications that substantially alter, remove, or
|
||||
disable functionality of the Software, outside of the documented
|
||||
configuration mechanisms provided by the Software, shall be
|
||||
modified such that the Original Author's bug reporting email
|
||||
addresses and urls are either replaced with the contact information
|
||||
of the parties responsible for the changes, or removed entirely.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Except where noted, this license applies to any and all software
|
||||
programs and associated documentation files created by the
|
||||
Original Author, when distributed with the Software.
|
||||
45
static/js/ketcher2/node_modules/prr/README.md
generated
vendored
Normal file
45
static/js/ketcher2/node_modules/prr/README.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# prr [](http://travis-ci.org/rvagg/prr)
|
||||
|
||||
An sensible alternative to `Object.defineProperty()`. Available in npm and Ender as **prr**.
|
||||
|
||||
## Usage
|
||||
|
||||
Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (*enumerable, configurable and writable are all false*):
|
||||
|
||||
```js
|
||||
prr(obj, 'foo', 'bar')
|
||||
```
|
||||
|
||||
Adjust the default options:
|
||||
|
||||
```js
|
||||
prr(obj, 'foo', 'bar', { enumerable: true, writable: true })
|
||||
```
|
||||
|
||||
Do the same operation for multiple properties:
|
||||
|
||||
```js
|
||||
prr(obj, { one: 'one', two: 'two' })
|
||||
// or with options:
|
||||
prr(obj, { one: 'one', two: 'two' }, { enumerable: true, writable: true })
|
||||
```
|
||||
|
||||
But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can **simplify**.
|
||||
|
||||
As an alternative method we can use an options string where each character represents a option: `'e'=='enumerable'`, `'c'=='configurable'` and `'w'=='writable'`:
|
||||
|
||||
```js
|
||||
prr(obj, 'foo', 'bar', 'ew') // enumerable and writable but not configurable
|
||||
// muliple properties:
|
||||
prr(obj, { one: 'one', two: 'two' }, 'ewc') // configurable too
|
||||
```
|
||||
|
||||
## Where can I use it?
|
||||
|
||||
Anywhere! For pre-ES5 environments *prr* will simply fall-back to an `object[property] = value` so you can get close to what you want.
|
||||
|
||||
*prr* is Ender-compatible so you can include it in your Ender build and `$.prr(...)` or `var prr = require('prr'); prr(...)`.
|
||||
|
||||
## Licence
|
||||
|
||||
prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
|
||||
56
static/js/ketcher2/node_modules/prr/package.json
generated
vendored
Normal file
56
static/js/ketcher2/node_modules/prr/package.json
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"_from": "prr@~0.0.0",
|
||||
"_id": "prr@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=",
|
||||
"_location": "/prr",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "prr@~0.0.0",
|
||||
"name": "prr",
|
||||
"escapedName": "prr",
|
||||
"rawSpec": "~0.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/errno"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz",
|
||||
"_shasum": "1a84b85908325501411853d0081ee3fa86e2926a",
|
||||
"_spec": "prr@~0.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/errno",
|
||||
"authors": [
|
||||
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/rvagg/prr/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A better Object.defineProperty()",
|
||||
"devDependencies": {
|
||||
"tap": "*"
|
||||
},
|
||||
"homepage": "https://github.com/rvagg/prr",
|
||||
"keywords": [
|
||||
"property",
|
||||
"properties",
|
||||
"defineProperty",
|
||||
"ender"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./prr.js",
|
||||
"name": "prr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/rvagg/prr.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./test.js"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
||||
63
static/js/ketcher2/node_modules/prr/prr.js
generated
vendored
Normal file
63
static/js/ketcher2/node_modules/prr/prr.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* prr
|
||||
* (c) 2013 Rod Vagg <rod@vagg.org>
|
||||
* https://github.com/rvagg/prr
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
(function (name, context, definition) {
|
||||
if (typeof module != 'undefined' && module.exports)
|
||||
module.exports = definition()
|
||||
else
|
||||
context[name] = definition()
|
||||
})('prr', this, function() {
|
||||
|
||||
var setProperty = typeof Object.defineProperty == 'function'
|
||||
? function (obj, key, options) {
|
||||
Object.defineProperty(obj, key, options)
|
||||
return obj
|
||||
}
|
||||
: function (obj, key, options) { // < es5
|
||||
obj[key] = options.value
|
||||
return obj
|
||||
}
|
||||
|
||||
, makeOptions = function (value, options) {
|
||||
var oo = typeof options == 'object'
|
||||
, os = !oo && typeof options == 'string'
|
||||
, op = function (p) {
|
||||
return oo
|
||||
? !!options[p]
|
||||
: os
|
||||
? options.indexOf(p[0]) > -1
|
||||
: false
|
||||
}
|
||||
|
||||
return {
|
||||
enumerable : op('enumerable')
|
||||
, configurable : op('configurable')
|
||||
, writable : op('writable')
|
||||
, value : value
|
||||
}
|
||||
}
|
||||
|
||||
, prr = function (obj, key, value, options) {
|
||||
var k
|
||||
|
||||
options = makeOptions(value, options)
|
||||
|
||||
if (typeof key == 'object') {
|
||||
for (k in key) {
|
||||
if (Object.hasOwnProperty.call(key, k)) {
|
||||
options.value = key[k]
|
||||
setProperty(obj, k, options)
|
||||
}
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
return setProperty(obj, key, options)
|
||||
}
|
||||
|
||||
return prr
|
||||
})
|
||||
169
static/js/ketcher2/node_modules/prr/test.js
generated
vendored
Normal file
169
static/js/ketcher2/node_modules/prr/test.js
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
const test = require('tap').test
|
||||
, prr = require('./')
|
||||
|
||||
test('test prr(o, key, value) form', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var o = {}
|
||||
prr(o, 'foo', 'bar')
|
||||
t.equal(o.foo, 'bar', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo')
|
||||
, {
|
||||
enumerable : false
|
||||
, configurable : false
|
||||
, writable : false
|
||||
, value : 'bar'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test prr(o, { key: value }) form', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var o = {}
|
||||
prr(o, { foo: 'bar' })
|
||||
|
||||
t.equal(o.foo, 'bar', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo')
|
||||
, {
|
||||
enumerable : false
|
||||
, configurable : false
|
||||
, writable : false
|
||||
, value : 'bar'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test multiple key:value pairs', function (t) {
|
||||
var o = { foo: 'bar' }
|
||||
|
||||
prr(o, { one: 'ONE', two: 'TWO', obj: { o: 'o' }})
|
||||
|
||||
t.deepEqual(o, { foo: 'bar' }, 'properties are not enumerable')
|
||||
t.equal(o.one, 'ONE', 'correctly set property')
|
||||
t.equal(o.two, 'TWO', 'correctly set property')
|
||||
t.deepEqual(o.obj, { o: 'o' }, 'correctly set property')
|
||||
|
||||
;[ 'one', 'two', 'obj' ].forEach(function (p) {
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, p)
|
||||
, {
|
||||
enumerable : false
|
||||
, configurable : false
|
||||
, writable : false
|
||||
, value : p == 'obj' ? { o: 'o' } : p.toUpperCase()
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test descriptor options', function (t) {
|
||||
var o = {}
|
||||
|
||||
prr(o, 'foo', 'bar', {
|
||||
enumerable : true
|
||||
, configurable : false
|
||||
})
|
||||
t.equal(o.foo, 'bar', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : false
|
||||
, writable : false
|
||||
, value : 'bar'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
prr(o, 'foo2', 'bar2', {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : false
|
||||
})
|
||||
t.equal(o.foo2, 'bar2', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo2')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : false
|
||||
, value : 'bar2'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
prr(o, 'foo3', 'bar3', {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : true
|
||||
})
|
||||
t.equal(o.foo3, 'bar3', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo3')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : true
|
||||
, value : 'bar3'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
||||
test('test descriptor options, string form', function (t) {
|
||||
var o = {}
|
||||
|
||||
prr(o, 'foo', 'bar', 'e')
|
||||
t.equal(o.foo, 'bar', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : false
|
||||
, writable : false
|
||||
, value : 'bar'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
prr(o, 'foo2', 'bar2', 'ec')
|
||||
t.equal(o.foo2, 'bar2', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo2')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : false
|
||||
, value : 'bar2'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
prr(o, 'foo3', 'bar3', 'ecw')
|
||||
t.equal(o.foo3, 'bar3', 'correct value')
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(o, 'foo3')
|
||||
, {
|
||||
enumerable : true
|
||||
, configurable : true
|
||||
, writable : true
|
||||
, value : 'bar3'
|
||||
}
|
||||
, 'correct property descriptor'
|
||||
)
|
||||
|
||||
t.end()
|
||||
})
|
||||
Reference in New Issue
Block a user