forked from enviPath/enviPy
Current Dev State
This commit is contained in:
92
static/js/ketcher2/node_modules/clean-yaml-object/index.js
generated
vendored
Normal file
92
static/js/ketcher2/node_modules/clean-yaml-object/index.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
module.exports = function (object, filterFn) {
|
||||
return cleanYamlObj(object, filterFn || defaultFilter, true, []);
|
||||
};
|
||||
|
||||
function cleanYamlObj(object, filter, isRoot, seen) {
|
||||
if (object === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof object === 'function') {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(object)) {
|
||||
return 'Buffer\n' + object.toString('hex').split('')
|
||||
.reduce(function (set, c) {
|
||||
if (set.length && set[set.length - 1].length === 1) {
|
||||
set[set.length - 1] += c;
|
||||
if (set.length && set.length % 20 === 0) {
|
||||
set[set.length - 1] += '\n';
|
||||
} else {
|
||||
set[set.length - 1] += ' ';
|
||||
}
|
||||
} else {
|
||||
set.push(c);
|
||||
}
|
||||
return set;
|
||||
}, []).join('').trim();
|
||||
}
|
||||
|
||||
if (object && typeof object === 'object') {
|
||||
if (object instanceof RegExp) {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
seen = seen.concat([object]);
|
||||
|
||||
var isArray = Array.isArray(object);
|
||||
|
||||
// Fill in any holes. This means we lose expandos,
|
||||
// but we were gonna lose those anyway.
|
||||
if (isArray) {
|
||||
object = Array.apply(null, object);
|
||||
}
|
||||
|
||||
var isError = object && typeof object === 'object' && object instanceof Error;
|
||||
|
||||
var set = isArray ? [] : {};
|
||||
|
||||
// name is typically not an ownProperty on an Error
|
||||
if (isError && object.name && !object.hasOwnProperty('name') && filter('name', isRoot, object, set)) {
|
||||
setProp('name', object, set, seen, filter);
|
||||
}
|
||||
|
||||
var keys = Object.getOwnPropertyNames(object);
|
||||
return keys.reduce(function (set, k) {
|
||||
// magic property!
|
||||
if (isArray && k === 'length') {
|
||||
return set;
|
||||
}
|
||||
|
||||
// Don't dump massive EventEmitter and Domain
|
||||
// objects onto the output, that's never friendly.
|
||||
if (isError && /^domain/.test(k)) {
|
||||
return set;
|
||||
}
|
||||
|
||||
if (!filter(k, isRoot, object, set)) {
|
||||
return set;
|
||||
}
|
||||
|
||||
setProp(k, object, set, seen, filter);
|
||||
|
||||
return set;
|
||||
}, set);
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
function setProp(propName, source, target, seen, filter) {
|
||||
if (seen.indexOf(source[propName]) === -1) {
|
||||
target[propName] = cleanYamlObj(source[propName], filter, false, seen);
|
||||
} else {
|
||||
target[propName] = '[Circular]';
|
||||
}
|
||||
}
|
||||
|
||||
function defaultFilter() {
|
||||
return true;
|
||||
}
|
||||
23
static/js/ketcher2/node_modules/clean-yaml-object/license
generated
vendored
Normal file
23
static/js/ketcher2/node_modules/clean-yaml-object/license
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter <i@izs.me>, James Talmage <james@talmage.io> (github.com/jamestalmage), and Contributors
|
||||
|
||||
Extracted from code in node-tap http://www.node-tap.org/
|
||||
|
||||
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/clean-yaml-object/package.json
generated
vendored
Normal file
69
static/js/ketcher2/node_modules/clean-yaml-object/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "clean-yaml-object@^0.1.0",
|
||||
"_id": "clean-yaml-object@0.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Y/sRDcLOGoTcIfbZM0h20BCui2g=",
|
||||
"_location": "/clean-yaml-object",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "clean-yaml-object@^0.1.0",
|
||||
"name": "clean-yaml-object",
|
||||
"escapedName": "clean-yaml-object",
|
||||
"rawSpec": "^0.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz",
|
||||
"_shasum": "63fb110dc2ce1a84dc21f6d9334876d010ae8b68",
|
||||
"_spec": "clean-yaml-object@^0.1.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/tap",
|
||||
"author": {
|
||||
"name": "James Talmage",
|
||||
"email": "james@talmage.io",
|
||||
"url": "github.com/jamestalmage"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tapjs/clean-yaml-object/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Clean up an object prior to serialization",
|
||||
"devDependencies": {
|
||||
"ava": "^0.10.0",
|
||||
"coveralls": "^2.11.6",
|
||||
"nyc": "^5.3.0",
|
||||
"xo": "^0.12.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/tapjs/clean-yaml-object#readme",
|
||||
"keywords": [
|
||||
"serialize",
|
||||
"clean",
|
||||
"dedupe",
|
||||
"circular",
|
||||
"yaml",
|
||||
"json",
|
||||
"error"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "clean-yaml-object",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tapjs/clean-yaml-object.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc --cache --reporter=lcov --reporter=text ava"
|
||||
},
|
||||
"version": "0.1.0"
|
||||
}
|
||||
52
static/js/ketcher2/node_modules/clean-yaml-object/readme.md
generated
vendored
Normal file
52
static/js/ketcher2/node_modules/clean-yaml-object/readme.md
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
# clean-yaml-object [](https://travis-ci.org/tapjs/clean-yaml-object) [](https://coveralls.io/github/tapjs/clean-yaml-object?branch=master)
|
||||
|
||||
> Clean up an object prior to serialization.
|
||||
|
||||
Replaces circular references, pretty prints Buffers, and numerous other enhancements. Primarily designed to prepare Errors for serialization to JSON/YAML.
|
||||
|
||||
Extracted from [`node-tap`](https://github.com/tapjs/node-tap)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save clean-yaml-object
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const cleanYamlObject = require('clean-yaml-object');
|
||||
|
||||
cleanYamlObject(new Error('foo'));
|
||||
//=> {name: 'Error', message: 'foo', stack: ...}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### cleanYamlObject(input, [filterFn])
|
||||
|
||||
Returns a deep copy of `input` that is suitable for serialization.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `*`
|
||||
|
||||
Any object.
|
||||
|
||||
#### filterFn
|
||||
|
||||
Type: `callback(propertyName, isRoot, source, target)`
|
||||
|
||||
Optional filter callback. Returning `true` will cause the property to be copied. Otherwise it will be skipped
|
||||
|
||||
- `propertyName`: The property being copied.
|
||||
- `isRoot`: `true` only if `source` is the top level object passed to `copyYamlObject`
|
||||
- `source`: The source from which `source[propertyName]` will be copied.
|
||||
- `target`: The target object.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
MIT © [Isaac Z. Schlueter](http://github.com/isaacs) [James Talmage](http://github.com/jamestalmage)
|
||||
Reference in New Issue
Block a user