qs 6.5.3 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/utils.js CHANGED
@@ -4,10 +4,6 @@ var test = require('tape');
4
4
  var utils = require('../lib/utils');
5
5
 
6
6
  test('merge()', function (t) {
7
- t.deepEqual(utils.merge(null, true), [null, true], 'merges true into null');
8
-
9
- t.deepEqual(utils.merge(null, [42]), [null, 42], 'merges null into an array');
10
-
11
7
  t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key');
12
8
 
13
9
  var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } });
@@ -25,30 +21,6 @@ test('merge()', function (t) {
25
21
  var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
26
22
  t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
27
23
 
28
- t.test(
29
- 'avoids invoking array setters unnecessarily',
30
- { skip: typeof Object.defineProperty !== 'function' },
31
- function (st) {
32
- var setCount = 0;
33
- var getCount = 0;
34
- var observed = [];
35
- Object.defineProperty(observed, 0, {
36
- get: function () {
37
- getCount += 1;
38
- return { bar: 'baz' };
39
- },
40
- set: function () { setCount += 1; }
41
- });
42
- utils.merge(observed, [null]);
43
- st.equal(setCount, 0);
44
- st.equal(getCount, 1);
45
- observed[0] = observed[0]; // eslint-disable-line no-self-assign
46
- st.equal(setCount, 1);
47
- st.equal(getCount, 2);
48
- st.end();
49
- }
50
- );
51
-
52
24
  t.end();
53
25
  });
54
26
 
@@ -63,3 +35,55 @@ test('assign()', function (t) {
63
35
 
64
36
  t.end();
65
37
  });
38
+
39
+ test('combine()', function (t) {
40
+ t.test('both arrays', function (st) {
41
+ var a = [1];
42
+ var b = [2];
43
+ var combined = utils.combine(a, b);
44
+
45
+ st.deepEqual(a, [1], 'a is not mutated');
46
+ st.deepEqual(b, [2], 'b is not mutated');
47
+ st.notEqual(a, combined, 'a !== combined');
48
+ st.notEqual(b, combined, 'b !== combined');
49
+ st.deepEqual(combined, [1, 2], 'combined is a + b');
50
+
51
+ st.end();
52
+ });
53
+
54
+ t.test('one array, one non-array', function (st) {
55
+ var aN = 1;
56
+ var a = [aN];
57
+ var bN = 2;
58
+ var b = [bN];
59
+
60
+ var combinedAnB = utils.combine(aN, b);
61
+ st.deepEqual(b, [bN], 'b is not mutated');
62
+ st.notEqual(aN, combinedAnB, 'aN + b !== aN');
63
+ st.notEqual(a, combinedAnB, 'aN + b !== a');
64
+ st.notEqual(bN, combinedAnB, 'aN + b !== bN');
65
+ st.notEqual(b, combinedAnB, 'aN + b !== b');
66
+ st.deepEqual([1, 2], combinedAnB, 'first argument is array-wrapped when not an array');
67
+
68
+ var combinedABn = utils.combine(a, bN);
69
+ st.deepEqual(a, [aN], 'a is not mutated');
70
+ st.notEqual(aN, combinedABn, 'a + bN !== aN');
71
+ st.notEqual(a, combinedABn, 'a + bN !== a');
72
+ st.notEqual(bN, combinedABn, 'a + bN !== bN');
73
+ st.notEqual(b, combinedABn, 'a + bN !== b');
74
+ st.deepEqual([1, 2], combinedABn, 'second argument is array-wrapped when not an array');
75
+
76
+ st.end();
77
+ });
78
+
79
+ t.test('neither is an array', function (st) {
80
+ var combined = utils.combine(1, 2);
81
+ st.notEqual(1, combined, '1 + 2 !== 1');
82
+ st.notEqual(2, combined, '1 + 2 !== 2');
83
+ st.deepEqual([1, 2], combined, 'both arguments are array-wrapped when not an array');
84
+
85
+ st.end();
86
+ });
87
+
88
+ t.end();
89
+ });
@@ -1,12 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [ljharb]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: npm/qs
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: # Replace with a single custom sponsorship URL
package/.nycrc DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "all": true,
3
- "check-coverage": false,
4
- "reporter": ["text-summary", "text", "html", "json"],
5
- "lines": 86,
6
- "statements": 85.93,
7
- "functions": 82.43,
8
- "branches": 76.06,
9
- "exclude": [
10
- "coverage",
11
- "dist"
12
- ]
13
- }
package/LICENSE.md DELETED
@@ -1,29 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/ljharb/qs/graphs/contributors)
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/bower.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "name": "qs",
3
- "main": "dist/qs.js",
4
- "homepage": "https://github.com/hapijs/qs",
5
- "authors": [
6
- "Nathan LaFreniere <quitlahok@gmail.com>"
7
- ],
8
- "description": "A querystring parser that supports nesting and arrays, with a depth limit",
9
- "keywords": [
10
- "querystring",
11
- "qs"
12
- ],
13
- "license": "BSD-3-Clause",
14
- "ignore": [
15
- "**/.*",
16
- "node_modules",
17
- "bower_components",
18
- "test",
19
- "tests"
20
- ]
21
- }
package/component.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "name": "qs",
3
- "repository": "ljharb/qs",
4
- "description": "query-string parser / stringifier with nesting support",
5
- "version": "6.5.3",
6
- "keywords": ["querystring", "query", "parser"],
7
- "main": "lib/index.js",
8
- "scripts": [
9
- "lib/index.js",
10
- "lib/parse.js",
11
- "lib/stringify.js",
12
- "lib/utils.js"
13
- ],
14
- "license": "BSD-3-Clause"
15
- }