foxts 1.3.1 → 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/detect-eol/index.cjs +1 -0
- package/detect-eol/index.d.ts +3 -0
- package/detect-eol/index.mjs +1 -0
- package/guard/index.cjs +1 -1
- package/guard/index.d.ts +2 -1
- package/guard/index.mjs +1 -1
- package/is-probably-ip/index.cjs +1 -1
- package/is-probably-ip/index.mjs +1 -1
- package/package.json +58 -49
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.detectEol=function(t){for(let n=0,r=t.length;n<r;n++){const r=t[n];if("\n"===r)break;if("\r"===r&&"\n"===t[n+1])return"\r\n"}return"\n"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){for(let r=0,t=n.length;r<t;r++){const t=n[r];if("\n"===t)break;if("\r"===t&&"\n"===n[r+1])return"\r\n"}return"\n"}export{n as detectEol};
|
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
|
|
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
|
|
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/is-probably-ip/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.isProbablyIpv4=function(t){if(t.length<7||t.length>15)return!1;let e=0;for(let r=0;r<t.length;r+=1){const n=t.charCodeAt(r);if(46===n)e+=1;else if(n<48||n>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(t.length-1)},exports.isProbablyIpv6=function(t){if(t.length<3)return!1;let e=+("["===t[0]),r=t.length;if("]"===t[r-1]&&(r-=1),r-e>39)return!1;let n=!1;for(;e<r;e+=1){const r=t.charCodeAt(e);if(58===r)n=!0;else if(
|
|
1
|
+
"use strict";exports.isProbablyIpv4=function(t){if(t.length<7||t.length>15)return!1;let e=0;for(let r=0;r<t.length;r+=1){const n=t.charCodeAt(r);if(46===n)e+=1;else if(n<48||n>57)return!1}return 3===e&&46!==t.charCodeAt(0)&&46!==t.charCodeAt(t.length-1)},exports.isProbablyIpv6=function(t){if(t.length<3)return!1;let e=+("["===t[0]),r=t.length;if("]"===t[r-1]&&(r-=1),r-e>39)return!1;let n=!1;for(;e<r;e+=1){const r=t.charCodeAt(e);if(58===r)n=!0;else if((r<48||r>57)&&(r<97||r>102)&&(r<65||r>90))return!1}return n};
|
package/is-probably-ip/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){if(e.length<7||e.length>15)return!1;let t=0;for(let r=0;r<e.length;r+=1){const n=e.charCodeAt(r);if(46===n)t+=1;else if(n<48||n>57)return!1}return 3===t&&46!==e.charCodeAt(0)&&46!==e.charCodeAt(e.length-1)}function t(e){if(e.length<3)return!1;let t=+("["===e[0]),r=e.length;if("]"===e[r-1]&&(r-=1),r-t>39)return!1;let n=!1;for(;t<r;t+=1){const r=e.charCodeAt(t);if(58===r)n=!0;else if(
|
|
1
|
+
function e(e){if(e.length<7||e.length>15)return!1;let t=0;for(let r=0;r<e.length;r+=1){const n=e.charCodeAt(r);if(46===n)t+=1;else if(n<48||n>57)return!1}return 3===t&&46!==e.charCodeAt(0)&&46!==e.charCodeAt(e.length-1)}function t(e){if(e.length<3)return!1;let t=+("["===e[0]),r=e.length;if("]"===e[r-1]&&(r-=1),r-t>39)return!1;let n=!1;for(;t<r;t+=1){const r=e.charCodeAt(t);if(58===r)n=!0;else if((r<48||r>57)&&(r<97||r>102)&&(r<65||r>90))return!1}return n}export{e as isProbablyIpv4,t as isProbablyIpv6};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "1.
|
|
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"
|
|
@@ -68,6 +68,15 @@
|
|
|
68
68
|
"require": "./bitwise/index.cjs",
|
|
69
69
|
"default": "./bitwise/index.cjs"
|
|
70
70
|
},
|
|
71
|
+
"./create-fixed-array": {
|
|
72
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
75
|
+
"default": "./create-fixed-array/index.mjs"
|
|
76
|
+
},
|
|
77
|
+
"require": "./create-fixed-array/index.cjs",
|
|
78
|
+
"default": "./create-fixed-array/index.cjs"
|
|
79
|
+
},
|
|
71
80
|
"./append-set-elements-to-array": {
|
|
72
81
|
"types": "./append-set-elements-to-array/index.d.ts",
|
|
73
82
|
"import": {
|
|
@@ -77,14 +86,14 @@
|
|
|
77
86
|
"require": "./append-set-elements-to-array/index.cjs",
|
|
78
87
|
"default": "./append-set-elements-to-array/index.cjs"
|
|
79
88
|
},
|
|
80
|
-
"./
|
|
81
|
-
"types": "./
|
|
89
|
+
"./detect-eol": {
|
|
90
|
+
"types": "./detect-eol/index.d.ts",
|
|
82
91
|
"import": {
|
|
83
|
-
"types": "./
|
|
84
|
-
"default": "./
|
|
92
|
+
"types": "./detect-eol/index.d.ts",
|
|
93
|
+
"default": "./detect-eol/index.mjs"
|
|
85
94
|
},
|
|
86
|
-
"require": "./
|
|
87
|
-
"default": "./
|
|
95
|
+
"require": "./detect-eol/index.cjs",
|
|
96
|
+
"default": "./detect-eol/index.cjs"
|
|
88
97
|
},
|
|
89
98
|
"./escape-string-regexp": {
|
|
90
99
|
"types": "./escape-string-regexp/index.d.ts",
|
|
@@ -104,15 +113,6 @@
|
|
|
104
113
|
"require": "./fast-string-array-join/index.cjs",
|
|
105
114
|
"default": "./fast-string-array-join/index.cjs"
|
|
106
115
|
},
|
|
107
|
-
"./fnv1a": {
|
|
108
|
-
"types": "./fnv1a/index.d.ts",
|
|
109
|
-
"import": {
|
|
110
|
-
"types": "./fnv1a/index.d.ts",
|
|
111
|
-
"default": "./fnv1a/index.mjs"
|
|
112
|
-
},
|
|
113
|
-
"require": "./fnv1a/index.cjs",
|
|
114
|
-
"default": "./fnv1a/index.cjs"
|
|
115
|
-
},
|
|
116
116
|
"./fifo": {
|
|
117
117
|
"types": "./fifo/index.d.ts",
|
|
118
118
|
"import": {
|
|
@@ -122,23 +122,14 @@
|
|
|
122
122
|
"require": "./fifo/index.cjs",
|
|
123
123
|
"default": "./fifo/index.cjs"
|
|
124
124
|
},
|
|
125
|
-
"./
|
|
126
|
-
"types": "./
|
|
127
|
-
"import": {
|
|
128
|
-
"types": "./fnv1a52/index.d.ts",
|
|
129
|
-
"default": "./fnv1a52/index.mjs"
|
|
130
|
-
},
|
|
131
|
-
"require": "./fnv1a52/index.cjs",
|
|
132
|
-
"default": "./fnv1a52/index.cjs"
|
|
133
|
-
},
|
|
134
|
-
"./guard": {
|
|
135
|
-
"types": "./guard/index.d.ts",
|
|
125
|
+
"./fnv1a": {
|
|
126
|
+
"types": "./fnv1a/index.d.ts",
|
|
136
127
|
"import": {
|
|
137
|
-
"types": "./
|
|
138
|
-
"default": "./
|
|
128
|
+
"types": "./fnv1a/index.d.ts",
|
|
129
|
+
"default": "./fnv1a/index.mjs"
|
|
139
130
|
},
|
|
140
|
-
"require": "./
|
|
141
|
-
"default": "./
|
|
131
|
+
"require": "./fnv1a/index.cjs",
|
|
132
|
+
"default": "./fnv1a/index.cjs"
|
|
142
133
|
},
|
|
143
134
|
"./headers-to-object": {
|
|
144
135
|
"types": "./headers-to-object/index.d.ts",
|
|
@@ -149,14 +140,14 @@
|
|
|
149
140
|
"require": "./headers-to-object/index.cjs",
|
|
150
141
|
"default": "./headers-to-object/index.cjs"
|
|
151
142
|
},
|
|
152
|
-
"./
|
|
153
|
-
"types": "./
|
|
143
|
+
"./guard": {
|
|
144
|
+
"types": "./guard/index.d.ts",
|
|
154
145
|
"import": {
|
|
155
|
-
"types": "./
|
|
156
|
-
"default": "./
|
|
146
|
+
"types": "./guard/index.d.ts",
|
|
147
|
+
"default": "./guard/index.mjs"
|
|
157
148
|
},
|
|
158
|
-
"require": "./
|
|
159
|
-
"default": "./
|
|
149
|
+
"require": "./guard/index.cjs",
|
|
150
|
+
"default": "./guard/index.cjs"
|
|
160
151
|
},
|
|
161
152
|
"./is-probably-ip": {
|
|
162
153
|
"types": "./is-probably-ip/index.d.ts",
|
|
@@ -167,14 +158,14 @@
|
|
|
167
158
|
"require": "./is-probably-ip/index.cjs",
|
|
168
159
|
"default": "./is-probably-ip/index.cjs"
|
|
169
160
|
},
|
|
170
|
-
"./
|
|
171
|
-
"types": "./
|
|
161
|
+
"./identity": {
|
|
162
|
+
"types": "./identity/index.d.ts",
|
|
172
163
|
"import": {
|
|
173
|
-
"types": "./
|
|
174
|
-
"default": "./
|
|
164
|
+
"types": "./identity/index.d.ts",
|
|
165
|
+
"default": "./identity/index.mjs"
|
|
175
166
|
},
|
|
176
|
-
"require": "./
|
|
177
|
-
"default": "./
|
|
167
|
+
"require": "./identity/index.cjs",
|
|
168
|
+
"default": "./identity/index.cjs"
|
|
178
169
|
},
|
|
179
170
|
"./noop": {
|
|
180
171
|
"types": "./noop/index.d.ts",
|
|
@@ -185,6 +176,15 @@
|
|
|
185
176
|
"require": "./noop/index.cjs",
|
|
186
177
|
"default": "./noop/index.cjs"
|
|
187
178
|
},
|
|
179
|
+
"./merge-headers": {
|
|
180
|
+
"types": "./merge-headers/index.d.ts",
|
|
181
|
+
"import": {
|
|
182
|
+
"types": "./merge-headers/index.d.ts",
|
|
183
|
+
"default": "./merge-headers/index.mjs"
|
|
184
|
+
},
|
|
185
|
+
"require": "./merge-headers/index.cjs",
|
|
186
|
+
"default": "./merge-headers/index.cjs"
|
|
187
|
+
},
|
|
188
188
|
"./once": {
|
|
189
189
|
"types": "./once/index.d.ts",
|
|
190
190
|
"import": {
|
|
@@ -203,14 +203,14 @@
|
|
|
203
203
|
"require": "./pick-random/index.cjs",
|
|
204
204
|
"default": "./pick-random/index.cjs"
|
|
205
205
|
},
|
|
206
|
-
"./
|
|
207
|
-
"types": "./
|
|
206
|
+
"./fnv1a52": {
|
|
207
|
+
"types": "./fnv1a52/index.d.ts",
|
|
208
208
|
"import": {
|
|
209
|
-
"types": "./
|
|
210
|
-
"default": "./
|
|
209
|
+
"types": "./fnv1a52/index.d.ts",
|
|
210
|
+
"default": "./fnv1a52/index.mjs"
|
|
211
211
|
},
|
|
212
|
-
"require": "./
|
|
213
|
-
"default": "./
|
|
212
|
+
"require": "./fnv1a52/index.cjs",
|
|
213
|
+
"default": "./fnv1a52/index.cjs"
|
|
214
214
|
},
|
|
215
215
|
"./random-int": {
|
|
216
216
|
"types": "./random-int/index.d.ts",
|
|
@@ -221,6 +221,15 @@
|
|
|
221
221
|
"require": "./random-int/index.cjs",
|
|
222
222
|
"default": "./random-int/index.cjs"
|
|
223
223
|
},
|
|
224
|
+
"./repool": {
|
|
225
|
+
"types": "./repool/index.d.ts",
|
|
226
|
+
"import": {
|
|
227
|
+
"types": "./repool/index.d.ts",
|
|
228
|
+
"default": "./repool/index.mjs"
|
|
229
|
+
},
|
|
230
|
+
"require": "./repool/index.cjs",
|
|
231
|
+
"default": "./repool/index.cjs"
|
|
232
|
+
},
|
|
224
233
|
"./retrie": {
|
|
225
234
|
"types": "./retrie/index.d.ts",
|
|
226
235
|
"import": {
|