forked from enviPath/enviPy
Current Dev State
This commit is contained in:
58
static/js/ketcher2/node_modules/query-string/index.js
generated
vendored
Normal file
58
static/js/ketcher2/node_modules/query-string/index.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
var strictUriEncode = require('strict-uri-encode');
|
||||
|
||||
exports.extract = function (str) {
|
||||
return str.split('?')[1] || '';
|
||||
};
|
||||
|
||||
exports.parse = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
return {};
|
||||
}
|
||||
|
||||
str = str.trim().replace(/^(\?|#|&)/, '');
|
||||
|
||||
if (!str) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return str.split('&').reduce(function (ret, param) {
|
||||
var parts = param.replace(/\+/g, ' ').split('=');
|
||||
// Firefox (pre 40) decodes `%3D` to `=`
|
||||
// https://github.com/sindresorhus/query-string/pull/37
|
||||
var key = parts.shift();
|
||||
var val = parts.length > 0 ? parts.join('=') : undefined;
|
||||
|
||||
key = decodeURIComponent(key);
|
||||
|
||||
// missing `=` should be `null`:
|
||||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||
val = val === undefined ? null : decodeURIComponent(val);
|
||||
|
||||
if (!ret.hasOwnProperty(key)) {
|
||||
ret[key] = val;
|
||||
} else if (Array.isArray(ret[key])) {
|
||||
ret[key].push(val);
|
||||
} else {
|
||||
ret[key] = [ret[key], val];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}, {});
|
||||
};
|
||||
|
||||
exports.stringify = function (obj) {
|
||||
return obj ? Object.keys(obj).sort().map(function (key) {
|
||||
var val = obj[key];
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
return val.sort().map(function (val2) {
|
||||
return strictUriEncode(key) + '=' + strictUriEncode(val2);
|
||||
}).join('&');
|
||||
}
|
||||
|
||||
return strictUriEncode(key) + '=' + strictUriEncode(val);
|
||||
}).filter(function (x) {
|
||||
return x.length > 0;
|
||||
}).join('&') : '';
|
||||
};
|
||||
21
static/js/ketcher2/node_modules/query-string/license
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/query-string/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
75
static/js/ketcher2/node_modules/query-string/package.json
generated
vendored
Normal file
75
static/js/ketcher2/node_modules/query-string/package.json
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "query-string@2.4.2",
|
||||
"_id": "query-string@2.4.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fbBmZCCAS6qSrp8miWKFWnYUPfs=",
|
||||
"_location": "/query-string",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "query-string@2.4.2",
|
||||
"name": "query-string",
|
||||
"escapedName": "query-string",
|
||||
"rawSpec": "2.4.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.4.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/query-string/-/query-string-2.4.2.tgz",
|
||||
"_shasum": "7db0666420804baa92ae9f268962855a76143dfb",
|
||||
"_spec": "query-string@2.4.2",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/query-string/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"strict-uri-encode": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Parse and stringify URL query strings",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/query-string#readme",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"querystring",
|
||||
"query",
|
||||
"string",
|
||||
"qs",
|
||||
"param",
|
||||
"parameter",
|
||||
"url",
|
||||
"uri",
|
||||
"parse",
|
||||
"stringify",
|
||||
"encode",
|
||||
"decode"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "query-string",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/query-string.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.4.2"
|
||||
}
|
||||
76
static/js/ketcher2/node_modules/query-string/readme.md
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/query-string/readme.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# query-string [](https://travis-ci.org/sindresorhus/query-string)
|
||||
|
||||
> Parse and stringify URL [query strings](http://en.wikipedia.org/wiki/Query_string)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save query-string
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const queryString = require('query-string');
|
||||
|
||||
console.log(location.search);
|
||||
//=> '?foo=bar'
|
||||
|
||||
const parsed = queryString.parse(location.search);
|
||||
console.log(parsed);
|
||||
//=> {foo: 'bar'}
|
||||
|
||||
console.log(location.hash);
|
||||
//=> '#token=bada55cafe'
|
||||
|
||||
const parsedHash = queryString.parse(location.hash);
|
||||
console.log(parsedHash);
|
||||
//=> {token: 'bada55cafe'}
|
||||
|
||||
parsed.foo = 'unicorn';
|
||||
parsed.ilike = 'pizza';
|
||||
|
||||
location.search = queryString.stringify(parsed);
|
||||
|
||||
console.log(location.search);
|
||||
//=> '?foo=unicorn&ilike=pizza'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### .parse(*string*)
|
||||
|
||||
Parse a query string into an object. Leading `?` or `#` are ignored, so you can pass `location.search` or `location.hash` directly.
|
||||
|
||||
### .stringify(*object*)
|
||||
|
||||
Stringify an object into a query string, sorting the keys.
|
||||
|
||||
### .extract(*string*)
|
||||
|
||||
Extract a query string from a URL that can be passed into `.parse()`.
|
||||
|
||||
|
||||
## Nesting
|
||||
|
||||
This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).
|
||||
|
||||
You're much better off just converting the object to a JSON string:
|
||||
|
||||
```js
|
||||
queryString.stringify({
|
||||
foo: 'bar',
|
||||
nested: JSON.stringify({
|
||||
unicorn: 'cake'
|
||||
})
|
||||
});
|
||||
//=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user