Socket
Socket
Sign inDemoInstall

querystring-es3

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 1.0.0-0

.babelrc

18

License.md

@@ -0,3 +1,7 @@

# Implementation (./src/index.js)
Copyright 2012 Irakli Gozalishvili. All rights reserved.
## License
Copyright Node.js contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy

@@ -20,1 +24,13 @@ of this software and associated documentation files (the "Software"), to

IN THE SOFTWARE.
## See also
<https://github.com/nodejs/node/blob/v6.10.2/LICENSE>
# Rest of the repository
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.

94

package.json
{
"name": "querystring-es3",
"id": "querystring-es3",
"version": "0.2.1",
"description": "Node's querystring module for all engines. (ES3 compat fork)",
"keywords": [ "commonjs", "query", "querystring" ],
"author": "Irakli Gozalishvili <rfobic@gmail.com>",
"version": "1.0.0-0",
"main": "dist/index.js",
"description": "Node API compliant querystring module for all browsers. (ES3 compatible)",
"scripts": {
"build": "babel src -d dist",
"prepare": "npm run build",
"prepublish": "npm run build",
"test": "npm-run-all build test:*",
"test:mocha": "mocha --require babel-register ./test/index.js",
"test:zuul": "zuul --no-coverage -- test"
},
"keywords": [
"commonjs",
"query",
"querystring",
"es3"
],
"author": "SpainTrain <mcspainhower+npm@gmail.com>",
"repository": {
"type": "git",
"url": "git://github.com/mike-spainhower/querystring.git",
"web": "https://github.com/mike-spainhower/querystring"
"url": "git://github.com/SpainTrain/querystring-es3.git",
"web": "https://github.com/SpainTrain/querystring-es3"
},
"bugs": {
"url": "http://github.com/mike-spainhower/querystring/issues/"
"url": "http://github.com/SpainTrain/querystring-es3/issues/"
},
"devDependencies": {
"test": "~0.x.0",
"phantomify": "~0.x.0",
"retape": "~0.x.0",
"tape": "~0.1.5"
"assert": "~1.4.1",
"babel-cli": "~6.24.0",
"babel-preset-es2015": "~6.24.0",
"babel-preset-es2016": "~6.22.0",
"babel-preset-es2017": "~6.22.0",
"babel-preset-es3": "~1.0.1",
"babel-register": "~6.24.0",
"babelify": "~7.3.0",
"browserify": "~14.1.0",
"eslint": "~3.13.0",
"json3": "~3.3.2",
"mocha": "~3.2.0",
"npm-run-all": "~4.0.2",
"object-inspect": "~1.2.2",
"zuul": "~3.11.1",
"zuul-ngrok": "~4.0.0"
},
"engines": {
"node": ">=0.4.x"
"node": ">=4"
},
"scripts": {
"test": "npm run test-node && npm run test-browser && npm run test-tap",
"test-browser": "node ./node_modules/phantomify/bin/cmd.js ./test/common-index.js",
"test-node": "node ./test/common-index.js",
"test-tap": "node ./test/tap-index.js"
},
"testling": {
"files": "test/tap-index.js",
"browsers": {
"iexplore": [
9,
10
],
"chrome": [
16,
20,
25,
"canary"
],
"firefox": [
10,
15,
16,
17,
18,
"nightly"
],
"safari": [
5,
6
],
"opera": [
12
]
}
},
"licenses": [{
"type" : "MIT",
"url" : "https://github.com/Gozala/enchain/License.md"
}]
"license": "MIT",
"dependencies": {
"buffer": "5.0.5"
}
}

@@ -1,15 +0,15 @@

# querystring
# querystring-es3
[![Build Status](https://secure.travis-ci.org/mike-spainhower/querystring.png)](http://travis-ci.org/mike-spainhower/querystring)
[![Build Status](https://travis-ci.org/SpainTrain/querystring-es3.svg?branch=master)](https://travis-ci.org/SpainTrain/querystring-es3)
[![Build Status](https://saucelabs.com/browser-matrix/querystring-es3.svg)](https://saucelabs.com/u/querystring-es3)
[![Browser support](http://ci.testling.com/mike-spainhower/querystring.png)](http://ci.testling.com/mike-spainhower/querystring)
Node API compliant querystring module for all browsers. (ES3 compatible)
## Install
npm install querystring-es3
Node's querystring module for all engines.
## Usage
## Install ##
npm install querystring
<https://nodejs.org/dist/latest-v6.x/docs/api/querystring.html>

@@ -1,210 +0,73 @@

// Copyright Joyent, Inc. and other Node 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.
'use strict';
"use strict";
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.io/#x15.4.4.18
if (!Array.prototype.forEach) {
// test using assert
var qs = require('../');
Array.prototype.forEach = function(callback/*, thisArg*/) {
// folding block, commented to pass gjslint
// {{{
// [ wonkyQS, canonicalQS, obj ]
var qsTestCases = [
['foo=918854443121279438895193',
'foo=918854443121279438895193',
{'foo': '918854443121279438895193'}],
['foo=bar', 'foo=bar', {'foo': 'bar'}],
['foo=bar&foo=quux', 'foo=bar&foo=quux', {'foo': ['bar', 'quux']}],
['foo=1&bar=2', 'foo=1&bar=2', {'foo': '1', 'bar': '2'}],
['my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F',
'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F',
{'my weird field': 'q1!2"\'w$5&7/z8)?' }],
['foo%3Dbaz=bar', 'foo%3Dbaz=bar', {'foo=baz': 'bar'}],
['foo=baz=bar', 'foo=baz%3Dbar', {'foo': 'baz=bar'}],
['str=foo&arr=1&arr=2&arr=3&somenull=&undef=',
'str=foo&arr=1&arr=2&arr=3&somenull=&undef=',
{ 'str': 'foo',
'arr': ['1', '2', '3'],
'somenull': '',
'undef': ''}],
[' foo = bar ', '%20foo%20=%20bar%20', {' foo ': ' bar '}],
// disable test that fails ['foo=%zx', 'foo=%25zx', {'foo': '%zx'}],
['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }],
// See: https://github.com/joyent/node/issues/1707
['hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
{ hasOwnProperty: 'x',
toString: 'foo',
valueOf: 'bar',
__defineGetter__: 'baz' }],
// See: https://github.com/joyent/node/issues/3058
['foo&bar=baz', 'foo=&bar=baz', { foo: '', bar: 'baz' }]
];
var T, k;
// [ wonkyQS, canonicalQS, obj ]
var qsColonTestCases = [
['foo:bar', 'foo:bar', {'foo': 'bar'}],
['foo:bar;foo:quux', 'foo:bar;foo:quux', {'foo': ['bar', 'quux']}],
['foo:1&bar:2;baz:quux',
'foo:1%26bar%3A2;baz:quux',
{'foo': '1&bar:2', 'baz': 'quux'}],
['foo%3Abaz:bar', 'foo%3Abaz:bar', {'foo:baz': 'bar'}],
['foo:baz:bar', 'foo:baz%3Abar', {'foo': 'baz:bar'}]
];
if (this == null) {
throw new TypeError('this is null or not defined');
}
// [wonkyObj, qs, canonicalObj]
var extendedFunction = function() {};
extendedFunction.prototype = {a: 'b'};
var qsWeirdObjects = [
[{regexp: /./g}, 'regexp=', {'regexp': ''}],
[{regexp: new RegExp('.', 'g')}, 'regexp=', {'regexp': ''}],
[{fn: function() {}}, 'fn=', {'fn': ''}],
[{fn: new Function('')}, 'fn=', {'fn': ''}],
[{math: Math}, 'math=', {'math': ''}],
[{e: extendedFunction}, 'e=', {'e': ''}],
[{d: new Date()}, 'd=', {'d': ''}],
[{d: Date}, 'd=', {'d': ''}],
[{f: new Boolean(false), t: new Boolean(true)}, 'f=&t=', {'f': '', 't': ''}],
[{f: false, t: true}, 'f=false&t=true', {'f': 'false', 't': 'true'}],
[{n: null}, 'n=', {'n': ''}],
[{nan: NaN}, 'nan=', {'nan': ''}],
[{inf: Infinity}, 'inf=', {'inf': ''}]
];
// }}}
// 1. Let O be the result of calling toObject() passing the
// |this| value as the argument.
var O = Object(this);
var qsNoMungeTestCases = [
['', {}],
['foo=bar&foo=baz', {'foo': ['bar', 'baz']}],
['blah=burp', {'blah': 'burp'}],
['gragh=1&gragh=3&goo=2', {'gragh': ['1', '3'], 'goo': '2'}],
['frappucino=muffin&goat%5B%5D=scone&pond=moose',
{'frappucino': 'muffin', 'goat[]': 'scone', 'pond': 'moose'}],
['trololol=yes&lololo=no', {'trololol': 'yes', 'lololo': 'no'}]
];
// 2. Let lenValue be the result of calling the Get() internal
// method of O with the argument "length".
// 3. Let len be toUint32(lenValue).
var len = O.length >>> 0;
exports['test basic'] = function(assert) {
assert.strictEqual('918854443121279438895193',
qs.parse('id=918854443121279438895193').id,
'prase id=918854443121279438895193');
};
// 4. If isCallable(callback) is false, throw a TypeError exception.
// See: http://es5.github.com/#x9.11
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
exports['test that the canonical qs is parsed properly'] = function(assert) {
qsTestCases.forEach(function(testCase) {
assert.deepEqual(testCase[2], qs.parse(testCase[0]),
'parse ' + testCase[0]);
});
};
// 5. If thisArg was supplied, let T be thisArg; else let
// T be undefined.
if (arguments.length > 1) {
T = arguments[1];
}
// 6. Let k be 0
k = 0;
exports['test that the colon test cases can do the same'] = function(assert) {
qsColonTestCases.forEach(function(testCase) {
assert.deepEqual(testCase[2], qs.parse(testCase[0], ';', ':'),
'parse ' + testCase[0] + ' -> ; :');
});
};
// 7. Repeat, while k < len
while (k < len) {
exports['test the weird objects, that they get parsed properly'] = function(assert) {
qsWeirdObjects.forEach(function(testCase) {
assert.deepEqual(testCase[2], qs.parse(testCase[1]),
'parse ' + testCase[1]);
});
};
var kValue;
exports['test non munge test cases'] = function(assert) {
qsNoMungeTestCases.forEach(function(testCase) {
assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '=', false),
'stringify ' + JSON.stringify(testCase[1]) + ' -> & =');
});
};
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty
// internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if (k in O) {
exports['test the nested qs-in-qs case'] = function(assert) {
var f = qs.parse('a=b&q=x%3Dy%26y%3Dz');
f.q = qs.parse(f.q);
assert.deepEqual(f, { a: 'b', q: { x: 'y', y: 'z' } },
'parse a=b&q=x%3Dy%26y%3Dz');
};
// i. Let kValue be the result of calling the Get internal
// method of O with argument Pk.
kValue = O[k];
exports['test nested in colon'] = function(assert) {
var f = qs.parse('a:b;q:x%3Ay%3By%3Az', ';', ':');
f.q = qs.parse(f.q, ';', ':');
assert.deepEqual(f, { a: 'b', q: { x: 'y', y: 'z' } },
'parse a:b;q:x%3Ay%3By%3Az -> ; :');
};
// ii. Call the Call internal method of callback with T as
// the this value and argument list containing kValue, k, and O.
callback.call(T, kValue, k, O);
}
// d. Increase k by 1.
k++;
}
// 8. return undefined
};
}
exports['test stringifying'] = function(assert) {
qsTestCases.forEach(function(testCase) {
assert.equal(testCase[1], qs.stringify(testCase[2]),
'stringify ' + JSON.stringify(testCase[2]));
});
// eslint-disable-next-line no-undef
const isIE8 = typeof document != 'undefined' && document.documentMode === 8;
qsColonTestCases.forEach(function(testCase) {
assert.equal(testCase[1], qs.stringify(testCase[2], ';', ':'),
'stringify ' + JSON.stringify(testCase[2]) + ' -> ; :');
});
qsWeirdObjects.forEach(function(testCase) {
assert.equal(testCase[1], qs.stringify(testCase[0]),
'stringify ' + JSON.stringify(testCase[0]));
});
};
exports['test stringifying nested'] = function(assert) {
var f = qs.stringify({
a: 'b',
q: qs.stringify({
x: 'y',
y: 'z'
})
});
assert.equal(f, 'a=b&q=x%3Dy%26y%3Dz',
JSON.stringify({
a: 'b',
'qs.stringify -> q': {
x: 'y',
y: 'z'
}
}));
var threw = false;
try { qs.parse(undefined); } catch(error) { threw = true; }
assert.ok(!threw, "does not throws on undefined");
};
exports['test nested in colon'] = function(assert) {
var f = qs.stringify({
a: 'b',
q: qs.stringify({
x: 'y',
y: 'z'
}, ';', ':')
}, ';', ':');
assert.equal(f, 'a:b;q:x%3Ay%3By%3Az',
'stringify ' + JSON.stringify({
a: 'b',
'qs.stringify -> q': {
x: 'y',
y: 'z'
}
}) + ' -> ; : ');
assert.deepEqual({}, qs.parse(), 'parse undefined');
};
require('./test-querystring');
require('./test-querystring-escape');
!isIE8 && require('./test-querystring-maxKeys-non-finite');
require('./test-querystring-multichar-separator');

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc