node-red-contrib-web-worldmap 2.23.5 → 2.24.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 (202) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +7 -1
  3. package/node_modules/body-parser/HISTORY.md +15 -0
  4. package/node_modules/body-parser/README.md +25 -12
  5. package/node_modules/body-parser/package.json +32 -35
  6. package/node_modules/{body-parser/node_modules/bytes → bytes}/History.md +5 -0
  7. package/node_modules/{body-parser/node_modules/bytes → bytes}/LICENSE +0 -0
  8. package/node_modules/{raw-body/node_modules/bytes → bytes}/Readme.md +42 -16
  9. package/node_modules/{raw-body/node_modules/bytes → bytes}/index.js +5 -1
  10. package/node_modules/{raw-body/node_modules/bytes → bytes}/package.json +20 -21
  11. package/node_modules/content-disposition/HISTORY.md +5 -0
  12. package/node_modules/content-disposition/README.md +3 -9
  13. package/node_modules/content-disposition/index.js +1 -1
  14. package/node_modules/content-disposition/node_modules/safe-buffer/LICENSE +21 -0
  15. package/node_modules/content-disposition/node_modules/safe-buffer/README.md +584 -0
  16. package/node_modules/content-disposition/node_modules/safe-buffer/index.d.ts +187 -0
  17. package/node_modules/content-disposition/node_modules/safe-buffer/index.js +65 -0
  18. package/node_modules/content-disposition/node_modules/safe-buffer/package.json +76 -0
  19. package/node_modules/content-disposition/package.json +25 -28
  20. package/node_modules/cookie/HISTORY.md +5 -0
  21. package/node_modules/cookie/README.md +4 -0
  22. package/node_modules/cookie/index.js +5 -1
  23. package/node_modules/cookie/package.json +20 -23
  24. package/node_modules/express/History.md +33 -0
  25. package/node_modules/express/Readme.md +8 -5
  26. package/node_modules/express/lib/application.js +1 -1
  27. package/node_modules/express/lib/request.js +1 -1
  28. package/node_modules/express/lib/response.js +16 -11
  29. package/node_modules/express/lib/router/index.js +6 -0
  30. package/node_modules/express/lib/utils.js +2 -6
  31. package/node_modules/express/node_modules/safe-buffer/LICENSE +21 -0
  32. package/node_modules/express/node_modules/safe-buffer/README.md +584 -0
  33. package/node_modules/express/node_modules/safe-buffer/index.d.ts +187 -0
  34. package/node_modules/express/node_modules/safe-buffer/index.js +65 -0
  35. package/node_modules/express/node_modules/safe-buffer/package.json +76 -0
  36. package/node_modules/express/package.json +35 -36
  37. package/node_modules/faye-websocket/CHANGELOG.md +5 -0
  38. package/node_modules/faye-websocket/LICENSE.md +1 -1
  39. package/node_modules/faye-websocket/README.md +13 -13
  40. package/node_modules/faye-websocket/lib/faye/websocket/api.js +10 -8
  41. package/node_modules/faye-websocket/lib/faye/websocket/client.js +4 -4
  42. package/node_modules/faye-websocket/lib/faye/websocket.js +1 -1
  43. package/node_modules/faye-websocket/package.json +14 -17
  44. package/node_modules/forwarded/HISTORY.md +5 -0
  45. package/node_modules/forwarded/README.md +3 -3
  46. package/node_modules/forwarded/index.js +15 -1
  47. package/node_modules/forwarded/package.json +25 -26
  48. package/node_modules/http-errors/HISTORY.md +16 -0
  49. package/node_modules/http-errors/README.md +12 -6
  50. package/node_modules/http-errors/index.js +35 -2
  51. package/node_modules/http-errors/package.json +28 -31
  52. package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/LICENSE.md +0 -0
  53. package/node_modules/http-parser-js/README.md +39 -0
  54. package/node_modules/http-parser-js/http-parser.d.ts +175 -0
  55. package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/http-parser.js +8 -5
  56. package/node_modules/{websocket-driver/node_modules/http-parser-js → http-parser-js}/package.json +17 -19
  57. package/node_modules/inherits/inherits.js +2 -0
  58. package/node_modules/inherits/inherits_browser.js +18 -14
  59. package/node_modules/inherits/package.json +15 -18
  60. package/node_modules/ipaddr.js/README.md +1 -1
  61. package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +6 -9
  62. package/node_modules/ipaddr.js/package.json +15 -17
  63. package/node_modules/proxy-addr/HISTORY.md +11 -0
  64. package/node_modules/proxy-addr/README.md +3 -19
  65. package/node_modules/proxy-addr/index.js +1 -1
  66. package/node_modules/proxy-addr/package.json +28 -31
  67. package/node_modules/qs/.editorconfig +9 -0
  68. package/node_modules/qs/.eslintignore +2 -1
  69. package/node_modules/qs/.eslintrc +15 -1
  70. package/node_modules/qs/.github/FUNDING.yml +12 -0
  71. package/node_modules/qs/.nycrc +13 -0
  72. package/node_modules/qs/CHANGELOG.md +103 -0
  73. package/node_modules/qs/LICENSE.md +29 -0
  74. package/node_modules/qs/README.md +34 -0
  75. package/node_modules/qs/dist/qs.js +117 -67
  76. package/node_modules/qs/lib/formats.js +9 -4
  77. package/node_modules/qs/lib/parse.js +29 -14
  78. package/node_modules/qs/lib/stringify.js +55 -46
  79. package/node_modules/qs/lib/utils.js +23 -2
  80. package/node_modules/qs/package.json +39 -31
  81. package/node_modules/qs/test/parse.js +97 -1
  82. package/node_modules/qs/test/stringify.js +115 -1
  83. package/node_modules/qs/test/utils.js +1 -1
  84. package/node_modules/raw-body/HISTORY.md +14 -0
  85. package/node_modules/raw-body/README.md +3 -5
  86. package/node_modules/raw-body/package.json +30 -33
  87. package/node_modules/send/HISTORY.md +10 -0
  88. package/node_modules/send/README.md +4 -6
  89. package/node_modules/send/index.js +7 -3
  90. package/node_modules/send/node_modules/ms/index.js +3 -3
  91. package/node_modules/send/node_modules/ms/license.md +1 -1
  92. package/node_modules/send/node_modules/ms/package.json +19 -21
  93. package/node_modules/send/node_modules/ms/readme.md +1 -2
  94. package/node_modules/send/package.json +28 -31
  95. package/node_modules/serve-static/HISTORY.md +8 -0
  96. package/node_modules/serve-static/README.md +9 -11
  97. package/node_modules/serve-static/package.json +28 -31
  98. package/node_modules/setprototypeof/README.md +1 -1
  99. package/node_modules/setprototypeof/index.js +1 -1
  100. package/node_modules/setprototypeof/package.json +17 -18
  101. package/node_modules/sockjs/Changelog +12 -0
  102. package/node_modules/sockjs/lib/transport.js +1 -1
  103. package/node_modules/sockjs/package.json +14 -16
  104. package/node_modules/toidentifier/HISTORY.md +9 -0
  105. package/node_modules/toidentifier/README.md +3 -3
  106. package/node_modules/toidentifier/index.js +2 -0
  107. package/node_modules/toidentifier/package.json +28 -27
  108. package/node_modules/uuid/CHANGELOG.md +154 -44
  109. package/node_modules/uuid/CONTRIBUTING.md +18 -0
  110. package/node_modules/uuid/LICENSE.md +4 -16
  111. package/node_modules/uuid/README.md +384 -155
  112. package/node_modules/uuid/dist/bin/uuid +2 -0
  113. package/node_modules/uuid/dist/esm-browser/index.js +9 -0
  114. package/node_modules/uuid/{lib/md5-browser.js → dist/esm-browser/md5.js} +70 -71
  115. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  116. package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  117. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  118. package/node_modules/uuid/dist/esm-browser/rng.js +19 -0
  119. package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  120. package/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
  121. package/node_modules/uuid/{v1.js → dist/esm-browser/v1.js} +36 -50
  122. package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
  123. package/node_modules/uuid/dist/esm-browser/v35.js +64 -0
  124. package/node_modules/uuid/dist/esm-browser/v4.js +24 -0
  125. package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
  126. package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  127. package/node_modules/uuid/dist/esm-browser/version.js +11 -0
  128. package/node_modules/uuid/dist/esm-node/index.js +9 -0
  129. package/node_modules/uuid/dist/esm-node/md5.js +13 -0
  130. package/node_modules/uuid/dist/esm-node/nil.js +1 -0
  131. package/node_modules/uuid/dist/esm-node/parse.js +35 -0
  132. package/node_modules/uuid/dist/esm-node/regex.js +1 -0
  133. package/node_modules/uuid/dist/esm-node/rng.js +12 -0
  134. package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
  135. package/node_modules/uuid/dist/esm-node/stringify.js +29 -0
  136. package/node_modules/uuid/dist/esm-node/v1.js +95 -0
  137. package/node_modules/uuid/dist/esm-node/v3.js +4 -0
  138. package/node_modules/uuid/dist/esm-node/v35.js +64 -0
  139. package/node_modules/uuid/dist/esm-node/v4.js +24 -0
  140. package/node_modules/uuid/dist/esm-node/v5.js +4 -0
  141. package/node_modules/uuid/dist/esm-node/validate.js +7 -0
  142. package/node_modules/uuid/dist/esm-node/version.js +11 -0
  143. package/node_modules/uuid/dist/index.js +79 -0
  144. package/node_modules/uuid/dist/md5-browser.js +223 -0
  145. package/node_modules/uuid/dist/md5.js +23 -0
  146. package/node_modules/uuid/dist/nil.js +8 -0
  147. package/node_modules/uuid/dist/parse.js +45 -0
  148. package/node_modules/uuid/dist/regex.js +8 -0
  149. package/node_modules/uuid/dist/rng-browser.js +26 -0
  150. package/node_modules/uuid/dist/rng.js +24 -0
  151. package/node_modules/uuid/dist/sha1-browser.js +104 -0
  152. package/node_modules/uuid/dist/sha1.js +23 -0
  153. package/node_modules/uuid/dist/stringify.js +39 -0
  154. package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
  155. package/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
  156. package/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
  157. package/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
  158. package/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
  159. package/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
  160. package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
  161. package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
  162. package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
  163. package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
  164. package/node_modules/uuid/dist/uuid-bin.js +85 -0
  165. package/node_modules/uuid/dist/v1.js +107 -0
  166. package/node_modules/uuid/dist/v3.js +16 -0
  167. package/node_modules/uuid/dist/v35.js +78 -0
  168. package/node_modules/uuid/dist/v4.js +37 -0
  169. package/node_modules/uuid/dist/v5.js +16 -0
  170. package/node_modules/uuid/dist/validate.js +17 -0
  171. package/node_modules/uuid/dist/version.js +21 -0
  172. package/node_modules/uuid/package.json +116 -55
  173. package/node_modules/uuid/wrapper.mjs +10 -0
  174. package/package.json +3 -3
  175. package/worldmap/index.html +1 -0
  176. package/worldmap/leaflet/leaflet-arc.min.js +1 -0
  177. package/worldmap/worldmap.js +36 -22
  178. package/worldmap.html +1 -1
  179. package/worldmap.js +2 -2
  180. package/node_modules/body-parser/node_modules/bytes/Readme.md +0 -126
  181. package/node_modules/body-parser/node_modules/bytes/index.js +0 -162
  182. package/node_modules/body-parser/node_modules/bytes/package.json +0 -86
  183. package/node_modules/qs/LICENSE +0 -28
  184. package/node_modules/qs/test/.eslintrc +0 -17
  185. package/node_modules/qs/test/index.js +0 -7
  186. package/node_modules/raw-body/node_modules/bytes/History.md +0 -87
  187. package/node_modules/raw-body/node_modules/bytes/LICENSE +0 -23
  188. package/node_modules/uuid/AUTHORS +0 -5
  189. package/node_modules/uuid/bin/uuid +0 -65
  190. package/node_modules/uuid/index.js +0 -8
  191. package/node_modules/uuid/lib/bytesToUuid.js +0 -26
  192. package/node_modules/uuid/lib/md5.js +0 -25
  193. package/node_modules/uuid/lib/rng-browser.js +0 -34
  194. package/node_modules/uuid/lib/rng.js +0 -8
  195. package/node_modules/uuid/lib/sha1-browser.js +0 -89
  196. package/node_modules/uuid/lib/sha1.js +0 -25
  197. package/node_modules/uuid/lib/v35.js +0 -57
  198. package/node_modules/uuid/v3.js +0 -4
  199. package/node_modules/uuid/v4.js +0 -29
  200. package/node_modules/uuid/v5.js +0 -3
  201. package/node_modules/websocket-driver/node_modules/http-parser-js/CHANGELOG.md +0 -14
  202. package/node_modules/websocket-driver/node_modules/http-parser-js/README.md +0 -31
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _rng = _interopRequireDefault(require("./rng.js"));
9
+
10
+ var _stringify = _interopRequireDefault(require("./stringify.js"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function v4(options, buf, offset) {
15
+ options = options || {};
16
+
17
+ const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
18
+
19
+
20
+ rnds[6] = rnds[6] & 0x0f | 0x40;
21
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
22
+
23
+ if (buf) {
24
+ offset = offset || 0;
25
+
26
+ for (let i = 0; i < 16; ++i) {
27
+ buf[offset + i] = rnds[i];
28
+ }
29
+
30
+ return buf;
31
+ }
32
+
33
+ return (0, _stringify.default)(rnds);
34
+ }
35
+
36
+ var _default = v4;
37
+ exports.default = _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _v = _interopRequireDefault(require("./v35.js"));
9
+
10
+ var _sha = _interopRequireDefault(require("./sha1.js"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const v5 = (0, _v.default)('v5', 0x50, _sha.default);
15
+ var _default = v5;
16
+ exports.default = _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _regex = _interopRequireDefault(require("./regex.js"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function validate(uuid) {
13
+ return typeof uuid === 'string' && _regex.default.test(uuid);
14
+ }
15
+
16
+ var _default = validate;
17
+ exports.default = _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _validate = _interopRequireDefault(require("./validate.js"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function version(uuid) {
13
+ if (!(0, _validate.default)(uuid)) {
14
+ throw TypeError('Invalid UUID');
15
+ }
16
+
17
+ return parseInt(uuid.substr(14, 1), 16);
18
+ }
19
+
20
+ var _default = version;
21
+ exports.default = _default;
@@ -1,84 +1,100 @@
1
1
  {
2
- "_args": [
3
- [
4
- "uuid@3.4.0",
5
- "/Users/conway/Projects/worldmap"
6
- ]
7
- ],
8
- "_from": "uuid@3.4.0",
9
- "_id": "uuid@3.4.0",
2
+ "_from": "uuid@^8.3.2",
3
+ "_id": "uuid@8.3.2",
10
4
  "_inBundle": false,
11
- "_integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
5
+ "_integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
12
6
  "_location": "/uuid",
13
7
  "_phantomChildren": {},
14
8
  "_requested": {
15
- "type": "version",
9
+ "type": "range",
16
10
  "registry": true,
17
- "raw": "uuid@3.4.0",
11
+ "raw": "uuid@^8.3.2",
18
12
  "name": "uuid",
19
13
  "escapedName": "uuid",
20
- "rawSpec": "3.4.0",
14
+ "rawSpec": "^8.3.2",
21
15
  "saveSpec": null,
22
- "fetchSpec": "3.4.0"
16
+ "fetchSpec": "^8.3.2"
23
17
  },
24
18
  "_requiredBy": [
25
19
  "/sockjs"
26
20
  ],
27
- "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
28
- "_spec": "3.4.0",
29
- "_where": "/Users/conway/Projects/worldmap",
21
+ "_resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
22
+ "_shasum": "80d5b5ced271bb9af6c445f21a1a04c606cefbe2",
23
+ "_spec": "uuid@^8.3.2",
24
+ "_where": "/Users/conway/Projects/worldmap/node_modules/sockjs",
30
25
  "bin": {
31
- "uuid": "bin/uuid"
26
+ "uuid": "dist/bin/uuid"
32
27
  },
33
28
  "browser": {
34
- "./lib/rng.js": "./lib/rng-browser.js",
35
- "./lib/sha1.js": "./lib/sha1-browser.js",
36
- "./lib/md5.js": "./lib/md5-browser.js"
29
+ "./dist/md5.js": "./dist/md5-browser.js",
30
+ "./dist/rng.js": "./dist/rng-browser.js",
31
+ "./dist/sha1.js": "./dist/sha1-browser.js",
32
+ "./dist/esm-node/index.js": "./dist/esm-browser/index.js"
37
33
  },
38
34
  "bugs": {
39
35
  "url": "https://github.com/uuidjs/uuid/issues"
40
36
  },
37
+ "bundleDependencies": false,
41
38
  "commitlint": {
42
39
  "extends": [
43
40
  "@commitlint/config-conventional"
44
41
  ]
45
42
  },
46
- "contributors": [
47
- {
48
- "name": "Robert Kieffer",
49
- "email": "robert@broofa.com"
50
- },
51
- {
52
- "name": "Christoph Tavan",
53
- "email": "dev@tavan.de"
54
- },
55
- {
56
- "name": "AJ ONeal",
57
- "email": "coolaj86@gmail.com"
58
- },
59
- {
60
- "name": "Vincent Voyer",
61
- "email": "vincent@zeroload.net"
62
- },
63
- {
64
- "name": "Roman Shtylman",
65
- "email": "shtylman@gmail.com"
66
- }
67
- ],
43
+ "deprecated": false,
68
44
  "description": "RFC4122 (v1, v4, and v5) UUIDs",
69
45
  "devDependencies": {
70
- "@commitlint/cli": "~8.2.0",
71
- "@commitlint/config-conventional": "~8.2.0",
72
- "eslint": "~6.4.0",
73
- "husky": "~3.0.5",
74
- "mocha": "6.2.0",
75
- "runmd": "1.2.1",
76
- "standard-version": "7.0.0"
46
+ "@babel/cli": "7.11.6",
47
+ "@babel/core": "7.11.6",
48
+ "@babel/preset-env": "7.11.5",
49
+ "@commitlint/cli": "11.0.0",
50
+ "@commitlint/config-conventional": "11.0.0",
51
+ "@rollup/plugin-node-resolve": "9.0.0",
52
+ "babel-eslint": "10.1.0",
53
+ "bundlewatch": "0.3.1",
54
+ "eslint": "7.10.0",
55
+ "eslint-config-prettier": "6.12.0",
56
+ "eslint-config-standard": "14.1.1",
57
+ "eslint-plugin-import": "2.22.1",
58
+ "eslint-plugin-node": "11.1.0",
59
+ "eslint-plugin-prettier": "3.1.4",
60
+ "eslint-plugin-promise": "4.2.1",
61
+ "eslint-plugin-standard": "4.0.1",
62
+ "husky": "4.3.0",
63
+ "jest": "25.5.4",
64
+ "lint-staged": "10.4.0",
65
+ "npm-run-all": "4.1.5",
66
+ "optional-dev-dependency": "2.0.1",
67
+ "prettier": "2.1.2",
68
+ "random-seed": "0.3.0",
69
+ "rollup": "2.28.2",
70
+ "rollup-plugin-terser": "7.0.2",
71
+ "runmd": "1.3.2",
72
+ "standard-version": "9.0.0"
77
73
  },
74
+ "exports": {
75
+ ".": {
76
+ "node": {
77
+ "module": "./dist/esm-node/index.js",
78
+ "require": "./dist/index.js",
79
+ "import": "./wrapper.mjs"
80
+ },
81
+ "default": "./dist/esm-browser/index.js"
82
+ },
83
+ "./package.json": "./package.json"
84
+ },
85
+ "files": [
86
+ "CHANGELOG.md",
87
+ "CONTRIBUTING.md",
88
+ "LICENSE.md",
89
+ "README.md",
90
+ "dist",
91
+ "wrapper.mjs"
92
+ ],
78
93
  "homepage": "https://github.com/uuidjs/uuid#readme",
79
94
  "husky": {
80
95
  "hooks": {
81
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
96
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
97
+ "pre-commit": "lint-staged"
82
98
  }
83
99
  },
84
100
  "keywords": [
@@ -87,17 +103,62 @@
87
103
  "rfc4122"
88
104
  ],
89
105
  "license": "MIT",
106
+ "lint-staged": {
107
+ "*.{js,jsx,json,md}": [
108
+ "prettier --write"
109
+ ],
110
+ "*.{js,jsx}": [
111
+ "eslint --fix"
112
+ ]
113
+ },
114
+ "main": "./dist/index.js",
115
+ "module": "./dist/esm-node/index.js",
90
116
  "name": "uuid",
117
+ "optionalDevDependencies": {
118
+ "@wdio/browserstack-service": "6.4.0",
119
+ "@wdio/cli": "6.4.0",
120
+ "@wdio/jasmine-framework": "6.4.0",
121
+ "@wdio/local-runner": "6.4.0",
122
+ "@wdio/spec-reporter": "6.4.0",
123
+ "@wdio/static-server-service": "6.4.0",
124
+ "@wdio/sync": "6.4.0"
125
+ },
91
126
  "repository": {
92
127
  "type": "git",
93
128
  "url": "git+https://github.com/uuidjs/uuid.git"
94
129
  },
95
130
  "scripts": {
96
- "lint": "eslint .",
131
+ "build": "./scripts/build.sh",
132
+ "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json",
133
+ "docs": "( node --version | grep -q 'v12' ) && ( npm run build && runmd --output=README.md README_js.md )",
134
+ "docs:diff": "npm run docs && git diff --quiet README.md",
135
+ "eslint:check": "eslint src/ test/ examples/ *.js",
136
+ "eslint:fix": "eslint --fix src/ test/ examples/ *.js",
137
+ "examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build",
138
+ "examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build",
139
+ "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test",
140
+ "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test",
141
+ "lint": "npm run eslint:check && npm run prettier:check",
97
142
  "md": "runmd --watch --output=README.md README_js.md",
98
- "prepare": "runmd --output=README.md README_js.md",
99
- "release": "standard-version",
100
- "test": "npm run lint && mocha test/test.js"
143
+ "prepack": "npm run build",
144
+ "pretest": "[ -n $CI ] || npm run build",
145
+ "pretest:benchmark": "npm run build",
146
+ "pretest:browser": "optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**",
147
+ "pretest:node": "npm run build",
148
+ "prettier:check": "prettier --ignore-path .prettierignore --check '**/*.{js,jsx,json,md}'",
149
+ "prettier:fix": "prettier --ignore-path .prettierignore --write '**/*.{js,jsx,json,md}'",
150
+ "release": "standard-version --no-verify",
151
+ "test": "BABEL_ENV=commonjs node --throw-deprecation node_modules/.bin/jest test/unit/",
152
+ "test:benchmark": "cd examples/benchmark && npm install && npm test",
153
+ "test:browser": "wdio run ./wdio.conf.js",
154
+ "test:node": "npm-run-all --parallel examples:node:**",
155
+ "test:pack": "./scripts/testpack.sh"
156
+ },
157
+ "sideEffects": false,
158
+ "standard-version": {
159
+ "scripts": {
160
+ "postchangelog": "prettier --write CHANGELOG.md"
161
+ }
101
162
  },
102
- "version": "3.4.0"
163
+ "version": "8.3.2"
103
164
  }
@@ -0,0 +1,10 @@
1
+ import uuid from './dist/index.js';
2
+ export const v1 = uuid.v1;
3
+ export const v3 = uuid.v3;
4
+ export const v4 = uuid.v4;
5
+ export const v5 = uuid.v5;
6
+ export const NIL = uuid.NIL;
7
+ export const version = uuid.version;
8
+ export const validate = uuid.validate;
9
+ export const stringify = uuid.stringify;
10
+ export const parse = uuid.parse;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.23.5",
3
+ "version": "2.24.0",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~6.5.0",
7
7
  "cgi": "0.3.1",
8
8
  "compression": "^1.7.4",
9
- "express": "^4.16.4",
10
- "sockjs": "~0.3.21"
9
+ "express": "^4.17.2",
10
+ "sockjs": "~0.3.24"
11
11
  },
12
12
  "bundledDependencies": [
13
13
  "cgi",
@@ -72,6 +72,7 @@
72
72
  <script src="leaflet/leaflet.latlng-graticule.js"></script>
73
73
  <script src="leaflet/VectorTileLayer.umd.min.js"></script>
74
74
  <script src="leaflet/Semicircle.js"></script>
75
+ <script src='leaflet/leaflet-arc.min.js'></script>
75
76
  <script src="leaflet/L.TileLayer.PixelFilter.js"></script>
76
77
  <script src="leaflet/dialog-polyfill.js"></script>
77
78
 
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("leaflet-arc",[],e):"object"==typeof exports?exports["leaflet-arc"]=e():t["leaflet-arc"]=e()}(this,function(){return function(t){function e(o){if(r[o])return r[o].exports;var s=r[o]={exports:{},id:o,loaded:!1};return t[o].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!t.geometries[0]||!t.geometries[0].coords[0])return[];var r=function(){var r=e.lng-t.geometries[0].coords[0][0]-360;return{v:t.geometries.map(function(t){return r+=360,t.coords.map(function(t){return L.latLng([t[1],t[0]+r])})}).reduce(function(t,e){return t.concat(e)})}}();return"object"===("undefined"==typeof r?"undefined":n(r))?r.v:void 0}var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=r(2),h=o(a),p=function(t){return{x:t.lng,y:t.lat}};if(!L)throw new Error("Leaflet is not defined");L.Polyline.Arc=function(t,e,r){var o=L.latLng(t),n=L.latLng(e),a=i({vertices:10,offset:10},r),u=new h["default"].GreatCircle(p(o),p(n)),c=u.Arc(a.vertices,{offset:a.offset}),f=s(c,o);return L.polyline(f,a)}},function(t,e){"use strict";var r=Math.PI/180,o=180/Math.PI,s=function(t,e){this.lon=t,this.lat=e,this.x=r*t,this.y=r*e};s.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},s.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new s(e,t)};var i=function(){this.coords=[],this.length=0};i.prototype.move_to=function(t){this.length++,this.coords.push(t)};var n=function(t){this.properties=t||{},this.geometries=[]};n.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1==this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},n.prototype.wkt=function(){for(var t="",e="LINESTRING(",r=function(t){e+=t[0]+" "+t[1]+","},o=0;o<this.geometries.length;o++){if(0===this.geometries[o].coords.length)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(r),t+=e.substring(0,e.length-1)+")"}return t};var a=function(t,e,r){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new s(t.x,t.y),this.end=new s(e.x,e.y),this.properties=r||{};var o=this.start.x-this.end.x,i=this.start.y-this.end.y,n=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(n)),this.g==Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};if(a.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),r=Math.sin(t*this.g)/Math.sin(this.g),s=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),n=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),a=o*Math.atan2(n,Math.sqrt(Math.pow(s,2)+Math.pow(i,2))),h=o*Math.atan2(i,s);return[h,a]},a.prototype.Arc=function(t,e){var r=[];if(!t||t<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var o=1/(t-1),s=0;s<t;++s){var a=o*s,h=this.interpolate(a);r.push(h)}for(var p=!1,u=0,c=e&&e.offset?e.offset:10,f=180-c,l=-180+c,d=360-c,y=1;y<r.length;++y){var g=r[y-1][0],v=r[y][0],M=Math.abs(v-g);M>d&&(v>f&&g<l||g>f&&v<l)?p=!0:M>u&&(u=M)}var m=[];if(p&&u<c){var w=[];m.push(w);for(var x=0;x<r.length;++x){var b=parseFloat(r[x][0]);if(x>0&&Math.abs(b-r[x-1][0])>d){var L=parseFloat(r[x-1][0]),S=parseFloat(r[x-1][1]),j=parseFloat(r[x][0]),E=parseFloat(r[x][1]);if(L>-180&&L<l&&180==j&&x+1<r.length&&r[x-1][0]>-180&&r[x-1][0]<l){w.push([-180,r[x][1]]),x++,w.push([r[x][0],r[x][1]]);continue}if(L>f&&L<180&&j==-180&&x+1<r.length&&r[x-1][0]>f&&r[x-1][0]<180){w.push([180,r[x][1]]),x++,w.push([r[x][0],r[x][1]]);continue}if(L<l&&j>f){var F=L;L=j,j=F;var C=S;S=E,E=C}if(L>f&&j<l&&(j+=360),L<=180&&j>=180&&L<j){var G=(180-L)/(j-L),I=G*E+(1-G)*S;w.push([r[x-1][0]>f?180:-180,I]),w=[],w.push([r[x-1][0]>f?-180:180,I]),m.push(w)}else w=[],m.push(w);w.push([b,r[x][1]])}else w.push([r[x][0],r[x][1]])}}else{var N=[];m.push(N);for(var A=0;A<r.length;++A)N.push([r[A][0],r[A][1]])}for(var P=new n(this.properties),_=0;_<m.length;++_){var O=new i;P.geometries.push(O);for(var q=m[_],R=0;R<q.length;++R)O.move_to(q[R])}return P},"undefined"!=typeof t&&"undefined"!=typeof t.exports)t.exports.Coord=s,t.exports.Arc=n,t.exports.GreatCircle=a;else{var h={};h.Coord=s,h.Arc=n,h.GreatCircle=a}},function(t,e,r){"use strict";t.exports=r(1)}])});
@@ -30,8 +30,9 @@ var sidebyside;
30
30
  var layercontrol;
31
31
  var drawControl;
32
32
  var drawingColour = "#910000";
33
- var sendRoute;
34
33
  var sendDrawing;
34
+ var colorControl;
35
+ var sendRoute;
35
36
 
36
37
  var iconSz = {
37
38
  "Team/Crew": 24,
@@ -132,7 +133,7 @@ var handleData = function(data) {
132
133
 
133
134
  window.onunload = function() { if (ws) ws.close(); }
134
135
 
135
- var onoffline = function() { if (!navigator.onLine) map.addLayer(layers["_countries"]); }
136
+ var onoffline = function() { if (!navigator.onLine) { map.addLayer(layers["_countries"]); } }
136
137
 
137
138
  document.addEventListener ("keydown", function (ev) {
138
139
  // Set Ctl-Alt-3 to switch to 3d view
@@ -253,16 +254,6 @@ var menuButton = L.easyButton({states:[{icon:'fa-bars fa-lg', onClick:function()
253
254
  var fullscreenButton = L.control.fullscreen();
254
255
  var rulerButton = L.control.ruler({position:"topleft"});
255
256
 
256
- //var colorPickButton = L.easyButton({states:[{icon:'fa-tint fa-lg', onClick:function() { console.log("PICK"); }, title:'Pick Colour'}]});
257
- var redButton = L.easyButton('fa-square wm-red', function(btn) { changeDrawColour("#E7827F"); })
258
- var blueButton = L.easyButton('fa-square wm-blue', function(btn) { changeDrawColour("#94CCE2"); })
259
- var greenButton = L.easyButton('fa-square wm-green', function(btn) { changeDrawColour("#ACD6A4"); })
260
- var yellowButton = L.easyButton('fa-square wm-yellow', function(btn) { changeDrawColour("#F5F08B"); })
261
- var blackButton = L.easyButton('fa-square wm-black', function(btn) { changeDrawColour("#444444"); })
262
- var whiteButton = L.easyButton('fa-square wm-white', function(btn) { changeDrawColour("#EEEEEE"); })
263
- var colorControl = L.easyBar([redButton,blueButton,greenButton,yellowButton,blackButton,whiteButton]);
264
-
265
-
266
257
  function onLocationFound(e) {
267
258
  var radius = e.accuracy;
268
259
  //L.marker(e.latlng).addTo(map).bindPopup("You are within " + radius + " meters from this point").openPopup();
@@ -658,7 +649,7 @@ map.on('moveend', function() {
658
649
  // single right click to add a marker
659
650
  var addmenu = "<b>Add marker</b><br><input type='text' id='rinput' autofocus onkeydown='if (event.keyCode == 13) addThing();' placeholder='name (,icon/SIDC, layer, colour, heading)'/>";
660
651
  if (navigator.onLine) { addmenu += '<br/><a href="https://spatialillusions.com/unitgenerator/" target="_new">MilSymbol SIDC generator</a>'; }
661
- var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent(addmenu);
652
+ var rightmenuMap = L.popup({keepInView:true, minWidth:260}).setContent(addmenu);
662
653
 
663
654
  var rclk = {};
664
655
  var hiderightclick = false;
@@ -744,9 +735,10 @@ var addBaseMaps = function(maplist,first) {
744
735
  //console.log("MAPS",first,maplist)
745
736
  if (navigator.onLine) {
746
737
  var layerlookup = { OSMG:"OSM grey", OSMC:"OSM", OSMH:"OSM Humanitarian", EsriC:"Esri", EsriS:"Esri Satellite",
747
- EsriR:"Esri Relief", EsriT:"Esri Topography", EsriO:"Esri Ocean", EsriDG:"Esri Dark Grey", NatGeo: "National Geographic",
748
- UKOS:"UK OS OpenData", UKOS45:"UK OS 1919-1947", UKOS00:"UK OS 1900", OpTop:"Open Topo Map",
749
- HB:"Hike Bike OSM", ST:"Stamen Topography", SW: "Stamen Watercolor", AN:"AutoNavi (Chinese)" }
738
+ EsriR:"Esri Relief", EsriT:"Esri Topography", EsriO:"Esri Ocean", EsriDG:"Esri Dark Grey", NatGeo: "National Geographic",
739
+ UKOS:"UK OS OpenData", UKOS45:"UK OS 1919-1947", UKOS00:"UK OS 1900", OpTop:"Open Topo Map",
740
+ HB:"Hike Bike OSM", ST:"Stamen Topography", SW: "Stamen Watercolor", AN:"AutoNavi (Chinese)"
741
+ }
750
742
 
751
743
  // Use this for OSM online maps
752
744
  var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
@@ -874,7 +866,7 @@ var addBaseMaps = function(maplist,first) {
874
866
 
875
867
  if (maplist.indexOf("OS00")!==-1) {
876
868
  //var NLS_OS_1900 = L.tileLayer('https://nls-{s}.tileserver.com/NLS_API/{z}/{x}/{y}.jpg', {
877
- basemaps[layerlookup["OS00"]] = L.tileLayer('https://nls-{s}.tileserver.com/fpsUZbzrfb5d/{z}/{x}/{y}.jpg', {
869
+ basemaps[layerlookup["OS00"]] = L.tileLayer('https://nls-{s}.tileserver.com/fpsUZbzrfb5d/{z}/{x}/{y}.jpg', {
878
870
  attribution: '<a href="https://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
879
871
  bounds: [[49.6, -12], [61.7, 3]],
880
872
  minZoom:1, maxNativeZoom:19, maxZoom:20,
@@ -929,6 +921,15 @@ var addOverlays = function(overlist) {
929
921
 
930
922
  // Add the drawing layer...
931
923
  if (overlist.indexOf("DR")!==-1) {
924
+ //var colorPickButton = L.easyButton({states:[{icon:'fa-tint fa-lg', onClick:function() { console.log("PICK"); }, title:'Pick Colour'}]});
925
+ var redButton = L.easyButton('fa-square wm-red', function(btn) { changeDrawColour("#E7827F"); })
926
+ var blueButton = L.easyButton('fa-square wm-blue', function(btn) { changeDrawColour("#94CCE2"); })
927
+ var greenButton = L.easyButton('fa-square wm-green', function(btn) { changeDrawColour("#ACD6A4"); })
928
+ var yellowButton = L.easyButton('fa-square wm-yellow', function(btn) { changeDrawColour("#F5F08B"); })
929
+ var blackButton = L.easyButton('fa-square wm-black', function(btn) { changeDrawColour("#444444"); })
930
+ var whiteButton = L.easyButton('fa-square wm-white', function(btn) { changeDrawColour("#EEEEEE"); })
931
+ colorControl = L.easyBar([redButton,blueButton,greenButton,yellowButton,blackButton,whiteButton]);
932
+
932
933
  layers["_drawing"] = new L.FeatureGroup();
933
934
  overlays["drawing"] = layers["_drawing"];
934
935
  map.options.drawControlTooltips = false;
@@ -951,11 +952,13 @@ var addOverlays = function(overlist) {
951
952
  // }
952
953
  });
953
954
  var changeDrawColour = function(col) {
955
+ drawingColour = col;
956
+ console.log("COL",col)
954
957
  drawControl.setDrawingOptions({
955
- polyline: { shapeOptions: { color:col } },
956
- circle: { shapeOptions: { color:col } },
957
- rectangle: { shapeOptions: { color:col } },
958
- polygon: { shapeOptions: { color:col } }
958
+ polyline: { shapeOptions: { color:drawingColour } },
959
+ circle: { shapeOptions: { color:drawingColour } },
960
+ rectangle: { shapeOptions: { color:drawingColour } },
961
+ polygon: { shapeOptions: { color:drawingColour } }
959
962
  });
960
963
  }
961
964
  var shape;
@@ -1188,7 +1191,7 @@ var addOverlays = function(overlist) {
1188
1191
 
1189
1192
  // Layer control based on select box rather than radio buttons.
1190
1193
  //var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map);
1191
- var layercontrol = L.control.layers(basemaps, overlays);
1194
+ layercontrol = L.control.layers(basemaps, overlays);
1192
1195
 
1193
1196
  // Add the layers control widget
1194
1197
  if (!inIframe) { layercontrol.addTo(map); }
@@ -1441,6 +1444,17 @@ function setMarker(data) {
1441
1444
  map.fitBounds(polygons[data.name].getBounds(),{padding:[50,50]})
1442
1445
  }
1443
1446
  }
1447
+ if (data.hasOwnProperty("greatcircle") && Array.isArray(data.greatcircle) && data.greatcircle.length === 2) {
1448
+ delete opt.fill;
1449
+ opt.vertices = 500;
1450
+ if (!data.hasOwnProperty("weight")) { opt.weight = 3; } //Standard settings different for lines
1451
+ if (!data.hasOwnProperty("opacity")) { opt.opacity = 0.8; }
1452
+ var greatc = L.Polyline.Arc(data.greatcircle[0], data.greatcircle[1], opt);
1453
+ polygons[data.name] = rightmenu(greatc);
1454
+ if (data.hasOwnProperty("fit") && data.fit === true) {
1455
+ map.fitBounds(polygons[data.name].getBounds(),{padding:[50,50]})
1456
+ }
1457
+ }
1444
1458
  else if (data.hasOwnProperty("sdlat") && data.hasOwnProperty("sdlon")) {
1445
1459
  if (!data.hasOwnProperty("iconColor")) { opt.color = "blue"; } //different standard Color Settings
1446
1460
  if (!data.hasOwnProperty("fillColor")) { opt.fillColor = "blue"; }
package/worldmap.html CHANGED
@@ -438,7 +438,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
438
438
  }
439
439
  });
440
440
 
441
- $.get('/-ui-worldmap', function (data) {
441
+ $.get('-ui-worldmap', function (data) {
442
442
  if (data === "true") {
443
443
  RED.nodes.registerType('ui_worldmap',{
444
444
  category: 'dashboard',
package/worldmap.js CHANGED
@@ -153,7 +153,7 @@ module.exports = function(RED) {
153
153
  var size = ui.getSizes();
154
154
  var frameWidth = (size.sx + size.cx) * width - size.cx;
155
155
  var frameHeight = (size.sy + size.cy) * height - size.cy;
156
- var url = encodeURI(config.path);
156
+ var url = encodeURI(path.posix.join(RED.settings.httpNodeRoot||RED.settings.httpRoot,config.path));
157
157
  var html = `<style>.nr-dashboard-ui_worldmap{padding:0;}</style><div style="overflow:hidden;">
158
158
  <iframe src="${url}" width="${frameWidth}px" height="${frameHeight}px" style="border:none;"></iframe></div>`;
159
159
  return html;
@@ -525,7 +525,7 @@ module.exports = function(RED) {
525
525
  }
526
526
  RED.nodes.registerType("worldmap-hull",WorldMapHull);
527
527
 
528
- RED.httpNode.get("/-ui-worldmap", function(req, res) {
528
+ RED.httpAdmin.get("/-ui-worldmap", RED.auth.needsPermission('rpi-ui-worldmap.read'), function(req, res) {
529
529
  res.send(ui ? "true": "false");
530
530
  });
531
531
  }
@@ -1,126 +0,0 @@
1
- # Bytes utility
2
-
3
- [![NPM Version][npm-image]][npm-url]
4
- [![NPM Downloads][downloads-image]][downloads-url]
5
- [![Build Status][travis-image]][travis-url]
6
- [![Test Coverage][coveralls-image]][coveralls-url]
7
-
8
- Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
9
-
10
- ## Installation
11
-
12
- This is a [Node.js](https://nodejs.org/en/) module available through the
13
- [npm registry](https://www.npmjs.com/). Installation is done using the
14
- [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
15
-
16
- ```bash
17
- $ npm install bytes
18
- ```
19
-
20
- ## Usage
21
-
22
- ```js
23
- var bytes = require('bytes');
24
- ```
25
-
26
- #### bytes.format(number value, [options]): string|null
27
-
28
- Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
29
- rounded.
30
-
31
- **Arguments**
32
-
33
- | Name | Type | Description |
34
- |---------|----------|--------------------|
35
- | value | `number` | Value in bytes |
36
- | options | `Object` | Conversion options |
37
-
38
- **Options**
39
-
40
- | Property | Type | Description |
41
- |-------------------|--------|-----------------------------------------------------------------------------------------|
42
- | decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
43
- | fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
44
- | thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `''`. |
45
- | unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
46
- | unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
47
-
48
- **Returns**
49
-
50
- | Name | Type | Description |
51
- |---------|------------------|-------------------------------------------------|
52
- | results | `string`|`null` | Return null upon error. String value otherwise. |
53
-
54
- **Example**
55
-
56
- ```js
57
- bytes(1024);
58
- // output: '1KB'
59
-
60
- bytes(1000);
61
- // output: '1000B'
62
-
63
- bytes(1000, {thousandsSeparator: ' '});
64
- // output: '1 000B'
65
-
66
- bytes(1024 * 1.7, {decimalPlaces: 0});
67
- // output: '2KB'
68
-
69
- bytes(1024, {unitSeparator: ' '});
70
- // output: '1 KB'
71
-
72
- ```
73
-
74
- #### bytes.parse(string|number value): number|null
75
-
76
- Parse the string value into an integer in bytes. If no unit is given, or `value`
77
- is a number, it is assumed the value is in bytes.
78
-
79
- Supported units and abbreviations are as follows and are case-insensitive:
80
-
81
- * `b` for bytes
82
- * `kb` for kilobytes
83
- * `mb` for megabytes
84
- * `gb` for gigabytes
85
- * `tb` for terabytes
86
- * `pb` for petabytes
87
-
88
- The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
89
-
90
- **Arguments**
91
-
92
- | Name | Type | Description |
93
- |---------------|--------|--------------------|
94
- | value | `string`|`number` | String to parse, or number in bytes. |
95
-
96
- **Returns**
97
-
98
- | Name | Type | Description |
99
- |---------|-------------|-------------------------|
100
- | results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
101
-
102
- **Example**
103
-
104
- ```js
105
- bytes('1KB');
106
- // output: 1024
107
-
108
- bytes('1024');
109
- // output: 1024
110
-
111
- bytes(1024);
112
- // output: 1KB
113
- ```
114
-
115
- ## License
116
-
117
- [MIT](LICENSE)
118
-
119
- [coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
120
- [coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
121
- [downloads-image]: https://badgen.net/npm/dm/bytes
122
- [downloads-url]: https://npmjs.org/package/bytes
123
- [npm-image]: https://badgen.net/npm/node/bytes
124
- [npm-url]: https://npmjs.org/package/bytes
125
- [travis-image]: https://badgen.net/travis/visionmedia/bytes.js/master
126
- [travis-url]: https://travis-ci.org/visionmedia/bytes.js