foxts 1.4.0 → 1.5.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.
package/guard/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";function r(r){switch(r){case null:return r=>null!==r;case void 0:return r=>void 0!==r;case!1:return r=>!1!==r;case"nullish":return r=>null!=r;case"falsy":return r=>!!r;default:throw TypeError("Invalid argument")}}function n(r){switch(r){case null:return r=>null===r;case void 0:return r=>void 0===r;case!1:return r=>!1===r;case"nullish":return r=>null==r;case"falsy":return r=>!r;case"truthy":return r=>!!r;default:throw TypeError("Invalid argument")}}const t=n("truthy"),e=n("falsy"),u=r(null),l=r("nullish");exports.invariant=function(r,n='[foxts/invariant] "value" is null or undefined'){if(null==r)throw TypeError(n)},exports.is=n,exports.isFalsy=e,exports.isNonNull=u,exports.isNonNullish=l,exports.isTruthy=t,exports.not=r,exports.nullthrow=function(r,n='[foxts/invariant] "value" is null or undefined'){if(null==r)throw TypeError(n);return r};
1
+ "use strict";function r(r){switch(r){case null:return r=>null!==r;case void 0:return r=>void 0!==r;case!1:return r=>!1!==r;case"nullish":return r=>null!=r;case"falsy":return r=>!!r;default:throw TypeError("Invalid argument")}}function n(r){switch(r){case null:return r=>null===r;case void 0:return r=>void 0===r;case!1:return r=>!1===r;case"nullish":return r=>null==r;case"falsy":return r=>!r;case"truthy":return r=>!!r;default:throw TypeError("Invalid argument")}}const e=n("truthy"),t=n("falsy"),u=r(null),l=r("nullish");exports.invariant=function(r,n='[foxts/invariant] "value" is null or undefined'){if(null==r)throw TypeError(n)},exports.is=n,exports.isFalsy=t,exports.isNonNull=u,exports.isNonNullish=l,exports.isTruthy=e,exports.never=function(r){throw TypeError(`Unexpected value: ${r} as ${JSON.stringify(typeof r)}, should be "never"`)},exports.not=r,exports.nullthrow=function(r,n='[foxts/invariant] "value" is null or undefined'){if(null==r)throw TypeError(n);return r};
package/guard/index.d.ts CHANGED
@@ -15,5 +15,6 @@ declare const isNonNull: <T>(i: T | null) => i is T;
15
15
  declare const isNonNullish: <T>(i: T | null | undefined) => i is T;
16
16
  declare function nullthrow<T>(value: T | null | undefined, message?: string): T;
17
17
  declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
18
+ declare function never(value: never): never;
18
19
 
19
- export { invariant, is, isFalsy, isNonNull, isNonNullish, isTruthy, not, nullthrow };
20
+ export { invariant, is, isFalsy, isNonNull, isNonNullish, isTruthy, never, not, nullthrow };
package/guard/index.mjs CHANGED
@@ -1 +1 @@
1
- function n(n){switch(n){case null:return n=>null!==n;case void 0:return n=>void 0!==n;case!1:return n=>!1!==n;case"nullish":return n=>null!=n;case"falsy":return n=>!!n;default:throw TypeError("Invalid argument")}}function r(n){switch(n){case null:return n=>null===n;case void 0:return n=>void 0===n;case!1:return n=>!1===n;case"nullish":return n=>null==n;case"falsy":return n=>!n;case"truthy":return n=>!!n;default:throw TypeError("Invalid argument")}}const l=r("truthy"),u=r("falsy"),t=n(null),e=n("nullish");function i(n,r='[foxts/invariant] "value" is null or undefined'){if(null==n)throw TypeError(r);return n}function s(n,r='[foxts/invariant] "value" is null or undefined'){if(null==n)throw TypeError(r)}export{s as invariant,r as is,u as isFalsy,t as isNonNull,e as isNonNullish,l as isTruthy,n as not,i as nullthrow};
1
+ function n(n){switch(n){case null:return n=>null!==n;case void 0:return n=>void 0!==n;case!1:return n=>!1!==n;case"nullish":return n=>null!=n;case"falsy":return n=>!!n;default:throw TypeError("Invalid argument")}}function r(n){switch(n){case null:return n=>null===n;case void 0:return n=>void 0===n;case!1:return n=>!1===n;case"nullish":return n=>null==n;case"falsy":return n=>!n;case"truthy":return n=>!!n;default:throw TypeError("Invalid argument")}}const e=r("truthy"),u=r("falsy"),l=n(null),t=n("nullish");function i(n,r='[foxts/invariant] "value" is null or undefined'){if(null==n)throw TypeError(r);return n}function s(n,r='[foxts/invariant] "value" is null or undefined'){if(null==n)throw TypeError(r)}function a(n){throw TypeError(`Unexpected value: ${n} as ${JSON.stringify(typeof n)}, should be "never"`)}export{s as invariant,r as is,u as isFalsy,l as isNonNull,t as isNonNullish,e as isTruthy,a as never,n as not,i as nullthrow};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -41,14 +41,14 @@
41
41
  "require": "./add-array-elements-to-set/index.cjs",
42
42
  "default": "./add-array-elements-to-set/index.cjs"
43
43
  },
44
- "./append-set-elements-to-array": {
45
- "types": "./append-set-elements-to-array/index.d.ts",
44
+ "./ahocorasick": {
45
+ "types": "./ahocorasick/index.d.ts",
46
46
  "import": {
47
- "types": "./append-set-elements-to-array/index.d.ts",
48
- "default": "./append-set-elements-to-array/index.mjs"
47
+ "types": "./ahocorasick/index.d.ts",
48
+ "default": "./ahocorasick/index.mjs"
49
49
  },
50
- "require": "./append-set-elements-to-array/index.cjs",
51
- "default": "./append-set-elements-to-array/index.cjs"
50
+ "require": "./ahocorasick/index.cjs",
51
+ "default": "./ahocorasick/index.cjs"
52
52
  },
53
53
  "./async-write-to-stream": {
54
54
  "types": "./async-write-to-stream/index.d.ts",
@@ -77,6 +77,15 @@
77
77
  "require": "./create-fixed-array/index.cjs",
78
78
  "default": "./create-fixed-array/index.cjs"
79
79
  },
80
+ "./append-set-elements-to-array": {
81
+ "types": "./append-set-elements-to-array/index.d.ts",
82
+ "import": {
83
+ "types": "./append-set-elements-to-array/index.d.ts",
84
+ "default": "./append-set-elements-to-array/index.mjs"
85
+ },
86
+ "require": "./append-set-elements-to-array/index.cjs",
87
+ "default": "./append-set-elements-to-array/index.cjs"
88
+ },
80
89
  "./detect-eol": {
81
90
  "types": "./detect-eol/index.d.ts",
82
91
  "import": {
@@ -86,15 +95,6 @@
86
95
  "require": "./detect-eol/index.cjs",
87
96
  "default": "./detect-eol/index.cjs"
88
97
  },
89
- "./ahocorasick": {
90
- "types": "./ahocorasick/index.d.ts",
91
- "import": {
92
- "types": "./ahocorasick/index.d.ts",
93
- "default": "./ahocorasick/index.mjs"
94
- },
95
- "require": "./ahocorasick/index.cjs",
96
- "default": "./ahocorasick/index.cjs"
97
- },
98
98
  "./escape-string-regexp": {
99
99
  "types": "./escape-string-regexp/index.d.ts",
100
100
  "import": {
@@ -104,6 +104,15 @@
104
104
  "require": "./escape-string-regexp/index.cjs",
105
105
  "default": "./escape-string-regexp/index.cjs"
106
106
  },
107
+ "./fast-string-array-join": {
108
+ "types": "./fast-string-array-join/index.d.ts",
109
+ "import": {
110
+ "types": "./fast-string-array-join/index.d.ts",
111
+ "default": "./fast-string-array-join/index.mjs"
112
+ },
113
+ "require": "./fast-string-array-join/index.cjs",
114
+ "default": "./fast-string-array-join/index.cjs"
115
+ },
107
116
  "./fifo": {
108
117
  "types": "./fifo/index.d.ts",
109
118
  "import": {
@@ -122,14 +131,14 @@
122
131
  "require": "./fnv1a/index.cjs",
123
132
  "default": "./fnv1a/index.cjs"
124
133
  },
125
- "./fnv1a52": {
126
- "types": "./fnv1a52/index.d.ts",
134
+ "./headers-to-object": {
135
+ "types": "./headers-to-object/index.d.ts",
127
136
  "import": {
128
- "types": "./fnv1a52/index.d.ts",
129
- "default": "./fnv1a52/index.mjs"
137
+ "types": "./headers-to-object/index.d.ts",
138
+ "default": "./headers-to-object/index.mjs"
130
139
  },
131
- "require": "./fnv1a52/index.cjs",
132
- "default": "./fnv1a52/index.cjs"
140
+ "require": "./headers-to-object/index.cjs",
141
+ "default": "./headers-to-object/index.cjs"
133
142
  },
134
143
  "./guard": {
135
144
  "types": "./guard/index.d.ts",
@@ -140,14 +149,14 @@
140
149
  "require": "./guard/index.cjs",
141
150
  "default": "./guard/index.cjs"
142
151
  },
143
- "./headers-to-object": {
144
- "types": "./headers-to-object/index.d.ts",
152
+ "./is-probably-ip": {
153
+ "types": "./is-probably-ip/index.d.ts",
145
154
  "import": {
146
- "types": "./headers-to-object/index.d.ts",
147
- "default": "./headers-to-object/index.mjs"
155
+ "types": "./is-probably-ip/index.d.ts",
156
+ "default": "./is-probably-ip/index.mjs"
148
157
  },
149
- "require": "./headers-to-object/index.cjs",
150
- "default": "./headers-to-object/index.cjs"
158
+ "require": "./is-probably-ip/index.cjs",
159
+ "default": "./is-probably-ip/index.cjs"
151
160
  },
152
161
  "./identity": {
153
162
  "types": "./identity/index.d.ts",
@@ -158,14 +167,14 @@
158
167
  "require": "./identity/index.cjs",
159
168
  "default": "./identity/index.cjs"
160
169
  },
161
- "./is-probably-ip": {
162
- "types": "./is-probably-ip/index.d.ts",
170
+ "./noop": {
171
+ "types": "./noop/index.d.ts",
163
172
  "import": {
164
- "types": "./is-probably-ip/index.d.ts",
165
- "default": "./is-probably-ip/index.mjs"
173
+ "types": "./noop/index.d.ts",
174
+ "default": "./noop/index.mjs"
166
175
  },
167
- "require": "./is-probably-ip/index.cjs",
168
- "default": "./is-probably-ip/index.cjs"
176
+ "require": "./noop/index.cjs",
177
+ "default": "./noop/index.cjs"
169
178
  },
170
179
  "./merge-headers": {
171
180
  "types": "./merge-headers/index.d.ts",
@@ -176,15 +185,6 @@
176
185
  "require": "./merge-headers/index.cjs",
177
186
  "default": "./merge-headers/index.cjs"
178
187
  },
179
- "./noop": {
180
- "types": "./noop/index.d.ts",
181
- "import": {
182
- "types": "./noop/index.d.ts",
183
- "default": "./noop/index.mjs"
184
- },
185
- "require": "./noop/index.cjs",
186
- "default": "./noop/index.cjs"
187
- },
188
188
  "./once": {
189
189
  "types": "./once/index.d.ts",
190
190
  "import": {
@@ -203,6 +203,15 @@
203
203
  "require": "./pick-random/index.cjs",
204
204
  "default": "./pick-random/index.cjs"
205
205
  },
206
+ "./fnv1a52": {
207
+ "types": "./fnv1a52/index.d.ts",
208
+ "import": {
209
+ "types": "./fnv1a52/index.d.ts",
210
+ "default": "./fnv1a52/index.mjs"
211
+ },
212
+ "require": "./fnv1a52/index.cjs",
213
+ "default": "./fnv1a52/index.cjs"
214
+ },
206
215
  "./random-int": {
207
216
  "types": "./random-int/index.d.ts",
208
217
  "import": {
@@ -265,15 +274,6 @@
265
274
  },
266
275
  "require": "./wait/index.cjs",
267
276
  "default": "./wait/index.cjs"
268
- },
269
- "./fast-string-array-join": {
270
- "types": "./fast-string-array-join/index.d.ts",
271
- "import": {
272
- "types": "./fast-string-array-join/index.d.ts",
273
- "default": "./fast-string-array-join/index.mjs"
274
- },
275
- "require": "./fast-string-array-join/index.cjs",
276
- "default": "./fast-string-array-join/index.cjs"
277
277
  }
278
278
  }
279
279
  }