unit tests, and some cleaning up

This commit is contained in:
Josh Burman
2019-03-14 10:14:42 -04:00
parent 501a14d713
commit 21f77fa4c3
134 changed files with 16787 additions and 359 deletions

22
node_modules/querystringify/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors.
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.

60
node_modules/querystringify/README.md generated vendored Normal file
View File

@ -0,0 +1,60 @@
# querystringify
[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/querystringify.svg?style=flat-square)](http://browsenpm.org/package/querystringify)[![Build Status](http://img.shields.io/travis/unshiftio/querystringify/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/querystringify)[![Dependencies](https://img.shields.io/david/unshiftio/querystringify.svg?style=flat-square)](https://david-dm.org/unshiftio/querystringify)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/querystringify/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/querystringify?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=unshift)
A somewhat JSON compatible interface for query string parsing. This query string
parser is dumb, don't expect to much from it as it only wants to parse simple
query strings. If you want to parse complex, multi level and deeply nested
query strings then you should ask your self. WTF am I doing?
## Installation
This module is released in npm as `querystringify`. It's also compatible with
`browserify` so it can be used on the server as well as on the client. To
install it simply run the following command from your CLI:
```
npm install --save querystringify
```
## Usage
In the following examples we assume that you've already required the library as:
```js
'use strict';
var qs = require('querystringify');
```
### qs.parse()
The parse method transforms a given query string in to an object. Parameters
without values are set to empty strings. It does not care if your query string
is prefixed with a `?` or not. It just extracts the parts between the `=` and
`&`:
```js
qs.parse('?foo=bar'); // { foo: 'bar' }
qs.parse('foo=bar'); // { foo: 'bar' }
qs.parse('foo=bar&bar=foo'); // { foo: 'bar', bar: 'foo' }
qs.parse('foo&bar=foo'); // { foo: '', bar: 'foo' }
```
### qs.stringify()
This transforms a given object in to a query string. By default we return the
query string without a `?` prefix. If you want to prefix it by default simply
supply `true` as second argument. If it should be prefixed by something else
simply supply a string with the prefix value as second argument:
```js
qs.stringify({ foo: bar }); // foo=bar
qs.stringify({ foo: bar }, true); // ?foo=bar
qs.stringify({ foo: bar }, '&'); // &foo=bar
qs.stringify({ foo: '' }, '&'); // &foo=
```
## License
MIT

88
node_modules/querystringify/index.js generated vendored Normal file
View File

@ -0,0 +1,88 @@
'use strict';
var has = Object.prototype.hasOwnProperty
, undef;
/**
* Decode a URI encoded string.
*
* @param {String} input The URI encoded string.
* @returns {String} The decoded string.
* @api private
*/
function decode(input) {
return decodeURIComponent(input.replace(/\+/g, ' '));
}
/**
* Simple query string parser.
*
* @param {String} query The query string that needs to be parsed.
* @returns {Object}
* @api public
*/
function querystring(query) {
var parser = /([^=?&]+)=?([^&]*)/g
, result = {}
, part;
while (part = parser.exec(query)) {
var key = decode(part[1])
, value = decode(part[2]);
//
// Prevent overriding of existing properties. This ensures that build-in
// methods like `toString` or __proto__ are not overriden by malicious
// querystrings.
//
if (key in result) continue;
result[key] = value;
}
return result;
}
/**
* Transform a query string to an object.
*
* @param {Object} obj Object that should be transformed.
* @param {String} prefix Optional prefix.
* @returns {String}
* @api public
*/
function querystringify(obj, prefix) {
prefix = prefix || '';
var pairs = []
, value
, key;
//
// Optionally prefix with a '?' if needed
//
if ('string' !== typeof prefix) prefix = '?';
for (key in obj) {
if (has.call(obj, key)) {
value = obj[key];
//
// Edge cases where we actually want to encode the value to an empty
// string instead of the stringified value.
//
if (!value && (value === null || value === undef || isNaN(value))) {
value = '';
}
pairs.push(encodeURIComponent(key) +'='+ encodeURIComponent(value));
}
}
return pairs.length ? prefix + pairs.join('&') : '';
}
//
// Expose the module.
//
exports.stringify = querystringify;
exports.parse = querystring;

66
node_modules/querystringify/package.json generated vendored Normal file
View File

@ -0,0 +1,66 @@
{
"_from": "querystringify@^2.0.0",
"_id": "querystringify@2.1.0",
"_inBundle": false,
"_integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==",
"_location": "/querystringify",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "querystringify@^2.0.0",
"name": "querystringify",
"escapedName": "querystringify",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/url-parse"
],
"_resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz",
"_shasum": "7ded8dfbf7879dcc60d0a644ac6754b283ad17ef",
"_spec": "querystringify@^2.0.0",
"_where": "/Users/josh.burman/Projects/braid/node_modules/url-parse",
"author": {
"name": "Arnout Kazemier"
},
"bugs": {
"url": "https://github.com/unshiftio/querystringify/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Querystringify - Small, simple but powerful query string parser.",
"devDependencies": {
"assume": "^2.1.0",
"istanbul": "^0.4.5",
"mocha": "^5.2.0",
"pre-commit": "^1.2.2"
},
"homepage": "https://github.com/unshiftio/querystringify",
"keywords": [
"query",
"string",
"query-string",
"querystring",
"qs",
"stringify",
"parse",
"decode",
"encode"
],
"license": "MIT",
"main": "index.js",
"name": "querystringify",
"repository": {
"type": "git",
"url": "git+https://github.com/unshiftio/querystringify.git"
},
"scripts": {
"coverage": "istanbul cover _mocha -- test.js",
"test": "mocha test.js",
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
"watch": "mocha --watch test.js"
},
"version": "2.1.0"
}