node-red-contrib-web-worldmap 2.29.0 → 2.30.1

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 (188) hide show
  1. package/.github/FUNDING.yml +13 -0
  2. package/CHANGELOG.md +5 -2
  3. package/README.md +3 -0
  4. package/node_modules/array-flatten/package.json +6 -9
  5. package/node_modules/body-parser/HISTORY.md +18 -0
  6. package/node_modules/body-parser/README.md +9 -1
  7. package/node_modules/body-parser/SECURITY.md +25 -0
  8. package/node_modules/body-parser/lib/read.js +26 -2
  9. package/node_modules/body-parser/lib/types/json.js +10 -4
  10. package/node_modules/body-parser/package.json +24 -20
  11. package/node_modules/call-bind/.eslintignore +1 -0
  12. package/node_modules/call-bind/.eslintrc +17 -0
  13. package/node_modules/call-bind/.github/FUNDING.yml +12 -0
  14. package/node_modules/call-bind/.nycrc +13 -0
  15. package/node_modules/call-bind/CHANGELOG.md +42 -0
  16. package/node_modules/call-bind/LICENSE +21 -0
  17. package/node_modules/call-bind/README.md +2 -0
  18. package/node_modules/call-bind/callBound.js +15 -0
  19. package/node_modules/call-bind/index.js +47 -0
  20. package/node_modules/call-bind/package.json +108 -0
  21. package/node_modules/call-bind/test/callBound.js +55 -0
  22. package/node_modules/call-bind/test/index.js +66 -0
  23. package/node_modules/cookie/HISTORY.md +8 -0
  24. package/node_modules/cookie/README.md +50 -34
  25. package/node_modules/cookie/SECURITY.md +25 -0
  26. package/node_modules/cookie/index.js +83 -15
  27. package/node_modules/cookie/package.json +17 -15
  28. package/node_modules/cookie-signature/package.json +6 -9
  29. package/node_modules/depd/History.md +7 -0
  30. package/node_modules/depd/LICENSE +1 -1
  31. package/node_modules/depd/Readme.md +8 -8
  32. package/node_modules/depd/index.js +29 -13
  33. package/node_modules/depd/package.json +25 -24
  34. package/node_modules/destroy/LICENSE +1 -0
  35. package/node_modules/destroy/README.md +15 -12
  36. package/node_modules/destroy/index.js +147 -13
  37. package/node_modules/destroy/package.json +29 -20
  38. package/node_modules/ee-first/package.json +6 -9
  39. package/node_modules/encodeurl/package.json +11 -14
  40. package/node_modules/escape-html/package.json +11 -14
  41. package/node_modules/etag/package.json +11 -14
  42. package/node_modules/express/History.md +54 -0
  43. package/node_modules/express/Readme.md +39 -31
  44. package/node_modules/express/lib/application.js +18 -1
  45. package/node_modules/express/lib/response.js +40 -18
  46. package/node_modules/express/lib/router/index.js +20 -15
  47. package/node_modules/express/lib/router/route.js +9 -0
  48. package/node_modules/express/lib/utils.js +1 -0
  49. package/node_modules/express/lib/view.js +1 -1
  50. package/node_modules/express/package.json +25 -26
  51. package/node_modules/finalhandler/HISTORY.md +8 -0
  52. package/node_modules/finalhandler/LICENSE +1 -1
  53. package/node_modules/finalhandler/README.md +5 -6
  54. package/node_modules/finalhandler/SECURITY.md +25 -0
  55. package/node_modules/finalhandler/index.js +8 -3
  56. package/node_modules/finalhandler/package.json +30 -32
  57. package/node_modules/fresh/package.json +6 -9
  58. package/node_modules/function-bind/.editorconfig +20 -0
  59. package/node_modules/function-bind/.eslintrc +15 -0
  60. package/node_modules/function-bind/.jscs.json +176 -0
  61. package/node_modules/function-bind/.npmignore +22 -0
  62. package/node_modules/function-bind/.travis.yml +168 -0
  63. package/node_modules/function-bind/LICENSE +20 -0
  64. package/node_modules/function-bind/README.md +48 -0
  65. package/node_modules/function-bind/implementation.js +52 -0
  66. package/node_modules/function-bind/index.js +5 -0
  67. package/node_modules/function-bind/package.json +96 -0
  68. package/node_modules/function-bind/test/.eslintrc +9 -0
  69. package/node_modules/function-bind/test/index.js +252 -0
  70. package/node_modules/get-intrinsic/.eslintrc +37 -0
  71. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  72. package/node_modules/get-intrinsic/.nycrc +9 -0
  73. package/node_modules/get-intrinsic/CHANGELOG.md +98 -0
  74. package/node_modules/get-intrinsic/LICENSE +21 -0
  75. package/node_modules/get-intrinsic/README.md +71 -0
  76. package/node_modules/get-intrinsic/index.js +334 -0
  77. package/node_modules/get-intrinsic/package.json +120 -0
  78. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  79. package/node_modules/has/LICENSE-MIT +22 -0
  80. package/node_modules/has/README.md +18 -0
  81. package/node_modules/has/package.json +73 -0
  82. package/node_modules/has/src/index.js +5 -0
  83. package/node_modules/has/test/index.js +10 -0
  84. package/node_modules/has-symbols/.eslintrc +11 -0
  85. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  86. package/node_modules/has-symbols/.nycrc +9 -0
  87. package/node_modules/has-symbols/CHANGELOG.md +75 -0
  88. package/node_modules/has-symbols/LICENSE +21 -0
  89. package/node_modules/has-symbols/README.md +46 -0
  90. package/node_modules/has-symbols/index.js +13 -0
  91. package/node_modules/has-symbols/package.json +126 -0
  92. package/node_modules/has-symbols/shams.js +42 -0
  93. package/node_modules/has-symbols/test/index.js +22 -0
  94. package/node_modules/has-symbols/test/shams/core-js.js +28 -0
  95. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +28 -0
  96. package/node_modules/has-symbols/test/tests.js +56 -0
  97. package/node_modules/http-errors/HISTORY.md +15 -0
  98. package/node_modules/http-errors/README.md +2 -2
  99. package/node_modules/http-errors/index.js +15 -25
  100. package/node_modules/http-errors/package.json +22 -20
  101. package/node_modules/media-typer/package.json +6 -9
  102. package/node_modules/merge-descriptors/package.json +6 -9
  103. package/node_modules/methods/package.json +11 -14
  104. package/node_modules/object-inspect/.eslintrc +53 -0
  105. package/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  106. package/node_modules/object-inspect/.nycrc +13 -0
  107. package/node_modules/object-inspect/CHANGELOG.md +360 -0
  108. package/node_modules/object-inspect/LICENSE +21 -0
  109. package/node_modules/object-inspect/example/all.js +23 -0
  110. package/node_modules/object-inspect/example/circular.js +6 -0
  111. package/node_modules/object-inspect/example/fn.js +5 -0
  112. package/node_modules/object-inspect/example/inspect.js +10 -0
  113. package/node_modules/object-inspect/index.js +512 -0
  114. package/node_modules/object-inspect/package-support.json +20 -0
  115. package/node_modules/object-inspect/package.json +122 -0
  116. package/node_modules/object-inspect/readme.markdown +86 -0
  117. package/node_modules/object-inspect/test/bigint.js +58 -0
  118. package/node_modules/object-inspect/test/browser/dom.js +15 -0
  119. package/node_modules/object-inspect/test/circular.js +16 -0
  120. package/node_modules/object-inspect/test/deep.js +12 -0
  121. package/node_modules/object-inspect/test/element.js +53 -0
  122. package/node_modules/object-inspect/test/err.js +48 -0
  123. package/node_modules/object-inspect/test/fakes.js +29 -0
  124. package/node_modules/object-inspect/test/fn.js +76 -0
  125. package/node_modules/object-inspect/test/has.js +15 -0
  126. package/node_modules/object-inspect/test/holes.js +15 -0
  127. package/node_modules/object-inspect/test/indent-option.js +271 -0
  128. package/node_modules/object-inspect/test/inspect.js +139 -0
  129. package/node_modules/object-inspect/test/lowbyte.js +12 -0
  130. package/node_modules/object-inspect/test/number.js +58 -0
  131. package/node_modules/object-inspect/test/quoteStyle.js +17 -0
  132. package/node_modules/object-inspect/test/toStringTag.js +40 -0
  133. package/node_modules/object-inspect/test/undef.js +12 -0
  134. package/node_modules/object-inspect/test/values.js +211 -0
  135. package/node_modules/object-inspect/test-core-js.js +26 -0
  136. package/node_modules/object-inspect/util.inspect.js +1 -0
  137. package/node_modules/on-finished/HISTORY.md +10 -0
  138. package/node_modules/on-finished/README.md +28 -20
  139. package/node_modules/on-finished/index.js +51 -13
  140. package/node_modules/on-finished/package.json +25 -20
  141. package/node_modules/path-to-regexp/package.json +6 -9
  142. package/node_modules/qs/CHANGELOG.md +22 -5
  143. package/node_modules/qs/README.md +7 -0
  144. package/node_modules/qs/dist/qs.js +1207 -5
  145. package/node_modules/qs/lib/parse.js +6 -0
  146. package/node_modules/qs/lib/stringify.js +33 -3
  147. package/node_modules/qs/package.json +16 -13
  148. package/node_modules/qs/test/parse.js +9 -0
  149. package/node_modules/qs/test/stringify.js +62 -1
  150. package/node_modules/raw-body/HISTORY.md +14 -0
  151. package/node_modules/raw-body/LICENSE +1 -1
  152. package/node_modules/raw-body/README.md +4 -0
  153. package/node_modules/raw-body/SECURITY.md +24 -0
  154. package/node_modules/raw-body/index.js +45 -2
  155. package/node_modules/raw-body/package.json +16 -15
  156. package/node_modules/send/HISTORY.md +15 -0
  157. package/node_modules/send/LICENSE +1 -1
  158. package/node_modules/send/README.md +2 -2
  159. package/node_modules/send/SECURITY.md +24 -0
  160. package/node_modules/send/index.js +37 -27
  161. package/node_modules/send/package.json +22 -21
  162. package/node_modules/serve-static/HISTORY.md +12 -0
  163. package/node_modules/serve-static/README.md +1 -1
  164. package/node_modules/serve-static/package.json +16 -16
  165. package/node_modules/side-channel/.eslintignore +1 -0
  166. package/node_modules/side-channel/.eslintrc +11 -0
  167. package/node_modules/side-channel/.github/FUNDING.yml +12 -0
  168. package/node_modules/side-channel/.nycrc +13 -0
  169. package/node_modules/side-channel/CHANGELOG.md +65 -0
  170. package/node_modules/side-channel/LICENSE +21 -0
  171. package/node_modules/side-channel/README.md +2 -0
  172. package/node_modules/side-channel/index.js +124 -0
  173. package/node_modules/side-channel/package.json +95 -0
  174. package/node_modules/side-channel/test/index.js +78 -0
  175. package/node_modules/statuses/HISTORY.md +17 -0
  176. package/node_modules/statuses/README.md +51 -42
  177. package/node_modules/statuses/codes.json +2 -3
  178. package/node_modules/statuses/index.js +52 -19
  179. package/node_modules/statuses/package.json +29 -31
  180. package/node_modules/unpipe/package.json +7 -9
  181. package/node_modules/utils-merge/package.json +6 -9
  182. package/package.json +2 -2
  183. package/worldmap/worldmap.js +22 -7
  184. package/worldmap.html +16 -0
  185. package/worldmap.js +553 -551
  186. package/node_modules/depd/lib/compat/callsite-tostring.js +0 -103
  187. package/node_modules/depd/lib/compat/event-listener-count.js +0 -22
  188. package/node_modules/depd/lib/compat/index.js +0 -79
@@ -0,0 +1,211 @@
1
+ 'use strict';
2
+
3
+ var inspect = require('../');
4
+ var test = require('tape');
5
+ var mockProperty = require('mock-property');
6
+ var hasSymbols = require('has-symbols/shams')();
7
+ var hasToStringTag = require('has-tostringtag/shams')();
8
+
9
+ test('values', function (t) {
10
+ t.plan(1);
11
+ var obj = [{}, [], { 'a-b': 5 }];
12
+ t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]');
13
+ });
14
+
15
+ test('arrays with properties', function (t) {
16
+ t.plan(1);
17
+ var arr = [3];
18
+ arr.foo = 'bar';
19
+ var obj = [1, 2, arr];
20
+ obj.baz = 'quux';
21
+ obj.index = -1;
22
+ t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]');
23
+ });
24
+
25
+ test('has', function (t) {
26
+ t.plan(1);
27
+ t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true }));
28
+
29
+ t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }');
30
+ });
31
+
32
+ test('indexOf seen', function (t) {
33
+ t.plan(1);
34
+ var xs = [1, 2, 3, {}];
35
+ xs.push(xs);
36
+
37
+ var seen = [];
38
+ seen.indexOf = undefined;
39
+
40
+ t.equal(
41
+ inspect(xs, {}, 0, seen),
42
+ '[ 1, 2, 3, {}, [Circular] ]'
43
+ );
44
+ });
45
+
46
+ test('seen seen', function (t) {
47
+ t.plan(1);
48
+ var xs = [1, 2, 3];
49
+
50
+ var seen = [xs];
51
+ seen.indexOf = undefined;
52
+
53
+ t.equal(
54
+ inspect(xs, {}, 0, seen),
55
+ '[Circular]'
56
+ );
57
+ });
58
+
59
+ test('seen seen seen', function (t) {
60
+ t.plan(1);
61
+ var xs = [1, 2, 3];
62
+
63
+ var seen = [5, xs];
64
+ seen.indexOf = undefined;
65
+
66
+ t.equal(
67
+ inspect(xs, {}, 0, seen),
68
+ '[Circular]'
69
+ );
70
+ });
71
+
72
+ test('symbols', { skip: !hasSymbols }, function (t) {
73
+ var sym = Symbol('foo');
74
+ t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"');
75
+ if (typeof sym === 'symbol') {
76
+ // Symbol shams are incapable of differentiating boxed from unboxed symbols
77
+ t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
78
+ }
79
+
80
+ t.test('toStringTag', { skip: !hasToStringTag }, function (st) {
81
+ st.plan(1);
82
+
83
+ var faker = {};
84
+ faker[Symbol.toStringTag] = 'Symbol';
85
+ st.equal(
86
+ inspect(faker),
87
+ '{ [Symbol(Symbol.toStringTag)]: \'Symbol\' }',
88
+ 'object lying about being a Symbol inspects as an object'
89
+ );
90
+ });
91
+
92
+ t.end();
93
+ });
94
+
95
+ test('Map', { skip: typeof Map !== 'function' }, function (t) {
96
+ var map = new Map();
97
+ map.set({ a: 1 }, ['b']);
98
+ map.set(3, NaN);
99
+ var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}';
100
+ t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents');
101
+ t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty');
102
+
103
+ var nestedMap = new Map();
104
+ nestedMap.set(nestedMap, map);
105
+ t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work');
106
+
107
+ t.end();
108
+ });
109
+
110
+ test('WeakMap', { skip: typeof WeakMap !== 'function' }, function (t) {
111
+ var map = new WeakMap();
112
+ map.set({ a: 1 }, ['b']);
113
+ var expectedString = 'WeakMap { ? }';
114
+ t.equal(inspect(map), expectedString, 'new WeakMap([[{ a: 1 }, ["b"]]]) should not show size or contents');
115
+ t.equal(inspect(new WeakMap()), 'WeakMap { ? }', 'empty WeakMap should not show as empty');
116
+
117
+ t.end();
118
+ });
119
+
120
+ test('Set', { skip: typeof Set !== 'function' }, function (t) {
121
+ var set = new Set();
122
+ set.add({ a: 1 });
123
+ set.add(['b']);
124
+ var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}';
125
+ t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents');
126
+ t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty');
127
+
128
+ var nestedSet = new Set();
129
+ nestedSet.add(set);
130
+ nestedSet.add(nestedSet);
131
+ t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work');
132
+
133
+ t.end();
134
+ });
135
+
136
+ test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) {
137
+ var map = new WeakSet();
138
+ map.add({ a: 1 });
139
+ var expectedString = 'WeakSet { ? }';
140
+ t.equal(inspect(map), expectedString, 'new WeakSet([{ a: 1 }]) should not show size or contents');
141
+ t.equal(inspect(new WeakSet()), 'WeakSet { ? }', 'empty WeakSet should not show as empty');
142
+
143
+ t.end();
144
+ });
145
+
146
+ test('WeakRef', { skip: typeof WeakRef !== 'function' }, function (t) {
147
+ var ref = new WeakRef({ a: 1 });
148
+ var expectedString = 'WeakRef { ? }';
149
+ t.equal(inspect(ref), expectedString, 'new WeakRef({ a: 1 }) should not show contents');
150
+
151
+ t.end();
152
+ });
153
+
154
+ test('FinalizationRegistry', { skip: typeof FinalizationRegistry !== 'function' }, function (t) {
155
+ var registry = new FinalizationRegistry(function () {});
156
+ var expectedString = 'FinalizationRegistry [FinalizationRegistry] {}';
157
+ t.equal(inspect(registry), expectedString, 'new FinalizationRegistry(function () {}) should work normallys');
158
+
159
+ t.end();
160
+ });
161
+
162
+ test('Strings', function (t) {
163
+ var str = 'abc';
164
+
165
+ t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such');
166
+ t.equal(inspect(str, { quoteStyle: 'single' }), "'" + str + "'", 'primitive string shows as such, single quoted');
167
+ t.equal(inspect(str, { quoteStyle: 'double' }), '"' + str + '"', 'primitive string shows as such, double quoted');
168
+ t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such');
169
+ t.equal(inspect(Object(str), { quoteStyle: 'single' }), 'Object(' + inspect(str, { quoteStyle: 'single' }) + ')', 'String object shows as such, single quoted');
170
+ t.equal(inspect(Object(str), { quoteStyle: 'double' }), 'Object(' + inspect(str, { quoteStyle: 'double' }) + ')', 'String object shows as such, double quoted');
171
+
172
+ t.end();
173
+ });
174
+
175
+ test('Numbers', function (t) {
176
+ var num = 42;
177
+
178
+ t.equal(inspect(num), String(num), 'primitive number shows as such');
179
+ t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such');
180
+
181
+ t.end();
182
+ });
183
+
184
+ test('Booleans', function (t) {
185
+ t.equal(inspect(true), String(true), 'primitive true shows as such');
186
+ t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such');
187
+
188
+ t.equal(inspect(false), String(false), 'primitive false shows as such');
189
+ t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such');
190
+
191
+ t.end();
192
+ });
193
+
194
+ test('Date', function (t) {
195
+ var now = new Date();
196
+ t.equal(inspect(now), String(now), 'Date shows properly');
197
+ t.equal(inspect(new Date(NaN)), 'Invalid Date', 'Invalid Date shows properly');
198
+
199
+ t.end();
200
+ });
201
+
202
+ test('RegExps', function (t) {
203
+ t.equal(inspect(/a/g), '/a/g', 'regex shows properly');
204
+ t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly');
205
+
206
+ var match = 'abc abc'.match(/[ab]+/);
207
+ delete match.groups; // for node < 10
208
+ t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\' ]', 'RegExp match object shows properly');
209
+
210
+ t.end();
211
+ });
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ require('core-js');
4
+
5
+ var inspect = require('./');
6
+ var test = require('tape');
7
+
8
+ test('Maps', function (t) {
9
+ t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}');
10
+ t.end();
11
+ });
12
+
13
+ test('WeakMaps', function (t) {
14
+ t.equal(inspect(new WeakMap([[{}, 2]])), 'WeakMap { ? }');
15
+ t.end();
16
+ });
17
+
18
+ test('Sets', function (t) {
19
+ t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}');
20
+ t.end();
21
+ });
22
+
23
+ test('WeakSets', function (t) {
24
+ t.equal(inspect(new WeakSet([[1, 2]])), 'WeakSet { ? }');
25
+ t.end();
26
+ });
@@ -0,0 +1 @@
1
+ module.exports = require('util').inspect;
@@ -1,3 +1,13 @@
1
+ 2.4.1 / 2022-02-22
2
+ ==================
3
+
4
+ * Fix error on early async hooks implementations
5
+
6
+ 2.4.0 / 2022-02-21
7
+ ==================
8
+
9
+ * Prevent loss of async hooks context
10
+
1
11
  2.3.0 / 2015-05-26
2
12
  ==================
3
13
 
@@ -1,15 +1,19 @@
1
1
  # on-finished
2
2
 
3
- [![NPM Version][npm-image]][npm-url]
4
- [![NPM Downloads][downloads-image]][downloads-url]
5
- [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build Status][travis-image]][travis-url]
7
- [![Test Coverage][coveralls-image]][coveralls-url]
3
+ [![NPM Version][npm-version-image]][npm-url]
4
+ [![NPM Downloads][npm-downloads-image]][npm-url]
5
+ [![Node.js Version][node-image]][node-url]
6
+ [![Build Status][ci-image]][ci-url]
7
+ [![Coverage Status][coveralls-image]][coveralls-url]
8
8
 
9
9
  Execute a callback when a HTTP request closes, finishes, or errors.
10
10
 
11
11
  ## Install
12
12
 
13
+ This is a [Node.js](https://nodejs.org/en/) module available through the
14
+ [npm registry](https://www.npmjs.com/). Installation is done using the
15
+ [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
16
+
13
17
  ```sh
14
18
  $ npm install on-finished
15
19
  ```
@@ -32,10 +36,12 @@ with the response, like open files.
32
36
 
33
37
  Listener is invoked as `listener(err, res)`.
34
38
 
39
+ <!-- eslint-disable handle-callback-err -->
40
+
35
41
  ```js
36
42
  onFinished(res, function (err, res) {
37
43
  // clean up open fds, etc.
38
- // err contains the error is request error'd
44
+ // err contains the error if request error'd
39
45
  })
40
46
  ```
41
47
 
@@ -51,11 +57,13 @@ after reading the data.
51
57
 
52
58
  Listener is invoked as `listener(err, req)`.
53
59
 
60
+ <!-- eslint-disable handle-callback-err -->
61
+
54
62
  ```js
55
63
  var data = ''
56
64
 
57
65
  req.setEncoding('utf8')
58
- res.on('data', function (str) {
66
+ req.on('data', function (str) {
59
67
  data += str
60
68
  })
61
69
 
@@ -97,7 +105,7 @@ interface**. This means if the `CONNECT` request contains a request entity,
97
105
  the request will be considered "finished" even before it has been read.
98
106
 
99
107
  There is no such thing as a response object to a `CONNECT` request in
100
- Node.js, so there is no support for for one.
108
+ Node.js, so there is no support for one.
101
109
 
102
110
  ### HTTP Upgrade request
103
111
 
@@ -117,7 +125,7 @@ entity, the request will be considered "finished" even before it has been
117
125
  read.
118
126
 
119
127
  There is no such thing as a response object to a `Upgrade` request in
120
- Node.js, so there is no support for for one.
128
+ Node.js, so there is no support for one.
121
129
 
122
130
  ## Example
123
131
 
@@ -126,13 +134,14 @@ once the response finishes.
126
134
 
127
135
  ```js
128
136
  var destroy = require('destroy')
137
+ var fs = require('fs')
129
138
  var http = require('http')
130
139
  var onFinished = require('on-finished')
131
140
 
132
- http.createServer(function onRequest(req, res) {
141
+ http.createServer(function onRequest (req, res) {
133
142
  var stream = fs.createReadStream('package.json')
134
143
  stream.pipe(res)
135
- onFinished(res, function (err) {
144
+ onFinished(res, function () {
136
145
  destroy(stream)
137
146
  })
138
147
  })
@@ -142,13 +151,12 @@ http.createServer(function onRequest(req, res) {
142
151
 
143
152
  [MIT](LICENSE)
144
153
 
145
- [npm-image]: https://img.shields.io/npm/v/on-finished.svg
146
- [npm-url]: https://npmjs.org/package/on-finished
147
- [node-version-image]: https://img.shields.io/node/v/on-finished.svg
148
- [node-version-url]: http://nodejs.org/download/
149
- [travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg
150
- [travis-url]: https://travis-ci.org/jshttp/on-finished
151
- [coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg
154
+ [ci-image]: https://badgen.net/github/checks/jshttp/on-finished/master?label=ci
155
+ [ci-url]: https://github.com/jshttp/on-finished/actions/workflows/ci.yml
156
+ [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-finished/master
152
157
  [coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master
153
- [downloads-image]: https://img.shields.io/npm/dm/on-finished.svg
154
- [downloads-url]: https://npmjs.org/package/on-finished
158
+ [node-image]: https://badgen.net/npm/node/on-finished
159
+ [node-url]: https://nodejs.org/en/download
160
+ [npm-downloads-image]: https://badgen.net/npm/dm/on-finished
161
+ [npm-url]: https://npmjs.org/package/on-finished
162
+ [npm-version-image]: https://badgen.net/npm/v/on-finished
@@ -20,6 +20,7 @@ module.exports.isFinished = isFinished
20
20
  * @private
21
21
  */
22
22
 
23
+ var asyncHooks = tryRequireAsyncHooks()
23
24
  var first = require('ee-first')
24
25
 
25
26
  /**
@@ -30,7 +31,7 @@ var first = require('ee-first')
30
31
  /* istanbul ignore next */
31
32
  var defer = typeof setImmediate === 'function'
32
33
  ? setImmediate
33
- : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
34
+ : function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
34
35
 
35
36
  /**
36
37
  * Invoke callback when the response has finished, useful for
@@ -42,14 +43,14 @@ var defer = typeof setImmediate === 'function'
42
43
  * @public
43
44
  */
44
45
 
45
- function onFinished(msg, listener) {
46
+ function onFinished (msg, listener) {
46
47
  if (isFinished(msg) !== false) {
47
48
  defer(listener, null, msg)
48
49
  return msg
49
50
  }
50
51
 
51
52
  // attach the listener to the message
52
- attachListener(msg, listener)
53
+ attachListener(msg, wrap(listener))
53
54
 
54
55
  return msg
55
56
  }
@@ -62,7 +63,7 @@ function onFinished(msg, listener) {
62
63
  * @public
63
64
  */
64
65
 
65
- function isFinished(msg) {
66
+ function isFinished (msg) {
66
67
  var socket = msg.socket
67
68
 
68
69
  if (typeof msg.finished === 'boolean') {
@@ -87,12 +88,12 @@ function isFinished(msg) {
87
88
  * @private
88
89
  */
89
90
 
90
- function attachFinishedListener(msg, callback) {
91
+ function attachFinishedListener (msg, callback) {
91
92
  var eeMsg
92
93
  var eeSocket
93
94
  var finished = false
94
95
 
95
- function onFinish(error) {
96
+ function onFinish (error) {
96
97
  eeMsg.cancel()
97
98
  eeSocket.cancel()
98
99
 
@@ -103,7 +104,7 @@ function attachFinishedListener(msg, callback) {
103
104
  // finished on first message event
104
105
  eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
105
106
 
106
- function onSocket(socket) {
107
+ function onSocket (socket) {
107
108
  // remove listener
108
109
  msg.removeListener('socket', onSocket)
109
110
 
@@ -124,7 +125,7 @@ function attachFinishedListener(msg, callback) {
124
125
  msg.on('socket', onSocket)
125
126
 
126
127
  if (msg.socket === undefined) {
127
- // node.js 0.8 patch
128
+ // istanbul ignore next: node.js 0.8 patch
128
129
  patchAssignSocket(msg, onSocket)
129
130
  }
130
131
  }
@@ -137,7 +138,7 @@ function attachFinishedListener(msg, callback) {
137
138
  * @private
138
139
  */
139
140
 
140
- function attachListener(msg, listener) {
141
+ function attachListener (msg, listener) {
141
142
  var attached = msg.__onFinished
142
143
 
143
144
  // create a private single listener with queue
@@ -157,8 +158,8 @@ function attachListener(msg, listener) {
157
158
  * @private
158
159
  */
159
160
 
160
- function createListener(msg) {
161
- function listener(err) {
161
+ function createListener (msg) {
162
+ function listener (err) {
162
163
  if (msg.__onFinished === listener) msg.__onFinished = null
163
164
  if (!listener.queue) return
164
165
 
@@ -183,14 +184,51 @@ function createListener(msg) {
183
184
  * @private
184
185
  */
185
186
 
186
- function patchAssignSocket(res, callback) {
187
+ // istanbul ignore next: node.js 0.8 patch
188
+ function patchAssignSocket (res, callback) {
187
189
  var assignSocket = res.assignSocket
188
190
 
189
191
  if (typeof assignSocket !== 'function') return
190
192
 
191
193
  // res.on('socket', callback) is broken in 0.8
192
- res.assignSocket = function _assignSocket(socket) {
194
+ res.assignSocket = function _assignSocket (socket) {
193
195
  assignSocket.call(this, socket)
194
196
  callback(socket)
195
197
  }
196
198
  }
199
+
200
+ /**
201
+ * Try to require async_hooks
202
+ * @private
203
+ */
204
+
205
+ function tryRequireAsyncHooks () {
206
+ try {
207
+ return require('async_hooks')
208
+ } catch (e) {
209
+ return {}
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Wrap function with async resource, if possible.
215
+ * AsyncResource.bind static method backported.
216
+ * @private
217
+ */
218
+
219
+ function wrap (fn) {
220
+ var res
221
+
222
+ // create anonymous resource
223
+ if (asyncHooks.AsyncResource) {
224
+ res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
225
+ }
226
+
227
+ // incompatible node.js
228
+ if (!res || !res.runInAsyncScope) {
229
+ return fn
230
+ }
231
+
232
+ // return bound function
233
+ return res.runInAsyncScope.bind(res, fn, null)
234
+ }
@@ -1,25 +1,19 @@
1
1
  {
2
- "_args": [
3
- [
4
- "on-finished@2.3.0",
5
- "/Users/conway/Projects/worldmap"
6
- ]
7
- ],
8
- "_from": "on-finished@2.3.0",
9
- "_id": "on-finished@2.3.0",
2
+ "_from": "on-finished@2.4.1",
3
+ "_id": "on-finished@2.4.1",
10
4
  "_inBundle": false,
11
- "_integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
5
+ "_integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
12
6
  "_location": "/on-finished",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
15
9
  "type": "version",
16
10
  "registry": true,
17
- "raw": "on-finished@2.3.0",
11
+ "raw": "on-finished@2.4.1",
18
12
  "name": "on-finished",
19
13
  "escapedName": "on-finished",
20
- "rawSpec": "2.3.0",
14
+ "rawSpec": "2.4.1",
21
15
  "saveSpec": null,
22
- "fetchSpec": "2.3.0"
16
+ "fetchSpec": "2.4.1"
23
17
  },
24
18
  "_requiredBy": [
25
19
  "/body-parser",
@@ -27,12 +21,14 @@
27
21
  "/finalhandler",
28
22
  "/send"
29
23
  ],
30
- "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
31
- "_spec": "2.3.0",
32
- "_where": "/Users/conway/Projects/worldmap",
24
+ "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
25
+ "_shasum": "58c8c44116e54845ad57f14ab10b03533184ac3f",
26
+ "_spec": "on-finished@2.4.1",
27
+ "_where": "/Users/conway/Projects/worldmap/node_modules/express",
33
28
  "bugs": {
34
29
  "url": "https://github.com/jshttp/on-finished/issues"
35
30
  },
31
+ "bundleDependencies": false,
36
32
  "contributors": [
37
33
  {
38
34
  "name": "Douglas Christopher Wilson",
@@ -47,10 +43,18 @@
47
43
  "dependencies": {
48
44
  "ee-first": "1.1.1"
49
45
  },
46
+ "deprecated": false,
50
47
  "description": "Execute a callback when a request closes, finishes, or errors",
51
48
  "devDependencies": {
52
- "istanbul": "0.3.9",
53
- "mocha": "2.2.5"
49
+ "eslint": "7.32.0",
50
+ "eslint-config-standard": "14.1.1",
51
+ "eslint-plugin-import": "2.25.4",
52
+ "eslint-plugin-markdown": "2.2.1",
53
+ "eslint-plugin-node": "11.1.0",
54
+ "eslint-plugin-promise": "5.2.0",
55
+ "eslint-plugin-standard": "4.1.0",
56
+ "mocha": "9.2.1",
57
+ "nyc": "15.1.0"
54
58
  },
55
59
  "engines": {
56
60
  "node": ">= 0.8"
@@ -68,9 +72,10 @@
68
72
  "url": "git+https://github.com/jshttp/on-finished.git"
69
73
  },
70
74
  "scripts": {
75
+ "lint": "eslint .",
71
76
  "test": "mocha --reporter spec --bail --check-leaks test/",
72
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
73
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
77
+ "test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
78
+ "test-cov": "nyc --reporter=html --reporter=text npm test"
74
79
  },
75
- "version": "2.3.0"
80
+ "version": "2.4.1"
76
81
  }
@@ -1,14 +1,8 @@
1
1
  {
2
- "_args": [
3
- [
4
- "path-to-regexp@0.1.7",
5
- "/Users/conway/Projects/worldmap"
6
- ]
7
- ],
8
2
  "_from": "path-to-regexp@0.1.7",
9
3
  "_id": "path-to-regexp@0.1.7",
10
4
  "_inBundle": false,
11
- "_integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
5
+ "_integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
12
6
  "_location": "/path-to-regexp",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
@@ -25,16 +19,19 @@
25
19
  "/express"
26
20
  ],
27
21
  "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
28
- "_spec": "0.1.7",
29
- "_where": "/Users/conway/Projects/worldmap",
22
+ "_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c",
23
+ "_spec": "path-to-regexp@0.1.7",
24
+ "_where": "/Users/conway/Projects/worldmap/node_modules/express",
30
25
  "bugs": {
31
26
  "url": "https://github.com/component/path-to-regexp/issues"
32
27
  },
28
+ "bundleDependencies": false,
33
29
  "component": {
34
30
  "scripts": {
35
31
  "path-to-regexp": "index.js"
36
32
  }
37
33
  },
34
+ "deprecated": false,
38
35
  "description": "Express style path to RegExp utility",
39
36
  "devDependencies": {
40
37
  "istanbul": "^0.2.6",
@@ -1,14 +1,31 @@
1
- ## **6.9.7**
1
+ ## **6.10.3**
2
2
  - [Fix] `parse`: ignore `__proto__` keys (#428)
3
- - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424)
4
3
  - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
4
+ - [actions] reuse common workflows
5
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `tape`
6
+
7
+ ## **6.10.2**
8
+ - [Fix] `stringify`: actually fix cyclic references (#426)
9
+ - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424)
5
10
  - [readme] remove travis badge; add github actions/codecov badges; update URLs
6
11
  - [Docs] add note and links for coercing primitive values (#408)
12
+ - [actions] update codecov uploader
13
+ - [actions] update workflows
7
14
  - [Tests] clean up stringify tests slightly
15
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `safe-publish-latest`, `tape`
16
+
17
+ ## **6.10.1**
18
+ - [Fix] `stringify`: avoid exception on repeated object values (#402)
19
+
20
+ ## **6.10.0**
21
+ - [New] `stringify`: throw on cycles, instead of an infinite loop (#395, #394, #393)
22
+ - [New] `parse`: add `allowSparse` option for collapsing arrays with missing indices (#312)
8
23
  - [meta] fix README.md (#399)
9
- - Revert "[meta] ignore eclint transitive audit warning"
10
- - [actions] backport actions from main
11
- - [Dev Deps] backport updates from main
24
+ - [meta] only run `npm run dist` in publish, not install
25
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape`
26
+ - [Tests] fix tests on node v0.6
27
+ - [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run`
28
+ - [Tests] Revert "[meta] ignore eclint transitive audit warning"
12
29
 
13
30
  ## **6.9.6**
14
31
  - [Fix] restore `dist` dir; mistakenly removed in d4f6c32