@basemaps/lambda-tiler 6.39.0 → 6.41.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.
Files changed (140) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/build/__tests__/config.data.d.ts.map +1 -1
  3. package/build/__tests__/config.data.js +142 -1
  4. package/build/__tests__/config.data.js.map +1 -1
  5. package/build/__tests__/wmts.capability.test.js +105 -79
  6. package/build/__tests__/wmts.capability.test.js.map +1 -1
  7. package/build/__tests__/xyz.util.d.ts.map +1 -1
  8. package/build/__tests__/xyz.util.js +6 -2
  9. package/build/__tests__/xyz.util.js.map +1 -1
  10. package/build/cli/render.tile.d.ts +2 -0
  11. package/build/cli/render.tile.d.ts.map +1 -0
  12. package/build/cli/render.tile.js +36 -0
  13. package/build/cli/render.tile.js.map +1 -0
  14. package/build/routes/__tests__/attribution.test.js +62 -2
  15. package/build/routes/__tests__/attribution.test.js.map +1 -1
  16. package/build/routes/__tests__/wmts.test.js +50 -8
  17. package/build/routes/__tests__/wmts.test.js.map +1 -1
  18. package/build/routes/attribution.d.ts +11 -0
  19. package/build/routes/attribution.d.ts.map +1 -1
  20. package/build/routes/attribution.js +32 -28
  21. package/build/routes/attribution.js.map +1 -1
  22. package/build/routes/tile.json.d.ts.map +1 -1
  23. package/build/routes/tile.json.js +2 -1
  24. package/build/routes/tile.json.js.map +1 -1
  25. package/build/routes/tile.style.json.d.ts.map +1 -1
  26. package/build/routes/tile.style.json.js +2 -1
  27. package/build/routes/tile.style.json.js.map +1 -1
  28. package/build/routes/tile.wmts.d.ts.map +1 -1
  29. package/build/routes/tile.wmts.js +12 -7
  30. package/build/routes/tile.wmts.js.map +1 -1
  31. package/build/routes/tile.xyz.raster.d.ts.map +1 -1
  32. package/build/routes/tile.xyz.raster.js +5 -1
  33. package/build/routes/tile.xyz.raster.js.map +1 -1
  34. package/build/util/__test__/filter.test.d.ts +2 -0
  35. package/build/util/__test__/filter.test.d.ts.map +1 -0
  36. package/build/util/__test__/filter.test.js +64 -0
  37. package/build/util/__test__/filter.test.js.map +1 -0
  38. package/build/util/config.loader.d.ts.map +1 -1
  39. package/build/util/config.loader.js +2 -3
  40. package/build/util/config.loader.js.map +1 -1
  41. package/build/util/filter.d.ts +15 -0
  42. package/build/util/filter.d.ts.map +1 -0
  43. package/build/util/filter.js +59 -0
  44. package/build/util/filter.js.map +1 -0
  45. package/build/util/validate.d.ts.map +1 -1
  46. package/build/util/validate.js +4 -3
  47. package/build/util/validate.js.map +1 -1
  48. package/build/wmts.capability.d.ts +61 -28
  49. package/build/wmts.capability.d.ts.map +1 -1
  50. package/build/wmts.capability.js +175 -99
  51. package/build/wmts.capability.js.map +1 -1
  52. package/dist/index.js +110 -82
  53. package/dist/node_modules/.package-lock.json +17 -17
  54. package/dist/node_modules/detect-libc/README.md +4 -1
  55. package/dist/node_modules/detect-libc/index.d.ts +3 -0
  56. package/dist/node_modules/detect-libc/lib/detect-libc.js +105 -4
  57. package/dist/node_modules/detect-libc/lib/filesystem.js +41 -0
  58. package/dist/node_modules/detect-libc/lib/process.js +3 -0
  59. package/dist/node_modules/detect-libc/package.json +7 -3
  60. package/dist/node_modules/minimist/.eslintrc +25 -50
  61. package/dist/node_modules/minimist/CHANGELOG.md +87 -1
  62. package/dist/node_modules/minimist/README.md +14 -10
  63. package/dist/node_modules/minimist/example/parse.js +2 -0
  64. package/dist/node_modules/minimist/index.js +256 -242
  65. package/dist/node_modules/minimist/package.json +73 -73
  66. package/dist/node_modules/minimist/test/all_bool.js +26 -24
  67. package/dist/node_modules/minimist/test/bool.js +146 -147
  68. package/dist/node_modules/minimist/test/dash.js +33 -21
  69. package/dist/node_modules/minimist/test/default_bool.js +26 -24
  70. package/dist/node_modules/minimist/test/dotted.js +13 -11
  71. package/dist/node_modules/minimist/test/kv_short.js +26 -10
  72. package/dist/node_modules/minimist/test/long.js +28 -26
  73. package/dist/node_modules/minimist/test/num.js +30 -28
  74. package/dist/node_modules/minimist/test/parse.js +169 -157
  75. package/dist/node_modules/minimist/test/parse_modified.js +7 -5
  76. package/dist/node_modules/minimist/test/proto.js +41 -37
  77. package/dist/node_modules/minimist/test/short.js +57 -55
  78. package/dist/node_modules/minimist/test/stop_early.js +10 -8
  79. package/dist/node_modules/minimist/test/unknown.js +83 -81
  80. package/dist/node_modules/minimist/test/whitespace.js +6 -4
  81. package/dist/node_modules/node-abi/.circleci/config.yml +2 -2
  82. package/dist/node_modules/node-abi/.github/CODEOWNERS +1 -0
  83. package/dist/node_modules/node-abi/.github/workflows/semantic.yml +26 -0
  84. package/dist/node_modules/node-abi/.github/workflows/update-abi.yml +5 -4
  85. package/dist/node_modules/node-abi/README.md +5 -3
  86. package/dist/node_modules/node-abi/abi_registry.json +32 -1
  87. package/dist/node_modules/node-abi/package.json +4 -4
  88. package/dist/node_modules/node-abi/scripts/update-abi-registry.js +2 -2
  89. package/dist/node_modules/readable-stream/README.md +1 -1
  90. package/dist/node_modules/readable-stream/lib/_stream_duplex.js +12 -25
  91. package/dist/node_modules/readable-stream/lib/_stream_passthrough.js +2 -4
  92. package/dist/node_modules/readable-stream/lib/_stream_readable.js +176 -273
  93. package/dist/node_modules/readable-stream/lib/_stream_transform.js +26 -37
  94. package/dist/node_modules/readable-stream/lib/_stream_writable.js +118 -174
  95. package/dist/node_modules/readable-stream/lib/internal/streams/async_iterator.js +10 -37
  96. package/dist/node_modules/readable-stream/lib/internal/streams/buffer_list.js +20 -47
  97. package/dist/node_modules/readable-stream/lib/internal/streams/destroy.js +8 -17
  98. package/dist/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +1 -19
  99. package/dist/node_modules/readable-stream/lib/internal/streams/from.js +12 -24
  100. package/dist/node_modules/readable-stream/lib/internal/streams/pipeline.js +5 -16
  101. package/dist/node_modules/readable-stream/lib/internal/streams/state.js +2 -7
  102. package/dist/node_modules/readable-stream/package.json +1 -1
  103. package/dist/node_modules/semver/README.md +70 -1
  104. package/dist/node_modules/semver/bin/semver.js +16 -2
  105. package/dist/node_modules/semver/classes/comparator.js +39 -34
  106. package/dist/node_modules/semver/classes/range.js +45 -28
  107. package/dist/node_modules/semver/classes/semver.js +32 -17
  108. package/dist/node_modules/semver/functions/coerce.js +1 -1
  109. package/dist/node_modules/semver/functions/diff.js +58 -16
  110. package/dist/node_modules/semver/functions/inc.js +3 -2
  111. package/dist/node_modules/semver/functions/parse.js +5 -22
  112. package/dist/node_modules/semver/index.js +1 -0
  113. package/dist/node_modules/semver/internal/constants.js +20 -2
  114. package/dist/node_modules/semver/internal/parse-options.js +14 -10
  115. package/dist/node_modules/semver/internal/re.js +34 -4
  116. package/dist/node_modules/semver/package.json +8 -7
  117. package/dist/node_modules/semver/ranges/intersects.js +1 -1
  118. package/dist/node_modules/semver/ranges/subset.js +6 -3
  119. package/dist/package-lock.json +18 -349
  120. package/dist/package.json +1 -2
  121. package/package.json +9 -10
  122. package/src/__tests__/config.data.ts +142 -1
  123. package/src/__tests__/wmts.capability.test.ts +117 -79
  124. package/src/__tests__/xyz.util.ts +6 -2
  125. package/src/cli/render.tile.ts +41 -0
  126. package/src/routes/__tests__/attribution.test.ts +64 -2
  127. package/src/routes/__tests__/wmts.test.ts +70 -9
  128. package/src/routes/attribution.ts +28 -28
  129. package/src/routes/tile.json.ts +2 -1
  130. package/src/routes/tile.style.json.ts +2 -1
  131. package/src/routes/tile.wmts.ts +13 -6
  132. package/src/routes/tile.xyz.raster.ts +4 -1
  133. package/src/util/__test__/filter.test.ts +80 -0
  134. package/src/util/config.loader.ts +1 -2
  135. package/src/util/filter.ts +60 -0
  136. package/src/util/validate.ts +4 -3
  137. package/src/wmts.capability.ts +216 -123
  138. package/tsconfig.tsbuildinfo +1 -1
  139. package/test-dump.js +0 -6
  140. package/test-imagery.js +0 -3
@@ -1,36 +1,38 @@
1
+ 'use strict';
2
+
1
3
  var parse = require('../');
2
4
  var test = require('tape');
3
5
 
4
6
  test('nums', function (t) {
5
- var argv = parse([
6
- '-x', '1234',
7
- '-y', '5.67',
8
- '-z', '1e7',
9
- '-w', '10f',
10
- '--hex', '0xdeadbeef',
11
- '789'
12
- ]);
13
- t.deepEqual(argv, {
14
- x : 1234,
15
- y : 5.67,
16
- z : 1e7,
17
- w : '10f',
18
- hex : 0xdeadbeef,
19
- _ : [ 789 ]
20
- });
21
- t.deepEqual(typeof argv.x, 'number');
22
- t.deepEqual(typeof argv.y, 'number');
23
- t.deepEqual(typeof argv.z, 'number');
24
- t.deepEqual(typeof argv.w, 'string');
25
- t.deepEqual(typeof argv.hex, 'number');
26
- t.deepEqual(typeof argv._[0], 'number');
27
- t.end();
7
+ var argv = parse([
8
+ '-x', '1234',
9
+ '-y', '5.67',
10
+ '-z', '1e7',
11
+ '-w', '10f',
12
+ '--hex', '0xdeadbeef',
13
+ '789',
14
+ ]);
15
+ t.deepEqual(argv, {
16
+ x: 1234,
17
+ y: 5.67,
18
+ z: 1e7,
19
+ w: '10f',
20
+ hex: 0xdeadbeef,
21
+ _: [789],
22
+ });
23
+ t.deepEqual(typeof argv.x, 'number');
24
+ t.deepEqual(typeof argv.y, 'number');
25
+ t.deepEqual(typeof argv.z, 'number');
26
+ t.deepEqual(typeof argv.w, 'string');
27
+ t.deepEqual(typeof argv.hex, 'number');
28
+ t.deepEqual(typeof argv._[0], 'number');
29
+ t.end();
28
30
  });
29
31
 
30
32
  test('already a number', function (t) {
31
- var argv = parse([ '-x', 1234, 789 ]);
32
- t.deepEqual(argv, { x : 1234, _ : [ 789 ] });
33
- t.deepEqual(typeof argv.x, 'number');
34
- t.deepEqual(typeof argv._[0], 'number');
35
- t.end();
33
+ var argv = parse(['-x', 1234, 789]);
34
+ t.deepEqual(argv, { x: 1234, _: [789] });
35
+ t.deepEqual(typeof argv.x, 'number');
36
+ t.deepEqual(typeof argv._[0], 'number');
37
+ t.end();
36
38
  });
@@ -1,197 +1,209 @@
1
+ 'use strict';
2
+
1
3
  var parse = require('../');
2
4
  var test = require('tape');
3
5
 
4
6
  test('parse args', function (t) {
5
- t.deepEqual(
6
- parse([ '--no-moo' ]),
7
- { moo : false, _ : [] },
8
- 'no'
9
- );
10
- t.deepEqual(
11
- parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
12
- { v : ['a','b','c'], _ : [] },
13
- 'multi'
14
- );
15
- t.end();
7
+ t.deepEqual(
8
+ parse(['--no-moo']),
9
+ { moo: false, _: [] },
10
+ 'no'
11
+ );
12
+ t.deepEqual(
13
+ parse(['-v', 'a', '-v', 'b', '-v', 'c']),
14
+ { v: ['a', 'b', 'c'], _: [] },
15
+ 'multi'
16
+ );
17
+ t.end();
16
18
  });
17
-
19
+
18
20
  test('comprehensive', function (t) {
19
- t.deepEqual(
20
- parse([
21
- '--name=meowmers', 'bare', '-cats', 'woo',
22
- '-h', 'awesome', '--multi=quux',
23
- '--key', 'value',
24
- '-b', '--bool', '--no-meep', '--multi=baz',
25
- '--', '--not-a-flag', 'eek'
26
- ]),
27
- {
28
- c : true,
29
- a : true,
30
- t : true,
31
- s : 'woo',
32
- h : 'awesome',
33
- b : true,
34
- bool : true,
35
- key : 'value',
36
- multi : [ 'quux', 'baz' ],
37
- meep : false,
38
- name : 'meowmers',
39
- _ : [ 'bare', '--not-a-flag', 'eek' ]
40
- }
41
- );
42
- t.end();
21
+ t.deepEqual(
22
+ parse([
23
+ '--name=meowmers', 'bare', '-cats', 'woo',
24
+ '-h', 'awesome', '--multi=quux',
25
+ '--key', 'value',
26
+ '-b', '--bool', '--no-meep', '--multi=baz',
27
+ '--', '--not-a-flag', 'eek',
28
+ ]),
29
+ {
30
+ c: true,
31
+ a: true,
32
+ t: true,
33
+ s: 'woo',
34
+ h: 'awesome',
35
+ b: true,
36
+ bool: true,
37
+ key: 'value',
38
+ multi: ['quux', 'baz'],
39
+ meep: false,
40
+ name: 'meowmers',
41
+ _: ['bare', '--not-a-flag', 'eek'],
42
+ }
43
+ );
44
+ t.end();
43
45
  });
44
46
 
45
47
  test('flag boolean', function (t) {
46
- var argv = parse([ '-t', 'moo' ], { boolean: 't' });
47
- t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
48
- t.deepEqual(typeof argv.t, 'boolean');
49
- t.end();
48
+ var argv = parse(['-t', 'moo'], { boolean: 't' });
49
+ t.deepEqual(argv, { t: true, _: ['moo'] });
50
+ t.deepEqual(typeof argv.t, 'boolean');
51
+ t.end();
50
52
  });
51
53
 
52
54
  test('flag boolean value', function (t) {
53
- var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
54
- boolean: [ 't', 'verbose' ],
55
- default: { verbose: true }
56
- });
57
-
58
- t.deepEqual(argv, {
59
- verbose: false,
60
- t: true,
61
- _: ['moo']
62
- });
63
-
64
- t.deepEqual(typeof argv.verbose, 'boolean');
65
- t.deepEqual(typeof argv.t, 'boolean');
66
- t.end();
55
+ var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
56
+ boolean: ['t', 'verbose'],
57
+ default: { verbose: true },
58
+ });
59
+
60
+ t.deepEqual(argv, {
61
+ verbose: false,
62
+ t: true,
63
+ _: ['moo'],
64
+ });
65
+
66
+ t.deepEqual(typeof argv.verbose, 'boolean');
67
+ t.deepEqual(typeof argv.t, 'boolean');
68
+ t.end();
67
69
  });
68
70
 
69
- test('newlines in params' , function (t) {
70
- var args = parse([ '-s', "X\nX" ])
71
- t.deepEqual(args, { _ : [], s : "X\nX" });
72
-
73
- // reproduce in bash:
74
- // VALUE="new
75
- // line"
76
- // node program.js --s="$VALUE"
77
- args = parse([ "--s=X\nX" ])
78
- t.deepEqual(args, { _ : [], s : "X\nX" });
79
- t.end();
71
+ test('newlines in params', function (t) {
72
+ var args = parse(['-s', 'X\nX']);
73
+ t.deepEqual(args, { _: [], s: 'X\nX' });
74
+
75
+ // reproduce in bash:
76
+ // VALUE="new
77
+ // line"
78
+ // node program.js --s="$VALUE"
79
+ args = parse(['--s=X\nX']);
80
+ t.deepEqual(args, { _: [], s: 'X\nX' });
81
+ t.end();
80
82
  });
81
83
 
82
- test('strings' , function (t) {
83
- var s = parse([ '-s', '0001234' ], { string: 's' }).s;
84
- t.equal(s, '0001234');
85
- t.equal(typeof s, 'string');
86
-
87
- var x = parse([ '-x', '56' ], { string: 'x' }).x;
88
- t.equal(x, '56');
89
- t.equal(typeof x, 'string');
90
- t.end();
84
+ test('strings', function (t) {
85
+ var s = parse(['-s', '0001234'], { string: 's' }).s;
86
+ t.equal(s, '0001234');
87
+ t.equal(typeof s, 'string');
88
+
89
+ var x = parse(['-x', '56'], { string: 'x' }).x;
90
+ t.equal(x, '56');
91
+ t.equal(typeof x, 'string');
92
+ t.end();
91
93
  });
92
94
 
93
95
  test('stringArgs', function (t) {
94
- var s = parse([ ' ', ' ' ], { string: '_' })._;
95
- t.same(s.length, 2);
96
- t.same(typeof s[0], 'string');
97
- t.same(s[0], ' ');
98
- t.same(typeof s[1], 'string');
99
- t.same(s[1], ' ');
100
- t.end();
96
+ var s = parse([' ', ' '], { string: '_' })._;
97
+ t.same(s.length, 2);
98
+ t.same(typeof s[0], 'string');
99
+ t.same(s[0], ' ');
100
+ t.same(typeof s[1], 'string');
101
+ t.same(s[1], ' ');
102
+ t.end();
101
103
  });
102
104
 
103
- test('empty strings', function(t) {
104
- var s = parse([ '-s' ], { string: 's' }).s;
105
- t.equal(s, '');
106
- t.equal(typeof s, 'string');
105
+ test('empty strings', function (t) {
106
+ var s = parse(['-s'], { string: 's' }).s;
107
+ t.equal(s, '');
108
+ t.equal(typeof s, 'string');
107
109
 
108
- var str = parse([ '--str' ], { string: 'str' }).str;
109
- t.equal(str, '');
110
- t.equal(typeof str, 'string');
110
+ var str = parse(['--str'], { string: 'str' }).str;
111
+ t.equal(str, '');
112
+ t.equal(typeof str, 'string');
111
113
 
112
- var letters = parse([ '-art' ], {
113
- string: [ 'a', 't' ]
114
- });
114
+ var letters = parse(['-art'], {
115
+ string: ['a', 't'],
116
+ });
115
117
 
116
- t.equal(letters.a, '');
117
- t.equal(letters.r, true);
118
- t.equal(letters.t, '');
118
+ t.equal(letters.a, '');
119
+ t.equal(letters.r, true);
120
+ t.equal(letters.t, '');
119
121
 
120
- t.end();
122
+ t.end();
121
123
  });
122
124
 
123
-
124
- test('string and alias', function(t) {
125
- var x = parse([ '--str', '000123' ], {
126
- string: 's',
127
- alias: { s: 'str' }
128
- });
129
-
130
- t.equal(x.str, '000123');
131
- t.equal(typeof x.str, 'string');
132
- t.equal(x.s, '000123');
133
- t.equal(typeof x.s, 'string');
134
-
135
- var y = parse([ '-s', '000123' ], {
136
- string: 'str',
137
- alias: { str: 's' }
138
- });
139
-
140
- t.equal(y.str, '000123');
141
- t.equal(typeof y.str, 'string');
142
- t.equal(y.s, '000123');
143
- t.equal(typeof y.s, 'string');
144
- t.end();
125
+ test('string and alias', function (t) {
126
+ var x = parse(['--str', '000123'], {
127
+ string: 's',
128
+ alias: { s: 'str' },
129
+ });
130
+
131
+ t.equal(x.str, '000123');
132
+ t.equal(typeof x.str, 'string');
133
+ t.equal(x.s, '000123');
134
+ t.equal(typeof x.s, 'string');
135
+
136
+ var y = parse(['-s', '000123'], {
137
+ string: 'str',
138
+ alias: { str: 's' },
139
+ });
140
+
141
+ t.equal(y.str, '000123');
142
+ t.equal(typeof y.str, 'string');
143
+ t.equal(y.s, '000123');
144
+ t.equal(typeof y.s, 'string');
145
+
146
+ var z = parse(['-s123'], {
147
+ alias: { str: ['s', 'S'] },
148
+ string: ['str'],
149
+ });
150
+
151
+ t.deepEqual(
152
+ z,
153
+ { _: [], s: '123', S: '123', str: '123' },
154
+ 'opt.string works with multiple aliases'
155
+ );
156
+ t.end();
145
157
  });
146
158
 
147
159
  test('slashBreak', function (t) {
148
- t.same(
149
- parse([ '-I/foo/bar/baz' ]),
150
- { I : '/foo/bar/baz', _ : [] }
151
- );
152
- t.same(
153
- parse([ '-xyz/foo/bar/baz' ]),
154
- { x : true, y : true, z : '/foo/bar/baz', _ : [] }
155
- );
156
- t.end();
160
+ t.same(
161
+ parse(['-I/foo/bar/baz']),
162
+ { I: '/foo/bar/baz', _: [] }
163
+ );
164
+ t.same(
165
+ parse(['-xyz/foo/bar/baz']),
166
+ { x: true, y: true, z: '/foo/bar/baz', _: [] }
167
+ );
168
+ t.end();
157
169
  });
158
170
 
159
171
  test('alias', function (t) {
160
- var argv = parse([ '-f', '11', '--zoom', '55' ], {
161
- alias: { z: 'zoom' }
162
- });
163
- t.equal(argv.zoom, 55);
164
- t.equal(argv.z, argv.zoom);
165
- t.equal(argv.f, 11);
166
- t.end();
172
+ var argv = parse(['-f', '11', '--zoom', '55'], {
173
+ alias: { z: 'zoom' },
174
+ });
175
+ t.equal(argv.zoom, 55);
176
+ t.equal(argv.z, argv.zoom);
177
+ t.equal(argv.f, 11);
178
+ t.end();
167
179
  });
168
180
 
169
181
  test('multiAlias', function (t) {
170
- var argv = parse([ '-f', '11', '--zoom', '55' ], {
171
- alias: { z: [ 'zm', 'zoom' ] }
172
- });
173
- t.equal(argv.zoom, 55);
174
- t.equal(argv.z, argv.zoom);
175
- t.equal(argv.z, argv.zm);
176
- t.equal(argv.f, 11);
177
- t.end();
182
+ var argv = parse(['-f', '11', '--zoom', '55'], {
183
+ alias: { z: ['zm', 'zoom'] },
184
+ });
185
+ t.equal(argv.zoom, 55);
186
+ t.equal(argv.z, argv.zoom);
187
+ t.equal(argv.z, argv.zm);
188
+ t.equal(argv.f, 11);
189
+ t.end();
178
190
  });
179
191
 
180
192
  test('nested dotted objects', function (t) {
181
- var argv = parse([
182
- '--foo.bar', '3', '--foo.baz', '4',
183
- '--foo.quux.quibble', '5', '--foo.quux.o_O',
184
- '--beep.boop'
185
- ]);
186
-
187
- t.same(argv.foo, {
188
- bar : 3,
189
- baz : 4,
190
- quux : {
191
- quibble : 5,
192
- o_O : true
193
- }
194
- });
195
- t.same(argv.beep, { boop : true });
196
- t.end();
193
+ var argv = parse([
194
+ '--foo.bar', '3', '--foo.baz', '4',
195
+ '--foo.quux.quibble', '5', '--foo.quux.o_O',
196
+ '--beep.boop',
197
+ ]);
198
+
199
+ t.same(argv.foo, {
200
+ bar: 3,
201
+ baz: 4,
202
+ quux: {
203
+ quibble: 5,
204
+ o_O: true,
205
+ },
206
+ });
207
+ t.same(argv.beep, { boop: true });
208
+ t.end();
197
209
  });
@@ -1,9 +1,11 @@
1
+ 'use strict';
2
+
1
3
  var parse = require('../');
2
4
  var test = require('tape');
3
5
 
4
- test('parse with modifier functions' , function (t) {
5
- t.plan(1);
6
-
7
- var argv = parse([ '-b', '123' ], { boolean: 'b' });
8
- t.deepEqual(argv, { b: true, _: [123] });
6
+ test('parse with modifier functions', function (t) {
7
+ t.plan(1);
8
+
9
+ var argv = parse(['-b', '123'], { boolean: 'b' });
10
+ t.deepEqual(argv, { b: true, _: [123] });
9
11
  });
@@ -1,60 +1,64 @@
1
+ 'use strict';
2
+
3
+ /* eslint no-proto: 0 */
4
+
1
5
  var parse = require('../');
2
6
  var test = require('tape');
3
7
 
4
8
  test('proto pollution', function (t) {
5
- var argv = parse(['--__proto__.x','123']);
6
- t.equal({}.x, undefined);
7
- t.equal(argv.__proto__.x, undefined);
8
- t.equal(argv.x, undefined);
9
- t.end();
9
+ var argv = parse(['--__proto__.x', '123']);
10
+ t.equal({}.x, undefined);
11
+ t.equal(argv.__proto__.x, undefined);
12
+ t.equal(argv.x, undefined);
13
+ t.end();
10
14
  });
11
15
 
12
16
  test('proto pollution (array)', function (t) {
13
- var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']);
14
- t.equal({}.z, undefined);
15
- t.deepEqual(argv.x, [4,5]);
16
- t.equal(argv.x.z, undefined);
17
- t.equal(argv.x.__proto__.z, undefined);
18
- t.end();
17
+ var argv = parse(['--x', '4', '--x', '5', '--x.__proto__.z', '789']);
18
+ t.equal({}.z, undefined);
19
+ t.deepEqual(argv.x, [4, 5]);
20
+ t.equal(argv.x.z, undefined);
21
+ t.equal(argv.x.__proto__.z, undefined);
22
+ t.end();
19
23
  });
20
24
 
21
25
  test('proto pollution (number)', function (t) {
22
- var argv = parse(['--x','5','--x.__proto__.z','100']);
23
- t.equal({}.z, undefined);
24
- t.equal((4).z, undefined);
25
- t.equal(argv.x, 5);
26
- t.equal(argv.x.z, undefined);
27
- t.end();
26
+ var argv = parse(['--x', '5', '--x.__proto__.z', '100']);
27
+ t.equal({}.z, undefined);
28
+ t.equal((4).z, undefined);
29
+ t.equal(argv.x, 5);
30
+ t.equal(argv.x.z, undefined);
31
+ t.end();
28
32
  });
29
33
 
30
34
  test('proto pollution (string)', function (t) {
31
- var argv = parse(['--x','abc','--x.__proto__.z','def']);
32
- t.equal({}.z, undefined);
33
- t.equal('...'.z, undefined);
34
- t.equal(argv.x, 'abc');
35
- t.equal(argv.x.z, undefined);
36
- t.end();
35
+ var argv = parse(['--x', 'abc', '--x.__proto__.z', 'def']);
36
+ t.equal({}.z, undefined);
37
+ t.equal('...'.z, undefined);
38
+ t.equal(argv.x, 'abc');
39
+ t.equal(argv.x.z, undefined);
40
+ t.end();
37
41
  });
38
42
 
39
43
  test('proto pollution (constructor)', function (t) {
40
- var argv = parse(['--constructor.prototype.y','123']);
41
- t.equal({}.y, undefined);
42
- t.equal(argv.y, undefined);
43
- t.end();
44
+ var argv = parse(['--constructor.prototype.y', '123']);
45
+ t.equal({}.y, undefined);
46
+ t.equal(argv.y, undefined);
47
+ t.end();
44
48
  });
45
49
 
46
50
  test('proto pollution (constructor function)', function (t) {
47
- var argv = parse(['--_.concat.constructor.prototype.y', '123']);
48
- function fnToBeTested() {}
49
- t.equal(fnToBeTested.y, undefined);
50
- t.equal(argv.y, undefined);
51
- t.end();
51
+ var argv = parse(['--_.concat.constructor.prototype.y', '123']);
52
+ function fnToBeTested() {}
53
+ t.equal(fnToBeTested.y, undefined);
54
+ t.equal(argv.y, undefined);
55
+ t.end();
52
56
  });
53
57
 
54
58
  // powered by snyk - https://github.com/backstage/backstage/issues/10343
55
59
  test('proto pollution (constructor function) snyk', function (t) {
56
- var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' '));
57
- t.equal((function(){}).foo, undefined);
58
- t.equal(argv.y, undefined);
59
- t.end();
60
- })
60
+ var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' '));
61
+ t.equal(function () {}.foo, undefined);
62
+ t.equal(argv.y, undefined);
63
+ t.end();
64
+ });