sequenceserver 1.1.0.beta → 1.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sequenceserver might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +7 -7
- data/README.md +9 -11
- data/Rakefile +2 -15
- data/lib/sequenceserver/database.rb +7 -1
- data/lib/sequenceserver/routes.rb +5 -2
- data/lib/sequenceserver/version.rb +1 -1
- data/lib/sequenceserver.rb +3 -1
- data/package.json +2 -3
- data/public/config.js +0 -7
- data/public/css/sequenceserver.css +8 -17
- data/public/css/sequenceserver.min.css +2 -2
- data/public/js/report.js +62 -45
- data/public/js/search.js +24 -17
- data/public/js/sequenceserver.js +23 -60
- data/public/sequenceserver-report.min.js +17 -0
- data/public/sequenceserver-search.min.js +11 -0
- data/sequenceserver.gemspec +5 -5
- data/spec/capybara_spec.rb +3 -3
- data/spec/sequence_spec.rb +2 -2
- data/views/layout.erb +1 -13
- data/views/report.erb +13 -0
- data/views/search.erb +45 -0
- metadata +26 -92
- data/public/css/sequenceserver.min.css.gz +0 -0
- data/public/sequenceserver.min.js +0 -26
- data/public/sequenceserver.min.js.gz +0 -0
- data/public/vendor/npm/object-assign@2.1.1/.jspm-hash +0 -1
- data/public/vendor/npm/object-assign@2.1.1/.jspm.json +0 -72
- data/public/vendor/npm/object-assign@2.1.1/index.js +0 -27
- data/public/vendor/npm/object-assign@2.1.1/package.json +0 -38
- data/public/vendor/npm/object-assign@2.1.1.js +0 -1
- data/public/vendor/npm/qs@2.4.1/.jshintignore +0 -1
- data/public/vendor/npm/qs@2.4.1/.jshintrc +0 -10
- data/public/vendor/npm/qs@2.4.1/.jspm-hash +0 -1
- data/public/vendor/npm/qs@2.4.1/.jspm.json +0 -61
- data/public/vendor/npm/qs@2.4.1/.npmignore +0 -18
- data/public/vendor/npm/qs@2.4.1/.travis.yml +0 -6
- data/public/vendor/npm/qs@2.4.1/CHANGELOG.md +0 -68
- data/public/vendor/npm/qs@2.4.1/CONTRIBUTING.md +0 -1
- data/public/vendor/npm/qs@2.4.1/LICENSE +0 -28
- data/public/vendor/npm/qs@2.4.1/Makefile +0 -8
- data/public/vendor/npm/qs@2.4.1/README.md +0 -233
- data/public/vendor/npm/qs@2.4.1/index.js +0 -2
- data/public/vendor/npm/qs@2.4.1/lib/index.js +0 -8
- data/public/vendor/npm/qs@2.4.1/lib/parse.js +0 -100
- data/public/vendor/npm/qs@2.4.1/lib/stringify.js +0 -67
- data/public/vendor/npm/qs@2.4.1/lib/utils.js +0 -132
- data/public/vendor/npm/qs@2.4.1/lib.js +0 -2
- data/public/vendor/npm/qs@2.4.1/package.json +0 -29
- data/public/vendor/npm/qs@2.4.1/test/parse.js +0 -359
- data/public/vendor/npm/qs@2.4.1.js +0 -1
- data/public/vendor/npm/react-router@0.13.3/.jspm-hash +0 -1
- data/public/vendor/npm/react-router@0.13.3/.jspm.json +0 -70
- data/public/vendor/npm/react-router@0.13.3/README.md +0 -140
- data/public/vendor/npm/react-router@0.13.3/lib/Cancellation.js +0 -9
- data/public/vendor/npm/react-router@0.13.3/lib/History.js +0 -31
- data/public/vendor/npm/react-router@0.13.3/lib/Match.js +0 -80
- data/public/vendor/npm/react-router@0.13.3/lib/Navigation.js +0 -22
- data/public/vendor/npm/react-router@0.13.3/lib/PathUtils.js +0 -154
- data/public/vendor/npm/react-router@0.13.3/lib/PropTypes.js +0 -15
- data/public/vendor/npm/react-router@0.13.3/lib/Redirect.js +0 -12
- data/public/vendor/npm/react-router@0.13.3/lib/Route.js +0 -133
- data/public/vendor/npm/react-router@0.13.3/lib/ScrollHistory.js +0 -53
- data/public/vendor/npm/react-router@0.13.3/lib/State.js +0 -25
- data/public/vendor/npm/react-router@0.13.3/lib/TestUtils.js +0 -102
- data/public/vendor/npm/react-router@0.13.3/lib/Transition.js +0 -58
- data/public/vendor/npm/react-router@0.13.3/lib/actions/LocationActions.js +0 -25
- data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ImitateBrowserBehavior.js +0 -19
- data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ScrollToTopBehavior.js +0 -15
- data/public/vendor/npm/react-router@0.13.3/lib/components/ActiveHandler.js +0 -111
- data/public/vendor/npm/react-router@0.13.3/lib/components/ContextWrapper.js +0 -39
- data/public/vendor/npm/react-router@0.13.3/lib/components/DefaultRoute.js +0 -41
- data/public/vendor/npm/react-router@0.13.3/lib/components/Link.js +0 -119
- data/public/vendor/npm/react-router@0.13.3/lib/components/NotFoundRoute.js +0 -41
- data/public/vendor/npm/react-router@0.13.3/lib/components/Redirect.js +0 -40
- data/public/vendor/npm/react-router@0.13.3/lib/components/Route.js +0 -67
- data/public/vendor/npm/react-router@0.13.3/lib/components/RouteHandler.js +0 -111
- data/public/vendor/npm/react-router@0.13.3/lib/createRouter.js +0 -329
- data/public/vendor/npm/react-router@0.13.3/lib/createRoutesFromReactChildren.js +0 -59
- data/public/vendor/npm/react-router@0.13.3/lib/getWindowScrollPosition.js +0 -19
- data/public/vendor/npm/react-router@0.13.3/lib/index.js +0 -26
- data/public/vendor/npm/react-router@0.13.3/lib/isReactChildren.js +0 -14
- data/public/vendor/npm/react-router@0.13.3/lib/locations/HashLocation.js +0 -79
- data/public/vendor/npm/react-router@0.13.3/lib/locations/HistoryLocation.js +0 -64
- data/public/vendor/npm/react-router@0.13.3/lib/locations/RefreshLocation.js +0 -18
- data/public/vendor/npm/react-router@0.13.3/lib/locations/StaticLocation.js +0 -50
- data/public/vendor/npm/react-router@0.13.3/lib/locations/TestLocation.js +0 -104
- data/public/vendor/npm/react-router@0.13.3/lib/runRouter.js +0 -16
- data/public/vendor/npm/react-router@0.13.3/lib/supportsHistory.js +0 -17
- data/public/vendor/npm/react-router@0.13.3/lib.js +0 -2
- data/public/vendor/npm/react-router@0.13.3/package.json +0 -36
- data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.js +0 -3388
- data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.min.js +0 -8
@@ -1,100 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
var Utils = require("./utils");
|
3
|
-
var internals = {
|
4
|
-
delimiter: '&',
|
5
|
-
depth: 5,
|
6
|
-
arrayLimit: 20,
|
7
|
-
parameterLimit: 1000
|
8
|
-
};
|
9
|
-
internals.parseValues = function(str, options) {
|
10
|
-
var obj = {};
|
11
|
-
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
|
12
|
-
for (var i = 0,
|
13
|
-
il = parts.length; i < il; ++i) {
|
14
|
-
var part = parts[i];
|
15
|
-
var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
|
16
|
-
if (pos === -1) {
|
17
|
-
obj[Utils.decode(part)] = '';
|
18
|
-
} else {
|
19
|
-
var key = Utils.decode(part.slice(0, pos));
|
20
|
-
var val = Utils.decode(part.slice(pos + 1));
|
21
|
-
if (Object.prototype.hasOwnProperty(key)) {
|
22
|
-
continue;
|
23
|
-
}
|
24
|
-
if (!obj.hasOwnProperty(key)) {
|
25
|
-
obj[key] = val;
|
26
|
-
} else {
|
27
|
-
obj[key] = [].concat(obj[key]).concat(val);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
return obj;
|
32
|
-
};
|
33
|
-
internals.parseObject = function(chain, val, options) {
|
34
|
-
if (!chain.length) {
|
35
|
-
return val;
|
36
|
-
}
|
37
|
-
var root = chain.shift();
|
38
|
-
var obj = {};
|
39
|
-
if (root === '[]') {
|
40
|
-
obj = [];
|
41
|
-
obj = obj.concat(internals.parseObject(chain, val, options));
|
42
|
-
} else {
|
43
|
-
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
|
44
|
-
var index = parseInt(cleanRoot, 10);
|
45
|
-
var indexString = '' + index;
|
46
|
-
if (!isNaN(index) && root !== cleanRoot && indexString === cleanRoot && index >= 0 && index <= options.arrayLimit) {
|
47
|
-
obj = [];
|
48
|
-
obj[index] = internals.parseObject(chain, val, options);
|
49
|
-
} else {
|
50
|
-
obj[cleanRoot] = internals.parseObject(chain, val, options);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
return obj;
|
54
|
-
};
|
55
|
-
internals.parseKeys = function(key, val, options) {
|
56
|
-
if (!key) {
|
57
|
-
return;
|
58
|
-
}
|
59
|
-
var parent = /^([^\[\]]*)/;
|
60
|
-
var child = /(\[[^\[\]]*\])/g;
|
61
|
-
var segment = parent.exec(key);
|
62
|
-
if (Object.prototype.hasOwnProperty(segment[1])) {
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
var keys = [];
|
66
|
-
if (segment[1]) {
|
67
|
-
keys.push(segment[1]);
|
68
|
-
}
|
69
|
-
var i = 0;
|
70
|
-
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
71
|
-
++i;
|
72
|
-
if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
|
73
|
-
keys.push(segment[1]);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
if (segment) {
|
77
|
-
keys.push('[' + key.slice(segment.index) + ']');
|
78
|
-
}
|
79
|
-
return internals.parseObject(keys, val, options);
|
80
|
-
};
|
81
|
-
module.exports = function(str, options) {
|
82
|
-
if (str === '' || str === null || typeof str === 'undefined') {
|
83
|
-
return {};
|
84
|
-
}
|
85
|
-
options = options || {};
|
86
|
-
options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
|
87
|
-
options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
|
88
|
-
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
|
89
|
-
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
|
90
|
-
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
|
91
|
-
var obj = {};
|
92
|
-
var keys = Object.keys(tempObj);
|
93
|
-
for (var i = 0,
|
94
|
-
il = keys.length; i < il; ++i) {
|
95
|
-
var key = keys[i];
|
96
|
-
var newObj = internals.parseKeys(key, tempObj[key], options);
|
97
|
-
obj = Utils.merge(obj, newObj);
|
98
|
-
}
|
99
|
-
return Utils.compact(obj);
|
100
|
-
};
|
@@ -1,67 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
var Utils = require("./utils");
|
3
|
-
var internals = {
|
4
|
-
delimiter: '&',
|
5
|
-
arrayPrefixGenerators: {
|
6
|
-
brackets: function(prefix, key) {
|
7
|
-
return prefix + '[]';
|
8
|
-
},
|
9
|
-
indices: function(prefix, key) {
|
10
|
-
return prefix + '[' + key + ']';
|
11
|
-
},
|
12
|
-
repeat: function(prefix, key) {
|
13
|
-
return prefix;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
};
|
17
|
-
internals.stringify = function(obj, prefix, generateArrayPrefix) {
|
18
|
-
if (Utils.isBuffer(obj)) {
|
19
|
-
obj = obj.toString();
|
20
|
-
} else if (obj instanceof Date) {
|
21
|
-
obj = obj.toISOString();
|
22
|
-
} else if (obj === null) {
|
23
|
-
obj = '';
|
24
|
-
}
|
25
|
-
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {
|
26
|
-
return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)];
|
27
|
-
}
|
28
|
-
var values = [];
|
29
|
-
if (typeof obj === 'undefined') {
|
30
|
-
return values;
|
31
|
-
}
|
32
|
-
var objKeys = Object.keys(obj);
|
33
|
-
for (var i = 0,
|
34
|
-
il = objKeys.length; i < il; ++i) {
|
35
|
-
var key = objKeys[i];
|
36
|
-
if (Array.isArray(obj)) {
|
37
|
-
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix));
|
38
|
-
} else {
|
39
|
-
values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix));
|
40
|
-
}
|
41
|
-
}
|
42
|
-
return values;
|
43
|
-
};
|
44
|
-
module.exports = function(obj, options) {
|
45
|
-
options = options || {};
|
46
|
-
var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
|
47
|
-
var keys = [];
|
48
|
-
if (typeof obj !== 'object' || obj === null) {
|
49
|
-
return '';
|
50
|
-
}
|
51
|
-
var arrayFormat;
|
52
|
-
if (options.arrayFormat in internals.arrayPrefixGenerators) {
|
53
|
-
arrayFormat = options.arrayFormat;
|
54
|
-
} else if ('indices' in options) {
|
55
|
-
arrayFormat = options.indices ? 'indices' : 'repeat';
|
56
|
-
} else {
|
57
|
-
arrayFormat = 'indices';
|
58
|
-
}
|
59
|
-
var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
|
60
|
-
var objKeys = Object.keys(obj);
|
61
|
-
for (var i = 0,
|
62
|
-
il = objKeys.length; i < il; ++i) {
|
63
|
-
var key = objKeys[i];
|
64
|
-
keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix));
|
65
|
-
}
|
66
|
-
return keys.join(delimiter);
|
67
|
-
};
|
@@ -1,132 +0,0 @@
|
|
1
|
-
// Load modules
|
2
|
-
|
3
|
-
|
4
|
-
// Declare internals
|
5
|
-
|
6
|
-
var internals = {};
|
7
|
-
|
8
|
-
|
9
|
-
exports.arrayToObject = function (source) {
|
10
|
-
|
11
|
-
var obj = {};
|
12
|
-
for (var i = 0, il = source.length; i < il; ++i) {
|
13
|
-
if (typeof source[i] !== 'undefined') {
|
14
|
-
|
15
|
-
obj[i] = source[i];
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
return obj;
|
20
|
-
};
|
21
|
-
|
22
|
-
|
23
|
-
exports.merge = function (target, source) {
|
24
|
-
|
25
|
-
if (!source) {
|
26
|
-
return target;
|
27
|
-
}
|
28
|
-
|
29
|
-
if (typeof source !== 'object') {
|
30
|
-
if (Array.isArray(target)) {
|
31
|
-
target.push(source);
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
target[source] = true;
|
35
|
-
}
|
36
|
-
|
37
|
-
return target;
|
38
|
-
}
|
39
|
-
|
40
|
-
if (typeof target !== 'object') {
|
41
|
-
target = [target].concat(source);
|
42
|
-
return target;
|
43
|
-
}
|
44
|
-
|
45
|
-
if (Array.isArray(target) &&
|
46
|
-
!Array.isArray(source)) {
|
47
|
-
|
48
|
-
target = exports.arrayToObject(target);
|
49
|
-
}
|
50
|
-
|
51
|
-
var keys = Object.keys(source);
|
52
|
-
for (var k = 0, kl = keys.length; k < kl; ++k) {
|
53
|
-
var key = keys[k];
|
54
|
-
var value = source[key];
|
55
|
-
|
56
|
-
if (!target[key]) {
|
57
|
-
target[key] = value;
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
target[key] = exports.merge(target[key], value);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
return target;
|
65
|
-
};
|
66
|
-
|
67
|
-
|
68
|
-
exports.decode = function (str) {
|
69
|
-
|
70
|
-
try {
|
71
|
-
return decodeURIComponent(str.replace(/\+/g, ' '));
|
72
|
-
} catch (e) {
|
73
|
-
return str;
|
74
|
-
}
|
75
|
-
};
|
76
|
-
|
77
|
-
|
78
|
-
exports.compact = function (obj, refs) {
|
79
|
-
|
80
|
-
if (typeof obj !== 'object' ||
|
81
|
-
obj === null) {
|
82
|
-
|
83
|
-
return obj;
|
84
|
-
}
|
85
|
-
|
86
|
-
refs = refs || [];
|
87
|
-
var lookup = refs.indexOf(obj);
|
88
|
-
if (lookup !== -1) {
|
89
|
-
return refs[lookup];
|
90
|
-
}
|
91
|
-
|
92
|
-
refs.push(obj);
|
93
|
-
|
94
|
-
if (Array.isArray(obj)) {
|
95
|
-
var compacted = [];
|
96
|
-
|
97
|
-
for (var i = 0, il = obj.length; i < il; ++i) {
|
98
|
-
if (typeof obj[i] !== 'undefined') {
|
99
|
-
compacted.push(obj[i]);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
return compacted;
|
104
|
-
}
|
105
|
-
|
106
|
-
var keys = Object.keys(obj);
|
107
|
-
for (i = 0, il = keys.length; i < il; ++i) {
|
108
|
-
var key = keys[i];
|
109
|
-
obj[key] = exports.compact(obj[key], refs);
|
110
|
-
}
|
111
|
-
|
112
|
-
return obj;
|
113
|
-
};
|
114
|
-
|
115
|
-
|
116
|
-
exports.isRegExp = function (obj) {
|
117
|
-
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
118
|
-
};
|
119
|
-
|
120
|
-
|
121
|
-
exports.isBuffer = function (obj) {
|
122
|
-
|
123
|
-
if (obj === null ||
|
124
|
-
typeof obj === 'undefined') {
|
125
|
-
|
126
|
-
return false;
|
127
|
-
}
|
128
|
-
|
129
|
-
return !!(obj.constructor &&
|
130
|
-
obj.constructor.isBuffer &&
|
131
|
-
obj.constructor.isBuffer(obj));
|
132
|
-
};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "qs",
|
3
|
-
"version": "2.4.1",
|
4
|
-
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
|
5
|
-
"homepage": "https://github.com/hapijs/qs",
|
6
|
-
"main": "index.js",
|
7
|
-
"dependencies": {},
|
8
|
-
"devDependencies": {
|
9
|
-
"code": "1.x.x",
|
10
|
-
"lab": "5.x.x"
|
11
|
-
},
|
12
|
-
"scripts": {
|
13
|
-
"test": "make test-cov"
|
14
|
-
},
|
15
|
-
"repository": {
|
16
|
-
"type": "git",
|
17
|
-
"url": "https://github.com/hapijs/qs.git"
|
18
|
-
},
|
19
|
-
"keywords": [
|
20
|
-
"querystring",
|
21
|
-
"qs"
|
22
|
-
],
|
23
|
-
"licenses": [
|
24
|
-
{
|
25
|
-
"type": "BSD",
|
26
|
-
"url": "http://github.com/hapijs/qs/raw/master/LICENSE"
|
27
|
-
}
|
28
|
-
]
|
29
|
-
}
|
@@ -1,359 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
(function(Buffer) {
|
3
|
-
var Code = require("code");
|
4
|
-
var Lab = require("lab");
|
5
|
-
var Qs = require("../index");
|
6
|
-
var internals = {};
|
7
|
-
var lab = exports.lab = Lab.script();
|
8
|
-
var expect = Code.expect;
|
9
|
-
var describe = lab.experiment;
|
10
|
-
var it = lab.test;
|
11
|
-
describe('parse()', function() {
|
12
|
-
it('parses a simple string', function(done) {
|
13
|
-
expect(Qs.parse('0=foo')).to.deep.equal({'0': 'foo'});
|
14
|
-
expect(Qs.parse('foo=c++')).to.deep.equal({foo: 'c '});
|
15
|
-
expect(Qs.parse('a[>=]=23')).to.deep.equal({a: {'>=': '23'}});
|
16
|
-
expect(Qs.parse('a[<=>]==23')).to.deep.equal({a: {'<=>': '=23'}});
|
17
|
-
expect(Qs.parse('a[==]=23')).to.deep.equal({a: {'==': '23'}});
|
18
|
-
expect(Qs.parse('foo')).to.deep.equal({foo: ''});
|
19
|
-
expect(Qs.parse('foo=bar')).to.deep.equal({foo: 'bar'});
|
20
|
-
expect(Qs.parse(' foo = bar = baz ')).to.deep.equal({' foo ': ' bar = baz '});
|
21
|
-
expect(Qs.parse('foo=bar=baz')).to.deep.equal({foo: 'bar=baz'});
|
22
|
-
expect(Qs.parse('foo=bar&bar=baz')).to.deep.equal({
|
23
|
-
foo: 'bar',
|
24
|
-
bar: 'baz'
|
25
|
-
});
|
26
|
-
expect(Qs.parse('foo=bar&baz')).to.deep.equal({
|
27
|
-
foo: 'bar',
|
28
|
-
baz: ''
|
29
|
-
});
|
30
|
-
expect(Qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World')).to.deep.equal({
|
31
|
-
cht: 'p3',
|
32
|
-
chd: 't:60,40',
|
33
|
-
chs: '250x100',
|
34
|
-
chl: 'Hello|World'
|
35
|
-
});
|
36
|
-
done();
|
37
|
-
});
|
38
|
-
it('parses a single nested string', function(done) {
|
39
|
-
expect(Qs.parse('a[b]=c')).to.deep.equal({a: {b: 'c'}});
|
40
|
-
done();
|
41
|
-
});
|
42
|
-
it('parses a double nested string', function(done) {
|
43
|
-
expect(Qs.parse('a[b][c]=d')).to.deep.equal({a: {b: {c: 'd'}}});
|
44
|
-
done();
|
45
|
-
});
|
46
|
-
it('defaults to a depth of 5', function(done) {
|
47
|
-
expect(Qs.parse('a[b][c][d][e][f][g][h]=i')).to.deep.equal({a: {b: {c: {d: {e: {f: {'[g][h]': 'i'}}}}}}});
|
48
|
-
done();
|
49
|
-
});
|
50
|
-
it('only parses one level when depth = 1', function(done) {
|
51
|
-
expect(Qs.parse('a[b][c]=d', {depth: 1})).to.deep.equal({a: {b: {'[c]': 'd'}}});
|
52
|
-
expect(Qs.parse('a[b][c][d]=e', {depth: 1})).to.deep.equal({a: {b: {'[c][d]': 'e'}}});
|
53
|
-
done();
|
54
|
-
});
|
55
|
-
it('parses a simple array', function(done) {
|
56
|
-
expect(Qs.parse('a=b&a=c')).to.deep.equal({a: ['b', 'c']});
|
57
|
-
done();
|
58
|
-
});
|
59
|
-
it('parses an explicit array', function(done) {
|
60
|
-
expect(Qs.parse('a[]=b')).to.deep.equal({a: ['b']});
|
61
|
-
expect(Qs.parse('a[]=b&a[]=c')).to.deep.equal({a: ['b', 'c']});
|
62
|
-
expect(Qs.parse('a[]=b&a[]=c&a[]=d')).to.deep.equal({a: ['b', 'c', 'd']});
|
63
|
-
done();
|
64
|
-
});
|
65
|
-
it('parses a mix of simple and explicit arrays', function(done) {
|
66
|
-
expect(Qs.parse('a=b&a[]=c')).to.deep.equal({a: ['b', 'c']});
|
67
|
-
expect(Qs.parse('a[]=b&a=c')).to.deep.equal({a: ['b', 'c']});
|
68
|
-
expect(Qs.parse('a[0]=b&a=c')).to.deep.equal({a: ['b', 'c']});
|
69
|
-
expect(Qs.parse('a=b&a[0]=c')).to.deep.equal({a: ['b', 'c']});
|
70
|
-
expect(Qs.parse('a[1]=b&a=c')).to.deep.equal({a: ['b', 'c']});
|
71
|
-
expect(Qs.parse('a=b&a[1]=c')).to.deep.equal({a: ['b', 'c']});
|
72
|
-
done();
|
73
|
-
});
|
74
|
-
it('parses a nested array', function(done) {
|
75
|
-
expect(Qs.parse('a[b][]=c&a[b][]=d')).to.deep.equal({a: {b: ['c', 'd']}});
|
76
|
-
expect(Qs.parse('a[>=]=25')).to.deep.equal({a: {'>=': '25'}});
|
77
|
-
done();
|
78
|
-
});
|
79
|
-
it('allows to specify array indices', function(done) {
|
80
|
-
expect(Qs.parse('a[1]=c&a[0]=b&a[2]=d')).to.deep.equal({a: ['b', 'c', 'd']});
|
81
|
-
expect(Qs.parse('a[1]=c&a[0]=b')).to.deep.equal({a: ['b', 'c']});
|
82
|
-
expect(Qs.parse('a[1]=c')).to.deep.equal({a: ['c']});
|
83
|
-
done();
|
84
|
-
});
|
85
|
-
it('limits specific array indices to 20', function(done) {
|
86
|
-
expect(Qs.parse('a[20]=a')).to.deep.equal({a: ['a']});
|
87
|
-
expect(Qs.parse('a[21]=a')).to.deep.equal({a: {'21': 'a'}});
|
88
|
-
done();
|
89
|
-
});
|
90
|
-
it('supports keys that begin with a number', function(done) {
|
91
|
-
expect(Qs.parse('a[12b]=c')).to.deep.equal({a: {'12b': 'c'}});
|
92
|
-
done();
|
93
|
-
});
|
94
|
-
it('supports encoded = signs', function(done) {
|
95
|
-
expect(Qs.parse('he%3Dllo=th%3Dere')).to.deep.equal({'he=llo': 'th=ere'});
|
96
|
-
done();
|
97
|
-
});
|
98
|
-
it('is ok with url encoded strings', function(done) {
|
99
|
-
expect(Qs.parse('a[b%20c]=d')).to.deep.equal({a: {'b c': 'd'}});
|
100
|
-
expect(Qs.parse('a[b]=c%20d')).to.deep.equal({a: {b: 'c d'}});
|
101
|
-
done();
|
102
|
-
});
|
103
|
-
it('allows brackets in the value', function(done) {
|
104
|
-
expect(Qs.parse('pets=["tobi"]')).to.deep.equal({pets: '["tobi"]'});
|
105
|
-
expect(Qs.parse('operators=[">=", "<="]')).to.deep.equal({operators: '[">=", "<="]'});
|
106
|
-
done();
|
107
|
-
});
|
108
|
-
it('allows empty values', function(done) {
|
109
|
-
expect(Qs.parse('')).to.deep.equal({});
|
110
|
-
expect(Qs.parse(null)).to.deep.equal({});
|
111
|
-
expect(Qs.parse(undefined)).to.deep.equal({});
|
112
|
-
done();
|
113
|
-
});
|
114
|
-
it('transforms arrays to objects', function(done) {
|
115
|
-
expect(Qs.parse('foo[0]=bar&foo[bad]=baz')).to.deep.equal({foo: {
|
116
|
-
'0': 'bar',
|
117
|
-
bad: 'baz'
|
118
|
-
}});
|
119
|
-
expect(Qs.parse('foo[bad]=baz&foo[0]=bar')).to.deep.equal({foo: {
|
120
|
-
bad: 'baz',
|
121
|
-
'0': 'bar'
|
122
|
-
}});
|
123
|
-
expect(Qs.parse('foo[bad]=baz&foo[]=bar')).to.deep.equal({foo: {
|
124
|
-
bad: 'baz',
|
125
|
-
'0': 'bar'
|
126
|
-
}});
|
127
|
-
expect(Qs.parse('foo[]=bar&foo[bad]=baz')).to.deep.equal({foo: {
|
128
|
-
'0': 'bar',
|
129
|
-
bad: 'baz'
|
130
|
-
}});
|
131
|
-
expect(Qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo')).to.deep.equal({foo: {
|
132
|
-
bad: 'baz',
|
133
|
-
'0': 'bar',
|
134
|
-
'1': 'foo'
|
135
|
-
}});
|
136
|
-
expect(Qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb')).to.deep.equal({foo: [{
|
137
|
-
a: 'a',
|
138
|
-
b: 'b'
|
139
|
-
}, {
|
140
|
-
a: 'aa',
|
141
|
-
b: 'bb'
|
142
|
-
}]});
|
143
|
-
done();
|
144
|
-
});
|
145
|
-
it('can add keys to objects', function(done) {
|
146
|
-
expect(Qs.parse('a[b]=c&a=d')).to.deep.equal({a: {
|
147
|
-
b: 'c',
|
148
|
-
d: true
|
149
|
-
}});
|
150
|
-
done();
|
151
|
-
});
|
152
|
-
it('correctly prunes undefined values when converting an array to an object', function(done) {
|
153
|
-
expect(Qs.parse('a[2]=b&a[99999999]=c')).to.deep.equal({a: {
|
154
|
-
'2': 'b',
|
155
|
-
'99999999': 'c'
|
156
|
-
}});
|
157
|
-
done();
|
158
|
-
});
|
159
|
-
it('supports malformed uri characters', function(done) {
|
160
|
-
expect(Qs.parse('{%:%}')).to.deep.equal({'{%:%}': ''});
|
161
|
-
expect(Qs.parse('foo=%:%}')).to.deep.equal({foo: '%:%}'});
|
162
|
-
done();
|
163
|
-
});
|
164
|
-
it('doesn\'t produce empty keys', function(done) {
|
165
|
-
expect(Qs.parse('_r=1&')).to.deep.equal({'_r': '1'});
|
166
|
-
done();
|
167
|
-
});
|
168
|
-
it('cannot override prototypes', function(done) {
|
169
|
-
var obj = Qs.parse('hasOwnProperty=bad&toString=bad&bad[toString]=bad&constructor=bad');
|
170
|
-
expect(typeof obj.toString).to.equal('function');
|
171
|
-
expect(typeof obj.bad.toString).to.equal('function');
|
172
|
-
expect(typeof obj.constructor).to.equal('function');
|
173
|
-
done();
|
174
|
-
});
|
175
|
-
it('cannot access Object prototype', function(done) {
|
176
|
-
Qs.parse('constructor[prototype][bad]=bad');
|
177
|
-
Qs.parse('bad[constructor][prototype][bad]=bad');
|
178
|
-
expect(typeof Object.prototype.bad).to.equal('undefined');
|
179
|
-
done();
|
180
|
-
});
|
181
|
-
it('parses arrays of objects', function(done) {
|
182
|
-
expect(Qs.parse('a[][b]=c')).to.deep.equal({a: [{b: 'c'}]});
|
183
|
-
expect(Qs.parse('a[0][b]=c')).to.deep.equal({a: [{b: 'c'}]});
|
184
|
-
done();
|
185
|
-
});
|
186
|
-
it('allows for empty strings in arrays', function(done) {
|
187
|
-
expect(Qs.parse('a[]=b&a[]=&a[]=c')).to.deep.equal({a: ['b', '', 'c']});
|
188
|
-
expect(Qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]=')).to.deep.equal({a: ['b', '', 'c', '']});
|
189
|
-
expect(Qs.parse('a[]=&a[]=b&a[]=c')).to.deep.equal({a: ['', 'b', 'c']});
|
190
|
-
done();
|
191
|
-
});
|
192
|
-
it('compacts sparse arrays', function(done) {
|
193
|
-
expect(Qs.parse('a[10]=1&a[2]=2')).to.deep.equal({a: ['2', '1']});
|
194
|
-
done();
|
195
|
-
});
|
196
|
-
it('parses semi-parsed strings', function(done) {
|
197
|
-
expect(Qs.parse({'a[b]': 'c'})).to.deep.equal({a: {b: 'c'}});
|
198
|
-
expect(Qs.parse({
|
199
|
-
'a[b]': 'c',
|
200
|
-
'a[d]': 'e'
|
201
|
-
})).to.deep.equal({a: {
|
202
|
-
b: 'c',
|
203
|
-
d: 'e'
|
204
|
-
}});
|
205
|
-
done();
|
206
|
-
});
|
207
|
-
it('parses buffers correctly', function(done) {
|
208
|
-
var b = new Buffer('test');
|
209
|
-
expect(Qs.parse({a: b})).to.deep.equal({a: b});
|
210
|
-
done();
|
211
|
-
});
|
212
|
-
it('continues parsing when no parent is found', function(done) {
|
213
|
-
expect(Qs.parse('[]&a=b')).to.deep.equal({
|
214
|
-
'0': '',
|
215
|
-
a: 'b'
|
216
|
-
});
|
217
|
-
expect(Qs.parse('[foo]=bar')).to.deep.equal({foo: 'bar'});
|
218
|
-
done();
|
219
|
-
});
|
220
|
-
it('does not error when parsing a very long array', function(done) {
|
221
|
-
var str = 'a[]=a';
|
222
|
-
while (Buffer.byteLength(str) < 128 * 1024) {
|
223
|
-
str += '&' + str;
|
224
|
-
}
|
225
|
-
expect(function() {
|
226
|
-
Qs.parse(str);
|
227
|
-
}).to.not.throw();
|
228
|
-
done();
|
229
|
-
});
|
230
|
-
it('should not throw when a native prototype has an enumerable property', {parallel: false}, function(done) {
|
231
|
-
Object.prototype.crash = '';
|
232
|
-
Array.prototype.crash = '';
|
233
|
-
expect(Qs.parse.bind(null, 'a=b')).to.not.throw();
|
234
|
-
expect(Qs.parse('a=b')).to.deep.equal({a: 'b'});
|
235
|
-
expect(Qs.parse.bind(null, 'a[][b]=c')).to.not.throw();
|
236
|
-
expect(Qs.parse('a[][b]=c')).to.deep.equal({a: [{b: 'c'}]});
|
237
|
-
delete Object.prototype.crash;
|
238
|
-
delete Array.prototype.crash;
|
239
|
-
done();
|
240
|
-
});
|
241
|
-
it('parses a string with an alternative string delimiter', function(done) {
|
242
|
-
expect(Qs.parse('a=b;c=d', {delimiter: ';'})).to.deep.equal({
|
243
|
-
a: 'b',
|
244
|
-
c: 'd'
|
245
|
-
});
|
246
|
-
done();
|
247
|
-
});
|
248
|
-
it('parses a string with an alternative RegExp delimiter', function(done) {
|
249
|
-
expect(Qs.parse('a=b; c=d', {delimiter: /[;,] */})).to.deep.equal({
|
250
|
-
a: 'b',
|
251
|
-
c: 'd'
|
252
|
-
});
|
253
|
-
done();
|
254
|
-
});
|
255
|
-
it('does not use non-splittable objects as delimiters', function(done) {
|
256
|
-
expect(Qs.parse('a=b&c=d', {delimiter: true})).to.deep.equal({
|
257
|
-
a: 'b',
|
258
|
-
c: 'd'
|
259
|
-
});
|
260
|
-
done();
|
261
|
-
});
|
262
|
-
it('allows overriding parameter limit', function(done) {
|
263
|
-
expect(Qs.parse('a=b&c=d', {parameterLimit: 1})).to.deep.equal({a: 'b'});
|
264
|
-
done();
|
265
|
-
});
|
266
|
-
it('allows setting the parameter limit to Infinity', function(done) {
|
267
|
-
expect(Qs.parse('a=b&c=d', {parameterLimit: Infinity})).to.deep.equal({
|
268
|
-
a: 'b',
|
269
|
-
c: 'd'
|
270
|
-
});
|
271
|
-
done();
|
272
|
-
});
|
273
|
-
it('allows overriding array limit', function(done) {
|
274
|
-
expect(Qs.parse('a[0]=b', {arrayLimit: -1})).to.deep.equal({a: {'0': 'b'}});
|
275
|
-
expect(Qs.parse('a[-1]=b', {arrayLimit: -1})).to.deep.equal({a: {'-1': 'b'}});
|
276
|
-
expect(Qs.parse('a[0]=b&a[1]=c', {arrayLimit: 0})).to.deep.equal({a: {
|
277
|
-
'0': 'b',
|
278
|
-
'1': 'c'
|
279
|
-
}});
|
280
|
-
done();
|
281
|
-
});
|
282
|
-
it('parses an object', function(done) {
|
283
|
-
var input = {
|
284
|
-
'user[name]': {'pop[bob]': 3},
|
285
|
-
'user[email]': null
|
286
|
-
};
|
287
|
-
var expected = {'user': {
|
288
|
-
'name': {'pop[bob]': 3},
|
289
|
-
'email': null
|
290
|
-
}};
|
291
|
-
var result = Qs.parse(input);
|
292
|
-
expect(result).to.deep.equal(expected);
|
293
|
-
done();
|
294
|
-
});
|
295
|
-
it('parses an object and not child values', function(done) {
|
296
|
-
var input = {
|
297
|
-
'user[name]': {'pop[bob]': {'test': 3}},
|
298
|
-
'user[email]': null
|
299
|
-
};
|
300
|
-
var expected = {'user': {
|
301
|
-
'name': {'pop[bob]': {'test': 3}},
|
302
|
-
'email': null
|
303
|
-
}};
|
304
|
-
var result = Qs.parse(input);
|
305
|
-
expect(result).to.deep.equal(expected);
|
306
|
-
done();
|
307
|
-
});
|
308
|
-
it('does not blow up when Buffer global is missing', function(done) {
|
309
|
-
var tempBuffer = global.Buffer;
|
310
|
-
delete global.Buffer;
|
311
|
-
var result = Qs.parse('a=b&c=d');
|
312
|
-
global.Buffer = tempBuffer;
|
313
|
-
expect(result).to.deep.equal({
|
314
|
-
a: 'b',
|
315
|
-
c: 'd'
|
316
|
-
});
|
317
|
-
done();
|
318
|
-
});
|
319
|
-
it('does not crash when using invalid dot notation', function(done) {
|
320
|
-
expect(Qs.parse('roomInfoList[0].childrenAges[0]=15&roomInfoList[0].numberOfAdults=2')).to.deep.equal({roomInfoList: [['15', '2']]});
|
321
|
-
done();
|
322
|
-
});
|
323
|
-
it('does not crash when parsing circular references', function(done) {
|
324
|
-
var a = {};
|
325
|
-
a.b = a;
|
326
|
-
var parsed;
|
327
|
-
expect(function() {
|
328
|
-
parsed = Qs.parse({
|
329
|
-
'foo[bar]': 'baz',
|
330
|
-
'foo[baz]': a
|
331
|
-
});
|
332
|
-
}).to.not.throw();
|
333
|
-
expect(parsed).to.contain('foo');
|
334
|
-
expect(parsed.foo).to.contain('bar', 'baz');
|
335
|
-
expect(parsed.foo.bar).to.equal('baz');
|
336
|
-
expect(parsed.foo.baz).to.deep.equal(a);
|
337
|
-
done();
|
338
|
-
});
|
339
|
-
it('parses plain objects correctly', function(done) {
|
340
|
-
var a = Object.create(null);
|
341
|
-
a.b = 'c';
|
342
|
-
expect(Qs.parse(a)).to.deep.equal({b: 'c'});
|
343
|
-
var result = Qs.parse({a: a});
|
344
|
-
expect(result).to.contain('a');
|
345
|
-
expect(result.a).to.deep.equal(a);
|
346
|
-
done();
|
347
|
-
});
|
348
|
-
it('parses dates correctly', function(done) {
|
349
|
-
var now = new Date();
|
350
|
-
expect(Qs.parse({a: now})).to.deep.equal({a: now});
|
351
|
-
done();
|
352
|
-
});
|
353
|
-
it('parses regular expressions correctly', function(done) {
|
354
|
-
var re = /^test$/;
|
355
|
-
expect(Qs.parse({a: re})).to.deep.equal({a: re});
|
356
|
-
done();
|
357
|
-
});
|
358
|
-
});
|
359
|
-
})(require("buffer").Buffer);
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require("npm:qs@2.4.1/index");
|
@@ -1 +0,0 @@
|
|
1
|
-
95455dd19d2c04c7b2957ff7fccda76031ac29b199914b932bd37a50b983c5e7c90ae93bjspm-npm@0.240.16
|