node-red-contrib-web-worldmap 4.6.1 → 4.6.3

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 (173) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +6 -3
  3. package/node_modules/body-parser/HISTORY.md +8 -0
  4. package/node_modules/body-parser/README.md +11 -10
  5. package/node_modules/body-parser/lib/types/json.js +15 -4
  6. package/node_modules/body-parser/package.json +8 -8
  7. package/node_modules/call-bind/.eslintrc +0 -1
  8. package/node_modules/call-bind/.nycrc +0 -4
  9. package/node_modules/call-bind/CHANGELOG.md +51 -0
  10. package/node_modules/call-bind/README.md +63 -1
  11. package/node_modules/call-bind/index.js +11 -23
  12. package/node_modules/call-bind/package.json +38 -23
  13. package/node_modules/call-bind/test/callBound.js +0 -1
  14. package/node_modules/call-bind/test/index.js +18 -4
  15. package/node_modules/content-type/HISTORY.md +5 -0
  16. package/node_modules/content-type/README.md +21 -19
  17. package/node_modules/content-type/index.js +12 -9
  18. package/node_modules/content-type/package.json +13 -11
  19. package/node_modules/define-data-property/.eslintrc +24 -0
  20. package/node_modules/define-data-property/.github/FUNDING.yml +12 -0
  21. package/node_modules/define-data-property/.nycrc +13 -0
  22. package/node_modules/define-data-property/CHANGELOG.md +70 -0
  23. package/node_modules/define-data-property/LICENSE +21 -0
  24. package/node_modules/define-data-property/README.md +67 -0
  25. package/node_modules/define-data-property/index.d.ts +12 -0
  26. package/node_modules/define-data-property/index.js +56 -0
  27. package/node_modules/define-data-property/package.json +106 -0
  28. package/node_modules/define-data-property/test/index.js +392 -0
  29. package/node_modules/define-data-property/tsconfig.json +59 -0
  30. package/node_modules/es-define-property/.eslintrc +13 -0
  31. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  32. package/node_modules/es-define-property/.nycrc +9 -0
  33. package/node_modules/es-define-property/CHANGELOG.md +15 -0
  34. package/node_modules/es-define-property/LICENSE +21 -0
  35. package/node_modules/es-define-property/README.md +49 -0
  36. package/node_modules/es-define-property/index.d.ts +3 -0
  37. package/node_modules/es-define-property/index.js +16 -0
  38. package/node_modules/es-define-property/package.json +81 -0
  39. package/node_modules/es-define-property/test/index.js +55 -0
  40. package/node_modules/es-define-property/tsconfig.json +50 -0
  41. package/node_modules/es-errors/.eslintrc +5 -0
  42. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  43. package/node_modules/es-errors/CHANGELOG.md +40 -0
  44. package/node_modules/es-errors/LICENSE +21 -0
  45. package/node_modules/es-errors/README.md +55 -0
  46. package/node_modules/es-errors/eval.d.ts +3 -0
  47. package/node_modules/es-errors/eval.js +4 -0
  48. package/node_modules/es-errors/index.d.ts +3 -0
  49. package/node_modules/es-errors/index.js +4 -0
  50. package/node_modules/es-errors/package.json +80 -0
  51. package/node_modules/es-errors/range.d.ts +3 -0
  52. package/node_modules/es-errors/range.js +4 -0
  53. package/node_modules/es-errors/ref.d.ts +3 -0
  54. package/node_modules/es-errors/ref.js +4 -0
  55. package/node_modules/es-errors/syntax.d.ts +3 -0
  56. package/node_modules/es-errors/syntax.js +4 -0
  57. package/node_modules/es-errors/test/index.js +19 -0
  58. package/node_modules/es-errors/tsconfig.json +49 -0
  59. package/node_modules/es-errors/type.d.ts +3 -0
  60. package/node_modules/es-errors/type.js +4 -0
  61. package/node_modules/es-errors/uri.d.ts +3 -0
  62. package/node_modules/es-errors/uri.js +4 -0
  63. package/node_modules/express/History.md +14 -5
  64. package/node_modules/express/Readme.md +1 -1
  65. package/node_modules/express/lib/router/index.js +1 -1
  66. package/node_modules/express/lib/router/route.js +7 -2
  67. package/node_modules/express/lib/utils.js +3 -4
  68. package/node_modules/express/package.json +5 -6
  69. package/node_modules/function-bind/.eslintrc +11 -5
  70. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  71. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  72. package/node_modules/function-bind/.nycrc +13 -0
  73. package/node_modules/function-bind/CHANGELOG.md +136 -0
  74. package/node_modules/function-bind/README.md +25 -27
  75. package/node_modules/function-bind/implementation.js +44 -12
  76. package/node_modules/function-bind/package.json +38 -14
  77. package/node_modules/get-intrinsic/.eslintrc +1 -0
  78. package/node_modules/get-intrinsic/CHANGELOG.md +45 -0
  79. package/node_modules/get-intrinsic/index.js +41 -16
  80. package/node_modules/get-intrinsic/package.json +20 -18
  81. package/node_modules/get-intrinsic/test/GetIntrinsic.js +1 -1
  82. package/node_modules/gopd/.eslintrc +16 -0
  83. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  84. package/node_modules/gopd/CHANGELOG.md +25 -0
  85. package/node_modules/gopd/LICENSE +21 -0
  86. package/node_modules/gopd/README.md +40 -0
  87. package/node_modules/gopd/index.js +16 -0
  88. package/node_modules/gopd/package.json +71 -0
  89. package/node_modules/gopd/test/index.js +35 -0
  90. package/node_modules/has-property-descriptors/.eslintrc +13 -0
  91. package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
  92. package/node_modules/has-property-descriptors/.nycrc +9 -0
  93. package/node_modules/has-property-descriptors/CHANGELOG.md +35 -0
  94. package/node_modules/has-property-descriptors/LICENSE +21 -0
  95. package/node_modules/has-property-descriptors/README.md +43 -0
  96. package/node_modules/has-property-descriptors/index.js +22 -0
  97. package/node_modules/has-property-descriptors/package.json +77 -0
  98. package/node_modules/has-property-descriptors/test/index.js +57 -0
  99. package/node_modules/has-proto/.eslintrc +5 -0
  100. package/node_modules/has-proto/.github/FUNDING.yml +12 -0
  101. package/node_modules/has-proto/CHANGELOG.md +38 -0
  102. package/node_modules/has-proto/LICENSE +21 -0
  103. package/node_modules/has-proto/README.md +38 -0
  104. package/node_modules/has-proto/index.d.ts +3 -0
  105. package/node_modules/has-proto/index.js +15 -0
  106. package/node_modules/has-proto/package.json +78 -0
  107. package/node_modules/has-proto/test/index.js +19 -0
  108. package/node_modules/has-proto/tsconfig.json +49 -0
  109. package/node_modules/hasown/.eslintrc +5 -0
  110. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  111. package/node_modules/hasown/.nycrc +13 -0
  112. package/node_modules/hasown/CHANGELOG.md +28 -0
  113. package/node_modules/hasown/LICENSE +21 -0
  114. package/node_modules/hasown/README.md +40 -0
  115. package/node_modules/hasown/index.d.ts +3 -0
  116. package/node_modules/hasown/index.js +8 -0
  117. package/node_modules/hasown/package.json +89 -0
  118. package/node_modules/hasown/tsconfig.json +49 -0
  119. package/node_modules/http-parser-js/README.md +43 -0
  120. package/node_modules/http-parser-js/http-parser.d.ts +175 -0
  121. package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/http-parser.js +12 -7
  122. package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/package.json +4 -2
  123. package/node_modules/object-inspect/CHANGELOG.md +29 -0
  124. package/node_modules/object-inspect/index.js +18 -6
  125. package/node_modules/object-inspect/package.json +13 -8
  126. package/node_modules/object-inspect/test/global.js +17 -0
  127. package/node_modules/raw-body/HISTORY.md +5 -0
  128. package/node_modules/raw-body/README.md +1 -1
  129. package/node_modules/raw-body/index.js +7 -0
  130. package/node_modules/raw-body/package.json +7 -7
  131. package/node_modules/set-function-length/.eslintrc +27 -0
  132. package/node_modules/set-function-length/.github/FUNDING.yml +12 -0
  133. package/node_modules/set-function-length/.nycrc +13 -0
  134. package/node_modules/set-function-length/CHANGELOG.md +59 -0
  135. package/node_modules/set-function-length/LICENSE +21 -0
  136. package/node_modules/set-function-length/README.md +56 -0
  137. package/node_modules/set-function-length/env.d.ts +6 -0
  138. package/node_modules/set-function-length/env.d.ts.map +1 -0
  139. package/node_modules/set-function-length/env.js +24 -0
  140. package/node_modules/set-function-length/index.d.ts +7 -0
  141. package/node_modules/set-function-length/index.d.ts.map +1 -0
  142. package/node_modules/set-function-length/index.js +44 -0
  143. package/node_modules/set-function-length/package.json +104 -0
  144. package/node_modules/set-function-length/tsconfig.json +59 -0
  145. package/node_modules/{function-bind → side-channel}/.editorconfig +3 -14
  146. package/node_modules/side-channel/.eslintrc +1 -1
  147. package/node_modules/side-channel/CHANGELOG.md +30 -0
  148. package/node_modules/side-channel/index.d.ts +27 -0
  149. package/node_modules/side-channel/index.js +25 -20
  150. package/node_modules/side-channel/package.json +36 -19
  151. package/node_modules/side-channel/test/index.js +6 -1
  152. package/node_modules/side-channel/tsconfig.json +50 -0
  153. package/package.json +1 -1
  154. package/worldmap/index.html +2 -2
  155. package/worldmap/worldmap.js +4 -2
  156. package/worldmap.js +2 -2
  157. package/node_modules/function-bind/.jscs.json +0 -176
  158. package/node_modules/function-bind/.npmignore +0 -22
  159. package/node_modules/function-bind/.travis.yml +0 -168
  160. package/node_modules/has/LICENSE-MIT +0 -22
  161. package/node_modules/has/README.md +0 -18
  162. package/node_modules/has/package.json +0 -48
  163. package/node_modules/has/src/index.js +0 -5
  164. package/node_modules/has/test/index.js +0 -10
  165. package/node_modules/side-channel/.eslintignore +0 -1
  166. package/node_modules/websocket-driver/node_modules/http-parser-js/CHANGELOG.md +0 -14
  167. package/node_modules/websocket-driver/node_modules/http-parser-js/README.md +0 -31
  168. /package/node_modules/{compression/node_modules/bytes → bytes}/History.md +0 -0
  169. /package/node_modules/{compression/node_modules/bytes → bytes}/LICENSE +0 -0
  170. /package/node_modules/{compression/node_modules/bytes → bytes}/Readme.md +0 -0
  171. /package/node_modules/{compression/node_modules/bytes → bytes}/index.js +0 -0
  172. /package/node_modules/{compression/node_modules/bytes → bytes}/package.json +0 -0
  173. /package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/LICENSE.md +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
4
+ - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
3
5
  - v4.6.1 - let default pmtiles be light/dark or monocolored.
4
6
  - v4.5.2 - Tidy up when pmtiles removed.
5
7
  - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules.
package/README.md CHANGED
@@ -13,7 +13,9 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
- - v4.6.1 - let default pmtiles be light/dark or monocolored.
16
+ - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
17
+ - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
18
+ - v4.6.1 - Let default pmtiles be light/dark or monocolored.
17
19
  - v4.5.2 - Tidy up when pmtiles removed.
18
20
  - v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
19
21
  - v4.4.0 - Add quad(copter) drone icon.
@@ -429,6 +431,7 @@ Feeding this into the tracks node will also remove the tracks stored for that la
429
431
  The layer will be called `name`. By default it expects a leaflet Tilelayer style url. You can also use a WMS
430
432
  style server by adding a property `wms: true`. You can also set `wms: "grey"` to set the layer to greyscale which
431
433
  may let your markers be more visible. (see overlay example below).
434
+ Also useful is the Leaflet option `maxNativeZoom` which can allow scaling of maps beyond their natural maximum zoom level.
432
435
 
433
436
  msg.payload.command.map = {
434
437
  "name":"OSMhot", // use "overlay":"MyOverlayName" for an overlay rather than a base layer.
@@ -739,13 +742,13 @@ The `maxDataZoom` should match the maximum zoom level in you pmtiles file(s) - w
739
742
 
740
743
  You can also load them dynamically with a command like
741
744
 
742
- msg.payload = {"command":{"map":{"name":"MyMap", "pmtiles":"/path/to/mymap.pmtiles", "opt":"myOptionsObject"}}}
745
+ msg.payload = {"command":{"map":{"name":"MyMap", "pmtiles":"/path/to/mymap.pmtiles", "opt":myOptionsObject}}}
743
746
 
744
747
  Where `opt` can be as per the options file mentioned above - or omitted completely.
745
748
 
746
749
  ### Using a Docker Map Server
747
750
 
748
- I have found the easiest to use mapserver for decent generic map to be Tileserver-gl. It uses mbtiles format maps - for example from [MapTiler Data](https://data.maptiler.com/downloads/planet/). You can download your mbtiles file into a directory and then from that directory run
751
+ I have found the easiest to use mapserver for a decent generic map to be Tileserver-gl. It uses mbtiles format maps - for example from [MapTiler Data](https://data.maptiler.com/downloads/planet/). You can download your mbtiles file into a directory and then from that directory run
749
752
  ```
750
753
  docker run --name maptiler -d -v $(pwd):/data -p 1884:8080 maptiler/tileserver-gl -p 8080 --mbtiles yourMapFile.mbtiles
751
754
  ```
@@ -1,3 +1,11 @@
1
+ 1.20.2 / 2023-02-21
2
+ ===================
3
+
4
+ * Fix strict json error message on Node.js 19+
5
+ * deps: content-type@~1.0.5
6
+ - perf: skip value escaping when unnecessary
7
+ * deps: raw-body@2.5.2
8
+
1
9
  1.20.1 / 2022-10-06
2
10
  ===================
3
11
 
@@ -1,8 +1,8 @@
1
1
  # body-parser
2
2
 
3
- [![NPM Version][npm-image]][npm-url]
4
- [![NPM Downloads][downloads-image]][downloads-url]
5
- [![Build Status][github-actions-ci-image]][github-actions-ci-url]
3
+ [![NPM Version][npm-version-image]][npm-url]
4
+ [![NPM Downloads][npm-downloads-image]][npm-url]
5
+ [![Build Status][ci-image]][ci-url]
6
6
  [![Test Coverage][coveralls-image]][coveralls-url]
7
7
 
8
8
  Node.js body parsing middleware.
@@ -454,11 +454,12 @@ app.use(bodyParser.text({ type: 'text/html' }))
454
454
 
455
455
  [MIT](LICENSE)
456
456
 
457
- [npm-image]: https://img.shields.io/npm/v/body-parser.svg
458
- [npm-url]: https://npmjs.org/package/body-parser
459
- [coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg
457
+ [ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
458
+ [ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
459
+ [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
460
460
  [coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
461
- [downloads-image]: https://img.shields.io/npm/dm/body-parser.svg
462
- [downloads-url]: https://npmjs.org/package/body-parser
463
- [github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/body-parser/ci/master?label=ci
464
- [github-actions-ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
461
+ [node-version-image]: https://badgen.net/npm/node/body-parser
462
+ [node-version-url]: https://nodejs.org/en/download
463
+ [npm-downloads-image]: https://badgen.net/npm/dm/body-parser
464
+ [npm-url]: https://npmjs.org/package/body-parser
465
+ [npm-version-image]: https://badgen.net/npm/v/body-parser
@@ -39,6 +39,9 @@ module.exports = json
39
39
 
40
40
  var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
41
41
 
42
+ var JSON_SYNTAX_CHAR = '#'
43
+ var JSON_SYNTAX_REGEXP = /#+/g
44
+
42
45
  /**
43
46
  * Create a middleware to parse JSON bodies.
44
47
  *
@@ -152,15 +155,23 @@ function json (options) {
152
155
 
153
156
  function createStrictSyntaxError (str, char) {
154
157
  var index = str.indexOf(char)
155
- var partial = index !== -1
156
- ? str.substring(0, index) + '#'
157
- : ''
158
+ var partial = ''
159
+
160
+ if (index !== -1) {
161
+ partial = str.substring(0, index) + JSON_SYNTAX_CHAR
162
+
163
+ for (var i = index + 1; i < str.length; i++) {
164
+ partial += JSON_SYNTAX_CHAR
165
+ }
166
+ }
158
167
 
159
168
  try {
160
169
  JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
161
170
  } catch (e) {
162
171
  return normalizeJsonSyntaxError(e, {
163
- message: e.message.replace('#', char),
172
+ message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
173
+ return str.substring(index, index + placeholder.length)
174
+ }),
164
175
  stack: e.stack
165
176
  })
166
177
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "body-parser",
3
3
  "description": "Node.js body parsing middleware",
4
- "version": "1.20.1",
4
+ "version": "1.20.2",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
@@ -10,7 +10,7 @@
10
10
  "repository": "expressjs/body-parser",
11
11
  "dependencies": {
12
12
  "bytes": "3.1.2",
13
- "content-type": "~1.0.4",
13
+ "content-type": "~1.0.5",
14
14
  "debug": "2.6.9",
15
15
  "depd": "2.0.0",
16
16
  "destroy": "1.2.0",
@@ -18,23 +18,23 @@
18
18
  "iconv-lite": "0.4.24",
19
19
  "on-finished": "2.4.1",
20
20
  "qs": "6.11.0",
21
- "raw-body": "2.5.1",
21
+ "raw-body": "2.5.2",
22
22
  "type-is": "~1.6.18",
23
23
  "unpipe": "1.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "eslint": "8.24.0",
26
+ "eslint": "8.34.0",
27
27
  "eslint-config-standard": "14.1.1",
28
- "eslint-plugin-import": "2.26.0",
28
+ "eslint-plugin-import": "2.27.5",
29
29
  "eslint-plugin-markdown": "3.0.0",
30
30
  "eslint-plugin-node": "11.1.0",
31
- "eslint-plugin-promise": "6.0.1",
31
+ "eslint-plugin-promise": "6.1.1",
32
32
  "eslint-plugin-standard": "4.1.0",
33
33
  "methods": "1.1.2",
34
- "mocha": "10.0.0",
34
+ "mocha": "10.2.0",
35
35
  "nyc": "15.1.0",
36
36
  "safe-buffer": "5.2.1",
37
- "supertest": "6.3.0"
37
+ "supertest": "6.3.3"
38
38
  },
39
39
  "files": [
40
40
  "lib/",
@@ -12,6 +12,5 @@
12
12
  ],
13
13
  }],
14
14
  "no-magic-numbers": 0,
15
- "operator-linebreak": [2, "before"],
16
15
  },
17
16
  }
@@ -2,10 +2,6 @@
2
2
  "all": true,
3
3
  "check-coverage": false,
4
4
  "reporter": ["text-summary", "text", "html", "json"],
5
- "lines": 86,
6
- "statements": 85.93,
7
- "functions": 82.43,
8
- "branches": 76.06,
9
5
  "exclude": [
10
6
  "coverage",
11
7
  "test"
@@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12
9
+
10
+ ### Commits
11
+
12
+ - [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03)
13
+ - [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590)
14
+
15
+ ## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05
16
+
17
+ ### Commits
18
+
19
+ - [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa)
20
+ - [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e)
21
+ - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5)
22
+ - [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582)
23
+
24
+ ## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19
25
+
26
+ ### Commits
27
+
28
+ - [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d)
29
+ - [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871)
30
+
31
+ ## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19
32
+
33
+ ## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19
34
+
35
+ ### Commits
36
+
37
+ - [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453)
38
+ - [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5)
39
+ - [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22)
40
+ - [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90)
41
+ - [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150)
42
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4)
43
+ - [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9)
44
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11)
45
+ - [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5)
46
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd)
47
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8)
48
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff)
49
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223)
50
+ - [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5)
51
+ - [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05)
52
+ - [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329)
53
+ - [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958)
54
+ - [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5)
55
+ - [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3)
56
+ - [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91)
57
+ - [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60)
58
+
8
59
  ## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11
9
60
 
10
61
  ### Commits
@@ -1,2 +1,64 @@
1
- # call-bind
1
+ # call-bind <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![dependency status][deps-svg]][deps-url]
6
+ [![dev dependency status][dev-deps-svg]][dev-deps-url]
7
+ [![License][license-image]][license-url]
8
+ [![Downloads][downloads-image]][downloads-url]
9
+
10
+ [![npm badge][npm-badge-png]][package-url]
11
+
2
12
  Robustly `.call.bind()` a function.
13
+
14
+ ## Getting started
15
+
16
+ ```sh
17
+ npm install --save call-bind
18
+ ```
19
+
20
+ ## Usage/Examples
21
+
22
+ ```js
23
+ const assert = require('assert');
24
+ const callBind = require('call-bind');
25
+ const callBound = require('call-bind/callBound');
26
+
27
+ function f(a, b) {
28
+ assert.equal(this, 1);
29
+ assert.equal(a, 2);
30
+ assert.equal(b, 3);
31
+ assert.equal(arguments.length, 2);
32
+ }
33
+
34
+ const fBound = callBind(f);
35
+
36
+ const slice = callBound('Array.prototype.slice');
37
+
38
+ delete Function.prototype.call;
39
+ delete Function.prototype.bind;
40
+
41
+ fBound(1, 2, 3);
42
+
43
+ assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
44
+ ```
45
+
46
+ ## Tests
47
+
48
+ Clone the repo, `npm install`, and run `npm test`
49
+
50
+ [package-url]: https://npmjs.org/package/call-bind
51
+ [npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg
52
+ [deps-svg]: https://david-dm.org/ljharb/call-bind.svg
53
+ [deps-url]: https://david-dm.org/ljharb/call-bind
54
+ [dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg
55
+ [dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies
56
+ [npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true
57
+ [license-image]: https://img.shields.io/npm/l/call-bind.svg
58
+ [license-url]: LICENSE
59
+ [downloads-image]: https://img.shields.io/npm/dm/call-bind.svg
60
+ [downloads-url]: https://npm-stat.com/charts.html?package=call-bind
61
+ [codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg
62
+ [codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/
63
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind
64
+ [actions-url]: https://github.com/ljharb/call-bind/actions
@@ -2,38 +2,26 @@
2
2
 
3
3
  var bind = require('function-bind');
4
4
  var GetIntrinsic = require('get-intrinsic');
5
+ var setFunctionLength = require('set-function-length');
5
6
 
7
+ var $TypeError = require('es-errors/type');
6
8
  var $apply = GetIntrinsic('%Function.prototype.apply%');
7
9
  var $call = GetIntrinsic('%Function.prototype.call%');
8
10
  var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
9
11
 
10
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
11
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
12
+ var $defineProperty = require('es-define-property');
12
13
  var $max = GetIntrinsic('%Math.max%');
13
14
 
14
- if ($defineProperty) {
15
- try {
16
- $defineProperty({}, 'a', { value: 1 });
17
- } catch (e) {
18
- // IE 8 has a broken defineProperty
19
- $defineProperty = null;
20
- }
21
- }
22
-
23
15
  module.exports = function callBind(originalFunction) {
24
- var func = $reflectApply(bind, $call, arguments);
25
- if ($gOPD && $defineProperty) {
26
- var desc = $gOPD(func, 'length');
27
- if (desc.configurable) {
28
- // original length, plus the receiver, minus any additional arguments (after the receiver)
29
- $defineProperty(
30
- func,
31
- 'length',
32
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
33
- );
34
- }
16
+ if (typeof originalFunction !== 'function') {
17
+ throw new $TypeError('a function is required');
35
18
  }
36
- return func;
19
+ var func = $reflectApply(bind, $call, arguments);
20
+ return setFunctionLength(
21
+ func,
22
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
23
+ true
24
+ );
37
25
  };
38
26
 
39
27
  var applyBind = function applyBind() {
@@ -1,28 +1,21 @@
1
1
  {
2
2
  "name": "call-bind",
3
- "version": "1.0.2",
3
+ "version": "1.0.7",
4
4
  "description": "Robustly `.call.bind()` a function",
5
5
  "main": "index.js",
6
6
  "exports": {
7
- ".": [
8
- {
9
- "default": "./index.js"
10
- },
11
- "./index.js"
12
- ],
13
- "./callBound": [
14
- {
15
- "default": "./callBound.js"
16
- },
17
- "./callBound.js"
18
- ],
7
+ ".": "./index.js",
8
+ "./callBound": "./callBound.js",
19
9
  "./package.json": "./package.json"
20
10
  },
21
11
  "scripts": {
22
- "prepublish": "safe-publish-latest",
12
+ "prepack": "npmignore --auto --commentLines=auto",
13
+ "prepublish": "not-in-publish || npm run prepublishOnly",
14
+ "prepublishOnly": "safe-publish-latest",
23
15
  "lint": "eslint --ext=.js,.mjs .",
16
+ "postlint": "evalmd README.md",
24
17
  "pretest": "npm run lint",
25
- "tests-only": "nyc tape 'test/*'",
18
+ "tests-only": "nyc tape 'test/**/*.js'",
26
19
  "test": "npm run tests-only",
27
20
  "posttest": "aud --production",
28
21
  "version": "auto-changelog && git add CHANGELOG.md",
@@ -57,17 +50,31 @@
57
50
  },
58
51
  "homepage": "https://github.com/ljharb/call-bind#readme",
59
52
  "devDependencies": {
60
- "@ljharb/eslint-config": "^17.3.0",
61
- "aud": "^1.1.3",
62
- "auto-changelog": "^2.2.1",
63
- "eslint": "^7.17.0",
53
+ "@ljharb/eslint-config": "^21.1.0",
54
+ "aud": "^2.0.4",
55
+ "auto-changelog": "^2.4.0",
56
+ "es-value-fixtures": "^1.4.2",
57
+ "eslint": "=8.8.0",
58
+ "evalmd": "^0.0.19",
59
+ "for-each": "^0.3.3",
60
+ "gopd": "^1.0.1",
61
+ "has-strict-mode": "^1.0.1",
62
+ "in-publish": "^2.0.1",
63
+ "npmignore": "^0.3.1",
64
64
  "nyc": "^10.3.2",
65
- "safe-publish-latest": "^1.1.4",
66
- "tape": "^5.1.1"
65
+ "object-inspect": "^1.13.1",
66
+ "safe-publish-latest": "^2.0.0",
67
+ "tape": "^5.7.4"
67
68
  },
68
69
  "dependencies": {
69
- "function-bind": "^1.1.1",
70
- "get-intrinsic": "^1.0.2"
70
+ "es-define-property": "^1.0.0",
71
+ "es-errors": "^1.3.0",
72
+ "function-bind": "^1.1.2",
73
+ "get-intrinsic": "^1.2.4",
74
+ "set-function-length": "^1.2.1"
75
+ },
76
+ "testling": {
77
+ "files": "test/index.js"
71
78
  },
72
79
  "auto-changelog": {
73
80
  "output": "CHANGELOG.md",
@@ -76,5 +83,13 @@
76
83
  "commitLimit": false,
77
84
  "backfillLimit": false,
78
85
  "hideCredit": true
86
+ },
87
+ "publishConfig": {
88
+ "ignore": [
89
+ ".github/workflows"
90
+ ]
91
+ },
92
+ "engines": {
93
+ "node": ">= 0.4"
79
94
  }
80
95
  }
@@ -40,7 +40,6 @@ test('callBound', function (t) {
40
40
  'allowMissing arg still throws for unknown intrinsic'
41
41
  );
42
42
 
43
- /* globals WeakRef: false */
44
43
  t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
45
44
  st['throws'](
46
45
  function () { callBound('WeakRef'); },
@@ -2,6 +2,11 @@
2
2
 
3
3
  var callBind = require('../');
4
4
  var bind = require('function-bind');
5
+ var gOPD = require('gopd');
6
+ var hasStrictMode = require('has-strict-mode')();
7
+ var forEach = require('for-each');
8
+ var inspect = require('object-inspect');
9
+ var v = require('es-value-fixtures');
5
10
 
6
11
  var test = require('tape');
7
12
 
@@ -10,15 +15,24 @@ var test = require('tape');
10
15
  * in io.js v3, it is configurable except on bound functions, hence the .bind()
11
16
  */
12
17
  var functionsHaveConfigurableLengths = !!(
13
- Object.getOwnPropertyDescriptor
18
+ gOPD
19
+ && Object.getOwnPropertyDescriptor
14
20
  && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable
15
21
  );
16
22
 
17
23
  test('callBind', function (t) {
24
+ forEach(v.nonFunctions, function (nonFunction) {
25
+ t['throws'](
26
+ function () { callBind(nonFunction); },
27
+ TypeError,
28
+ inspect(nonFunction) + ' is not a function'
29
+ );
30
+ });
31
+
18
32
  var sentinel = { sentinel: true };
19
33
  var func = function (a, b) {
20
34
  // eslint-disable-next-line no-invalid-this
21
- return [this, a, b];
35
+ return [!hasStrictMode && this === global ? undefined : this, a, b];
22
36
  };
23
37
  t.equal(func.length, 2, 'original function length is 2');
24
38
  t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
@@ -28,8 +42,8 @@ test('callBind', function (t) {
28
42
  var bound = callBind(func);
29
43
  t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
30
44
  t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args');
31
- t.deepEqual(bound(1, 2), [1, 2, undefined], 'bound func with right args');
32
- t.deepEqual(bound(1, 2, 3), [1, 2, 3], 'bound func with too many args');
45
+ t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args');
46
+ t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args');
33
47
 
34
48
  var boundR = callBind(func, sentinel);
35
49
  t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
@@ -1,3 +1,8 @@
1
+ 1.0.5 / 2023-01-29
2
+ ==================
3
+
4
+ * perf: skip value escaping when unnecessary
5
+
1
6
  1.0.4 / 2017-09-11
2
7
  ==================
3
8
 
@@ -1,10 +1,10 @@
1
1
  # content-type
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
  Create and parse HTTP Content-Type header according to RFC 7231
10
10
 
@@ -26,7 +26,7 @@ var contentType = require('content-type')
26
26
  var obj = contentType.parse('image/svg+xml; charset=utf-8')
27
27
  ```
28
28
 
29
- Parse a content type string. This will return an object with the following
29
+ Parse a `Content-Type` header. This will return an object with the following
30
30
  properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
31
31
 
32
32
  - `type`: The media type (the type and subtype, always lower case).
@@ -43,7 +43,7 @@ Throws a `TypeError` if the string is missing or invalid.
43
43
  var obj = contentType.parse(req)
44
44
  ```
45
45
 
46
- Parse the `content-type` header from the given `req`. Short-cut for
46
+ Parse the `Content-Type` header from the given `req`. Short-cut for
47
47
  `contentType.parse(req.headers['content-type'])`.
48
48
 
49
49
  Throws a `TypeError` if the `Content-Type` header is missing or invalid.
@@ -54,7 +54,7 @@ Throws a `TypeError` if the `Content-Type` header is missing or invalid.
54
54
  var obj = contentType.parse(res)
55
55
  ```
56
56
 
57
- Parse the `content-type` header set on the given `res`. Short-cut for
57
+ Parse the `Content-Type` header set on the given `res`. Short-cut for
58
58
  `contentType.parse(res.getHeader('content-type'))`.
59
59
 
60
60
  Throws a `TypeError` if the `Content-Type` header is missing or invalid.
@@ -62,10 +62,13 @@ Throws a `TypeError` if the `Content-Type` header is missing or invalid.
62
62
  ### contentType.format(obj)
63
63
 
64
64
  ```js
65
- var str = contentType.format({type: 'image/svg+xml'})
65
+ var str = contentType.format({
66
+ type: 'image/svg+xml',
67
+ parameters: { charset: 'utf-8' }
68
+ })
66
69
  ```
67
70
 
68
- Format an object into a content type string. This will return a string of the
71
+ Format an object into a `Content-Type` header. This will return a string of the
69
72
  content type for the given object with the following properties (examples are
70
73
  shown that produce the string `'image/svg+xml; charset=utf-8'`):
71
74
 
@@ -80,13 +83,12 @@ Throws a `TypeError` if the object contains an invalid type or parameter names.
80
83
 
81
84
  [MIT](LICENSE)
82
85
 
83
- [npm-image]: https://img.shields.io/npm/v/content-type.svg
86
+ [ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci
87
+ [ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml
88
+ [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master
89
+ [coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master
90
+ [node-image]: https://badgen.net/npm/node/content-type
91
+ [node-url]: https://nodejs.org/en/download
92
+ [npm-downloads-image]: https://badgen.net/npm/dm/content-type
84
93
  [npm-url]: https://npmjs.org/package/content-type
85
- [node-version-image]: https://img.shields.io/node/v/content-type.svg
86
- [node-version-url]: http://nodejs.org/download/
87
- [travis-image]: https://img.shields.io/travis/jshttp/content-type/master.svg
88
- [travis-url]: https://travis-ci.org/jshttp/content-type
89
- [coveralls-image]: https://img.shields.io/coveralls/jshttp/content-type/master.svg
90
- [coveralls-url]: https://coveralls.io/r/jshttp/content-type
91
- [downloads-image]: https://img.shields.io/npm/dm/content-type.svg
92
- [downloads-url]: https://npmjs.org/package/content-type
94
+ [npm-version-image]: https://badgen.net/npm/v/content-type