styled-map-package 4.0.1 → 4.1.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 (189) hide show
  1. package/bin/smp-download.js +1 -1
  2. package/bin/smp-view.js +32 -23
  3. package/dist/download.d.cts +1 -1
  4. package/dist/download.d.ts +1 -1
  5. package/dist/index.d.cts +2 -2
  6. package/dist/index.d.ts +2 -2
  7. package/dist/reader-watch.d.cts +1 -1
  8. package/dist/reader-watch.d.ts +1 -1
  9. package/dist/reader.cjs +2 -1
  10. package/dist/reader.d.cts +1 -1
  11. package/dist/reader.d.ts +1 -1
  12. package/dist/reader.js +2 -1
  13. package/dist/server.d.cts +1 -1
  14. package/dist/server.d.ts +1 -1
  15. package/dist/style-downloader.cjs +2 -2
  16. package/dist/style-downloader.d.cts +1 -1
  17. package/dist/style-downloader.d.ts +1 -1
  18. package/dist/style-downloader.js +2 -2
  19. package/dist/tile-downloader.cjs +2 -2
  20. package/dist/tile-downloader.d.cts +1 -1
  21. package/dist/tile-downloader.d.ts +1 -1
  22. package/dist/tile-downloader.js +2 -2
  23. package/dist/{types-B4Xn1F9K.d.cts → types-yLQy3AKR.d.cts} +6 -3
  24. package/dist/{types-B4Xn1F9K.d.ts → types-yLQy3AKR.d.ts} +6 -3
  25. package/dist/utils/file-formats.d.cts +1 -1
  26. package/dist/utils/file-formats.d.ts +1 -1
  27. package/dist/utils/style.cjs +2 -2
  28. package/dist/utils/style.d.cts +1 -1
  29. package/dist/utils/style.d.ts +1 -1
  30. package/dist/utils/style.js +2 -2
  31. package/dist/utils/templates.cjs +4 -0
  32. package/dist/utils/templates.d.cts +4 -2
  33. package/dist/utils/templates.d.ts +4 -2
  34. package/dist/utils/templates.js +2 -0
  35. package/dist/writer.cjs +51 -3
  36. package/dist/writer.d.cts +1 -1
  37. package/dist/writer.d.ts +1 -1
  38. package/dist/writer.js +53 -3
  39. package/node_modules/@node-rs/crc32/LICENSE +21 -0
  40. package/node_modules/@node-rs/crc32/README.md +61 -0
  41. package/node_modules/@node-rs/crc32/browser.js +1 -0
  42. package/node_modules/@node-rs/crc32/index.d.ts +5 -0
  43. package/node_modules/@node-rs/crc32/index.js +368 -0
  44. package/node_modules/@node-rs/crc32/package.json +97 -0
  45. package/node_modules/@node-rs/crc32-linux-x64-gnu/README.md +3 -0
  46. package/node_modules/@node-rs/crc32-linux-x64-gnu/crc32.linux-x64-gnu.node +0 -0
  47. package/node_modules/@node-rs/crc32-linux-x64-gnu/package.json +43 -0
  48. package/node_modules/@node-rs/crc32-linux-x64-musl/README.md +3 -0
  49. package/node_modules/@node-rs/crc32-linux-x64-musl/crc32.linux-x64-musl.node +0 -0
  50. package/node_modules/@node-rs/crc32-linux-x64-musl/package.json +43 -0
  51. package/node_modules/define-data-property/.eslintrc +24 -0
  52. package/node_modules/define-data-property/.github/FUNDING.yml +12 -0
  53. package/node_modules/define-data-property/.nycrc +13 -0
  54. package/node_modules/define-data-property/CHANGELOG.md +70 -0
  55. package/node_modules/define-data-property/LICENSE +21 -0
  56. package/node_modules/define-data-property/README.md +67 -0
  57. package/node_modules/define-data-property/index.d.ts +12 -0
  58. package/node_modules/define-data-property/index.js +56 -0
  59. package/node_modules/define-data-property/package.json +106 -0
  60. package/node_modules/define-data-property/test/index.js +392 -0
  61. package/node_modules/define-data-property/tsconfig.json +59 -0
  62. package/node_modules/define-properties/.editorconfig +13 -0
  63. package/node_modules/define-properties/.eslintrc +19 -0
  64. package/node_modules/define-properties/.github/FUNDING.yml +12 -0
  65. package/node_modules/define-properties/.nycrc +9 -0
  66. package/node_modules/define-properties/CHANGELOG.md +91 -0
  67. package/node_modules/define-properties/LICENSE +21 -0
  68. package/node_modules/define-properties/README.md +84 -0
  69. package/node_modules/define-properties/index.js +47 -0
  70. package/node_modules/define-properties/package.json +88 -0
  71. package/node_modules/es-define-property/.eslintrc +13 -0
  72. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  73. package/node_modules/es-define-property/.nycrc +9 -0
  74. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  75. package/node_modules/es-define-property/LICENSE +21 -0
  76. package/node_modules/es-define-property/README.md +49 -0
  77. package/node_modules/es-define-property/index.d.ts +3 -0
  78. package/node_modules/es-define-property/index.js +14 -0
  79. package/node_modules/es-define-property/package.json +81 -0
  80. package/node_modules/es-define-property/test/index.js +56 -0
  81. package/node_modules/es-define-property/tsconfig.json +10 -0
  82. package/node_modules/es-errors/.eslintrc +5 -0
  83. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  84. package/node_modules/es-errors/CHANGELOG.md +40 -0
  85. package/node_modules/es-errors/LICENSE +21 -0
  86. package/node_modules/es-errors/README.md +55 -0
  87. package/node_modules/es-errors/eval.d.ts +3 -0
  88. package/node_modules/es-errors/eval.js +4 -0
  89. package/node_modules/es-errors/index.d.ts +3 -0
  90. package/node_modules/es-errors/index.js +4 -0
  91. package/node_modules/es-errors/package.json +80 -0
  92. package/node_modules/es-errors/range.d.ts +3 -0
  93. package/node_modules/es-errors/range.js +4 -0
  94. package/node_modules/es-errors/ref.d.ts +3 -0
  95. package/node_modules/es-errors/ref.js +4 -0
  96. package/node_modules/es-errors/syntax.d.ts +3 -0
  97. package/node_modules/es-errors/syntax.js +4 -0
  98. package/node_modules/es-errors/test/index.js +19 -0
  99. package/node_modules/es-errors/tsconfig.json +49 -0
  100. package/node_modules/es-errors/type.d.ts +3 -0
  101. package/node_modules/es-errors/type.js +4 -0
  102. package/node_modules/es-errors/uri.d.ts +3 -0
  103. package/node_modules/es-errors/uri.js +4 -0
  104. package/node_modules/globalthis/.eslintrc +18 -0
  105. package/node_modules/globalthis/.nycrc +10 -0
  106. package/node_modules/globalthis/CHANGELOG.md +109 -0
  107. package/node_modules/globalthis/LICENSE +21 -0
  108. package/node_modules/globalthis/README.md +70 -0
  109. package/node_modules/globalthis/auto.js +3 -0
  110. package/node_modules/globalthis/implementation.browser.js +11 -0
  111. package/node_modules/globalthis/implementation.js +3 -0
  112. package/node_modules/globalthis/index.js +19 -0
  113. package/node_modules/globalthis/package.json +99 -0
  114. package/node_modules/globalthis/polyfill.js +10 -0
  115. package/node_modules/globalthis/shim.js +29 -0
  116. package/node_modules/globalthis/test/implementation.js +11 -0
  117. package/node_modules/globalthis/test/index.js +11 -0
  118. package/node_modules/globalthis/test/native.js +26 -0
  119. package/node_modules/globalthis/test/shimmed.js +29 -0
  120. package/node_modules/globalthis/test/tests.js +36 -0
  121. package/node_modules/gopd/.eslintrc +16 -0
  122. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  123. package/node_modules/gopd/CHANGELOG.md +45 -0
  124. package/node_modules/gopd/LICENSE +21 -0
  125. package/node_modules/gopd/README.md +40 -0
  126. package/node_modules/gopd/gOPD.d.ts +1 -0
  127. package/node_modules/gopd/gOPD.js +4 -0
  128. package/node_modules/gopd/index.d.ts +5 -0
  129. package/node_modules/gopd/index.js +15 -0
  130. package/node_modules/gopd/package.json +77 -0
  131. package/node_modules/gopd/test/index.js +36 -0
  132. package/node_modules/gopd/tsconfig.json +9 -0
  133. package/node_modules/has-property-descriptors/.eslintrc +13 -0
  134. package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
  135. package/node_modules/has-property-descriptors/.nycrc +9 -0
  136. package/node_modules/has-property-descriptors/CHANGELOG.md +35 -0
  137. package/node_modules/has-property-descriptors/LICENSE +21 -0
  138. package/node_modules/has-property-descriptors/README.md +43 -0
  139. package/node_modules/has-property-descriptors/index.js +22 -0
  140. package/node_modules/has-property-descriptors/package.json +77 -0
  141. package/node_modules/has-property-descriptors/test/index.js +57 -0
  142. package/node_modules/is-it-type/License +19 -0
  143. package/node_modules/is-it-type/README.md +102 -0
  144. package/node_modules/is-it-type/changelog.md +239 -0
  145. package/node_modules/is-it-type/dist/cjs/is-it-type.js +173 -0
  146. package/node_modules/is-it-type/dist/cjs/is-it-type.js.map +1 -0
  147. package/node_modules/is-it-type/dist/cjs/is-it-type.min.js +2 -0
  148. package/node_modules/is-it-type/dist/cjs/is-it-type.min.js.map +1 -0
  149. package/node_modules/is-it-type/dist/esm/is-it-type.js +143 -0
  150. package/node_modules/is-it-type/dist/esm/is-it-type.js.map +1 -0
  151. package/node_modules/is-it-type/dist/esm/is-it-type.min.js +2 -0
  152. package/node_modules/is-it-type/dist/esm/is-it-type.min.js.map +1 -0
  153. package/node_modules/is-it-type/dist/esm/package.json +3 -0
  154. package/node_modules/is-it-type/dist/umd/is-it-type.js +450 -0
  155. package/node_modules/is-it-type/dist/umd/is-it-type.js.map +1 -0
  156. package/node_modules/is-it-type/dist/umd/is-it-type.min.js +2 -0
  157. package/node_modules/is-it-type/dist/umd/is-it-type.min.js.map +1 -0
  158. package/node_modules/is-it-type/es/index.js +8 -0
  159. package/node_modules/is-it-type/es/package.json +3 -0
  160. package/node_modules/is-it-type/index.js +10 -0
  161. package/node_modules/is-it-type/package.json +87 -0
  162. package/node_modules/is-it-type/src/index.js +169 -0
  163. package/node_modules/object-keys/.editorconfig +13 -0
  164. package/node_modules/object-keys/.eslintrc +17 -0
  165. package/node_modules/object-keys/.travis.yml +277 -0
  166. package/node_modules/object-keys/CHANGELOG.md +232 -0
  167. package/node_modules/object-keys/LICENSE +21 -0
  168. package/node_modules/object-keys/README.md +76 -0
  169. package/node_modules/object-keys/implementation.js +122 -0
  170. package/node_modules/object-keys/index.js +32 -0
  171. package/node_modules/object-keys/isArguments.js +17 -0
  172. package/node_modules/object-keys/package.json +88 -0
  173. package/node_modules/object-keys/test/index.js +5 -0
  174. package/node_modules/simple-invariant/License +19 -0
  175. package/node_modules/simple-invariant/README.md +64 -0
  176. package/node_modules/simple-invariant/changelog.md +31 -0
  177. package/node_modules/simple-invariant/index.js +19 -0
  178. package/node_modules/simple-invariant/package.json +50 -0
  179. package/node_modules/yauzl-promise/License +19 -0
  180. package/node_modules/yauzl-promise/README.md +440 -0
  181. package/node_modules/yauzl-promise/index.js +10 -0
  182. package/node_modules/yauzl-promise/lib/entry.js +312 -0
  183. package/node_modules/yauzl-promise/lib/index.js +160 -0
  184. package/node_modules/yauzl-promise/lib/reader.js +289 -0
  185. package/node_modules/yauzl-promise/lib/shared.js +20 -0
  186. package/node_modules/yauzl-promise/lib/utils.js +105 -0
  187. package/node_modules/yauzl-promise/lib/zip.js +1224 -0
  188. package/node_modules/yauzl-promise/package.json +56 -0
  189. package/package.json +9 -11
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ var keysShim;
4
+ if (!Object.keys) {
5
+ // modified from https://github.com/es-shims/es5-shim
6
+ var has = Object.prototype.hasOwnProperty;
7
+ var toStr = Object.prototype.toString;
8
+ var isArgs = require('./isArguments'); // eslint-disable-line global-require
9
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
10
+ var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
11
+ var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
12
+ var dontEnums = [
13
+ 'toString',
14
+ 'toLocaleString',
15
+ 'valueOf',
16
+ 'hasOwnProperty',
17
+ 'isPrototypeOf',
18
+ 'propertyIsEnumerable',
19
+ 'constructor'
20
+ ];
21
+ var equalsConstructorPrototype = function (o) {
22
+ var ctor = o.constructor;
23
+ return ctor && ctor.prototype === o;
24
+ };
25
+ var excludedKeys = {
26
+ $applicationCache: true,
27
+ $console: true,
28
+ $external: true,
29
+ $frame: true,
30
+ $frameElement: true,
31
+ $frames: true,
32
+ $innerHeight: true,
33
+ $innerWidth: true,
34
+ $onmozfullscreenchange: true,
35
+ $onmozfullscreenerror: true,
36
+ $outerHeight: true,
37
+ $outerWidth: true,
38
+ $pageXOffset: true,
39
+ $pageYOffset: true,
40
+ $parent: true,
41
+ $scrollLeft: true,
42
+ $scrollTop: true,
43
+ $scrollX: true,
44
+ $scrollY: true,
45
+ $self: true,
46
+ $webkitIndexedDB: true,
47
+ $webkitStorageInfo: true,
48
+ $window: true
49
+ };
50
+ var hasAutomationEqualityBug = (function () {
51
+ /* global window */
52
+ if (typeof window === 'undefined') { return false; }
53
+ for (var k in window) {
54
+ try {
55
+ if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
56
+ try {
57
+ equalsConstructorPrototype(window[k]);
58
+ } catch (e) {
59
+ return true;
60
+ }
61
+ }
62
+ } catch (e) {
63
+ return true;
64
+ }
65
+ }
66
+ return false;
67
+ }());
68
+ var equalsConstructorPrototypeIfNotBuggy = function (o) {
69
+ /* global window */
70
+ if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
71
+ return equalsConstructorPrototype(o);
72
+ }
73
+ try {
74
+ return equalsConstructorPrototype(o);
75
+ } catch (e) {
76
+ return false;
77
+ }
78
+ };
79
+
80
+ keysShim = function keys(object) {
81
+ var isObject = object !== null && typeof object === 'object';
82
+ var isFunction = toStr.call(object) === '[object Function]';
83
+ var isArguments = isArgs(object);
84
+ var isString = isObject && toStr.call(object) === '[object String]';
85
+ var theKeys = [];
86
+
87
+ if (!isObject && !isFunction && !isArguments) {
88
+ throw new TypeError('Object.keys called on a non-object');
89
+ }
90
+
91
+ var skipProto = hasProtoEnumBug && isFunction;
92
+ if (isString && object.length > 0 && !has.call(object, 0)) {
93
+ for (var i = 0; i < object.length; ++i) {
94
+ theKeys.push(String(i));
95
+ }
96
+ }
97
+
98
+ if (isArguments && object.length > 0) {
99
+ for (var j = 0; j < object.length; ++j) {
100
+ theKeys.push(String(j));
101
+ }
102
+ } else {
103
+ for (var name in object) {
104
+ if (!(skipProto && name === 'prototype') && has.call(object, name)) {
105
+ theKeys.push(String(name));
106
+ }
107
+ }
108
+ }
109
+
110
+ if (hasDontEnumBug) {
111
+ var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
112
+
113
+ for (var k = 0; k < dontEnums.length; ++k) {
114
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
115
+ theKeys.push(dontEnums[k]);
116
+ }
117
+ }
118
+ }
119
+ return theKeys;
120
+ };
121
+ }
122
+ module.exports = keysShim;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var slice = Array.prototype.slice;
4
+ var isArgs = require('./isArguments');
5
+
6
+ var origKeys = Object.keys;
7
+ var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
8
+
9
+ var originalKeys = Object.keys;
10
+
11
+ keysShim.shim = function shimObjectKeys() {
12
+ if (Object.keys) {
13
+ var keysWorksWithArguments = (function () {
14
+ // Safari 5.0 bug
15
+ var args = Object.keys(arguments);
16
+ return args && args.length === arguments.length;
17
+ }(1, 2));
18
+ if (!keysWorksWithArguments) {
19
+ Object.keys = function keys(object) { // eslint-disable-line func-name-matching
20
+ if (isArgs(object)) {
21
+ return originalKeys(slice.call(object));
22
+ }
23
+ return originalKeys(object);
24
+ };
25
+ }
26
+ } else {
27
+ Object.keys = keysShim;
28
+ }
29
+ return Object.keys || keysShim;
30
+ };
31
+
32
+ module.exports = keysShim;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var toStr = Object.prototype.toString;
4
+
5
+ module.exports = function isArguments(value) {
6
+ var str = toStr.call(value);
7
+ var isArgs = str === '[object Arguments]';
8
+ if (!isArgs) {
9
+ isArgs = str !== '[object Array]' &&
10
+ value !== null &&
11
+ typeof value === 'object' &&
12
+ typeof value.length === 'number' &&
13
+ value.length >= 0 &&
14
+ toStr.call(value.callee) === '[object Function]';
15
+ }
16
+ return isArgs;
17
+ };
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "object-keys",
3
+ "version": "1.1.1",
4
+ "author": {
5
+ "name": "Jordan Harband",
6
+ "email": "ljharb@gmail.com",
7
+ "url": "http://ljharb.codes"
8
+ },
9
+ "contributors": [
10
+ {
11
+ "name": "Jordan Harband",
12
+ "email": "ljharb@gmail.com",
13
+ "url": "http://ljharb.codes"
14
+ },
15
+ {
16
+ "name": "Raynos",
17
+ "email": "raynos2@gmail.com"
18
+ },
19
+ {
20
+ "name": "Nathan Rajlich",
21
+ "email": "nathan@tootallnate.net"
22
+ },
23
+ {
24
+ "name": "Ivan Starkov",
25
+ "email": "istarkov@gmail.com"
26
+ },
27
+ {
28
+ "name": "Gary Katsevman",
29
+ "email": "git@gkatsev.com"
30
+ }
31
+ ],
32
+ "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim",
33
+ "license": "MIT",
34
+ "main": "index.js",
35
+ "scripts": {
36
+ "pretest": "npm run --silent lint",
37
+ "test": "npm run --silent tests-only",
38
+ "posttest": "npm run --silent audit",
39
+ "tests-only": "node test/index.js",
40
+ "coverage": "covert test/*.js",
41
+ "coverage-quiet": "covert test/*.js --quiet",
42
+ "lint": "eslint .",
43
+ "preaudit": "npm install --package-lock --package-lock-only",
44
+ "audit": "npm audit",
45
+ "postaudit": "rm package-lock.json"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git://github.com/ljharb/object-keys.git"
50
+ },
51
+ "keywords": [
52
+ "Object.keys",
53
+ "keys",
54
+ "ES5",
55
+ "shim"
56
+ ],
57
+ "dependencies": {},
58
+ "devDependencies": {
59
+ "@ljharb/eslint-config": "^13.1.1",
60
+ "covert": "^1.1.1",
61
+ "eslint": "^5.13.0",
62
+ "foreach": "^2.0.5",
63
+ "indexof": "^0.0.1",
64
+ "is": "^3.3.0",
65
+ "tape": "^4.9.2"
66
+ },
67
+ "testling": {
68
+ "files": "test/index.js",
69
+ "browsers": [
70
+ "iexplore/6.0..latest",
71
+ "firefox/3.0..6.0",
72
+ "firefox/15.0..latest",
73
+ "firefox/nightly",
74
+ "chrome/4.0..10.0",
75
+ "chrome/20.0..latest",
76
+ "chrome/canary",
77
+ "opera/10.0..latest",
78
+ "opera/next",
79
+ "safari/4.0..latest",
80
+ "ipad/6.0..latest",
81
+ "iphone/6.0..latest",
82
+ "android-browser/4.2"
83
+ ]
84
+ },
85
+ "engines": {
86
+ "node": ">= 0.4"
87
+ }
88
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ require('./isArguments');
4
+
5
+ require('./shim');
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2021 Overlook Motel (theoverlookmotel@gmail.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ [![NPM version](https://img.shields.io/npm/v/simple-invariant.svg)](https://www.npmjs.com/package/simple-invariant)
2
+ [![Build Status](https://img.shields.io/github/workflow/status/overlookmotel/simple-invariant/Test.svg)](https://github.com/overlookmotel/simple-invariant/actions)
3
+ [![Dependency Status](https://img.shields.io/david/overlookmotel/simple-invariant.svg)](https://david-dm.org/overlookmotel/simple-invariant)
4
+ [![Dev dependency Status](https://img.shields.io/david/dev/overlookmotel/simple-invariant.svg)](https://david-dm.org/overlookmotel/simple-invariant)
5
+ [![Coverage Status](https://img.shields.io/coveralls/overlookmotel/simple-invariant/master.svg)](https://coveralls.io/r/overlookmotel/simple-invariant)
6
+
7
+ # Super-simple invariant function
8
+
9
+ ## Usage
10
+
11
+ ### What is this package?
12
+
13
+ It's the simplest possible invariant/assert function. The code is:
14
+
15
+ ```js
16
+ function invariant( condition, message ) {
17
+ if ( !condition ) {
18
+ throw new Error( message || 'Invariant failed' );
19
+ }
20
+ };
21
+ ```
22
+
23
+ So, this code:
24
+
25
+ ```js
26
+ if ( !foo ) throw new Error( 'foo must be truthy' );
27
+ ```
28
+
29
+ ...can be replaced with the shorter:
30
+
31
+ ```js
32
+ invariant( foo, 'foo must be truthy' );
33
+ ```
34
+
35
+ ### Isn't this the same as tiny-invariant?
36
+
37
+ Pretty much. The only difference is that the error thrown will *always* have the full error message, regardless of whether `process.env.NODE_ENV === 'production'` or not.
38
+
39
+ ## Versioning
40
+
41
+ This module follows [semver](https://semver.org/). Breaking changes will only be made in major version updates.
42
+
43
+ All active NodeJS release lines are supported (v10+ at time of writing). After a release line of NodeJS reaches end of life according to [Node's LTS schedule](https://nodejs.org/en/about/releases/), support for that version of Node may be dropped at any time, and this will not be considered a breaking change. Dropping support for a Node version will be made in a minor version update (e.g. 1.2.0 to 1.3.0). If you are using a Node version which is approaching end of life, pin your dependency of this module to patch updates only using tilde (`~`) e.g. `~1.2.3` to avoid breakages.
44
+
45
+ ## Tests
46
+
47
+ Use `npm test` to run the tests. Use `npm run cover` to check coverage.
48
+
49
+ ## Changelog
50
+
51
+ See [changelog.md](https://github.com/overlookmotel/simple-invariant/blob/master/changelog.md)
52
+
53
+ ## Issues
54
+
55
+ If you discover a bug, please raise an issue on Github. https://github.com/overlookmotel/simple-invariant/issues
56
+
57
+ ## Contribution
58
+
59
+ Pull requests are very welcome. Please:
60
+
61
+ * ensure all tests pass before submitting PR
62
+ * add tests for new features
63
+ * document new functionality/API additions in README
64
+ * do not add an entry to Changelog (Changelog is created when cutting releases)
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 2.0.1
4
+
5
+ Bug fixes:
6
+
7
+ * Omit invariant function itself from stack trace
8
+
9
+ Dev:
10
+
11
+ * Use Github Actions for CI
12
+ * Update dev dependencies
13
+
14
+ Docs:
15
+
16
+ * Shorten README
17
+ * Update license year
18
+
19
+ ## 2.0.0
20
+
21
+ Breaking changes:
22
+
23
+ * No prefix on error messages
24
+
25
+ Dev:
26
+
27
+ * Update dev dependencies
28
+
29
+ ## 1.0.0
30
+
31
+ * Initial release
@@ -0,0 +1,19 @@
1
+ /* --------------------
2
+ * simple-invariant module
3
+ * Entry point
4
+ * ------------------*/
5
+
6
+ 'use strict';
7
+
8
+ // Constants
9
+ const DEFAULT_MESSAGE = 'Invariant failed';
10
+
11
+ // Exports
12
+
13
+ module.exports = function invariant(condition, message) {
14
+ if (!condition) {
15
+ const err = new Error(message || DEFAULT_MESSAGE);
16
+ Error.captureStackTrace(err, invariant);
17
+ throw err;
18
+ }
19
+ };
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "simple-invariant",
3
+ "version": "2.0.1",
4
+ "description": "Super-simple invariant function",
5
+ "main": "index.js",
6
+ "files": [
7
+ "lib/**/*.js"
8
+ ],
9
+ "author": {
10
+ "name": "Overlook Motel"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/overlookmotel/simple-invariant.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/overlookmotel/simple-invariant/issues"
18
+ },
19
+ "dependencies": {},
20
+ "devDependencies": {
21
+ "@overlookmotel/eslint-config": "^7.2.1",
22
+ "@overlookmotel/eslint-config-jest": "^4.1.1",
23
+ "@overlookmotel/eslint-config-node": "^2.1.2",
24
+ "cross-env": "^7.0.3",
25
+ "eslint": "^7.24.0",
26
+ "eslint-config-airbnb-base": "^14.2.1",
27
+ "eslint-plugin-eslint-comments": "^3.2.0",
28
+ "eslint-plugin-import": "^2.22.1",
29
+ "eslint-plugin-jest": "^23.20.0",
30
+ "eslint-plugin-node": "^11.1.0",
31
+ "jest": "^26.6.3",
32
+ "jest-extended": "^0.11.5"
33
+ },
34
+ "keywords": [
35
+ "invariant"
36
+ ],
37
+ "scripts": {
38
+ "test": "npm run lint && npm run test-main",
39
+ "lint": "eslint '*.js' '.*.js' '**/*.js' '**/.*.js'",
40
+ "lint-fix": "eslint '*.js' '.*.js' '**/*.js' '**/.*.js' --fix",
41
+ "test-main": "jest",
42
+ "cover": "npm run cover-main && rm -rf coverage",
43
+ "cover-main": "cross-env COVERAGE=true jest --coverage"
44
+ },
45
+ "engines": {
46
+ "node": ">=10"
47
+ },
48
+ "readmeFilename": "README.md",
49
+ "license": "MIT"
50
+ }
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 Overlook Motel (theoverlookmotel@gmail.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.