@rcompat/is 0.1.3 → 0.2.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 (65) hide show
  1. package/README.md +383 -0
  2. package/lib/private/array.d.ts +3 -0
  3. package/lib/private/array.js +2 -0
  4. package/lib/private/date.d.ts +2 -0
  5. package/lib/private/date.js +4 -0
  6. package/lib/private/dict.d.ts +3 -0
  7. package/lib/private/dict.js +7 -0
  8. package/lib/private/empty.js +0 -6
  9. package/lib/private/finite.js +2 -4
  10. package/lib/private/index.d.ts +48 -0
  11. package/lib/private/index.js +74 -0
  12. package/lib/private/int.d.ts +2 -0
  13. package/lib/private/{integer.js → int.js} +2 -2
  14. package/lib/private/numbers.d.ts +14 -0
  15. package/lib/private/numbers.js +37 -0
  16. package/lib/private/numeric.js +2 -4
  17. package/lib/private/object.d.ts +2 -0
  18. package/lib/private/object.js +4 -0
  19. package/lib/private/primitive.js +3 -3
  20. package/lib/private/promise.d.ts +2 -0
  21. package/lib/private/promise.js +4 -0
  22. package/lib/private/regexp.d.ts +2 -0
  23. package/lib/private/regexp.js +4 -0
  24. package/lib/private/safeint.d.ts +2 -0
  25. package/lib/private/{safe-integer.js → safeint.js} +2 -2
  26. package/lib/private/strings.d.ts +9 -0
  27. package/lib/private/strings.js +11 -0
  28. package/lib/private/uint.js +2 -2
  29. package/lib/private/url.d.ts +2 -0
  30. package/lib/private/url.js +4 -0
  31. package/lib/public/index.d.ts +2 -0
  32. package/lib/public/index.js +2 -0
  33. package/package.json +5 -5
  34. package/lib/private/integer.d.ts +0 -2
  35. package/lib/private/safe-integer.d.ts +0 -2
  36. package/lib/public/blank.d.ts +0 -2
  37. package/lib/public/blank.js +0 -2
  38. package/lib/public/boolish.d.ts +0 -2
  39. package/lib/public/boolish.js +0 -2
  40. package/lib/public/defined.d.ts +0 -2
  41. package/lib/public/defined.js +0 -2
  42. package/lib/public/empty.d.ts +0 -2
  43. package/lib/public/empty.js +0 -2
  44. package/lib/public/falsy.d.ts +0 -2
  45. package/lib/public/falsy.js +0 -2
  46. package/lib/public/finite.d.ts +0 -2
  47. package/lib/public/finite.js +0 -2
  48. package/lib/public/integer.d.ts +0 -2
  49. package/lib/public/integer.js +0 -2
  50. package/lib/public/nan.d.ts +0 -2
  51. package/lib/public/nan.js +0 -2
  52. package/lib/public/newable.d.ts +0 -2
  53. package/lib/public/newable.js +0 -2
  54. package/lib/public/nullish.d.ts +0 -2
  55. package/lib/public/nullish.js +0 -2
  56. package/lib/public/numeric.d.ts +0 -2
  57. package/lib/public/numeric.js +0 -2
  58. package/lib/public/primitive.d.ts +0 -2
  59. package/lib/public/primitive.js +0 -2
  60. package/lib/public/safe-integer.d.ts +0 -2
  61. package/lib/public/safe-integer.js +0 -2
  62. package/lib/public/truthy.d.ts +0 -2
  63. package/lib/public/truthy.js +0 -2
  64. package/lib/public/uint.d.ts +0 -2
  65. package/lib/public/uint.js +0 -2
package/README.md ADDED
@@ -0,0 +1,383 @@
1
+ # @rcompat/is
2
+
3
+ Type guard predicates for JavaScript runtimes.
4
+
5
+ ## What is @rcompat/is?
6
+
7
+ A cross-runtime module providing type guard functions for common value checks.
8
+ All functions return boolean and include TypeScript type narrowing. Works
9
+ consistently across Node, Deno, and Bun.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @rcompat/is
15
+ ```
16
+
17
+ ```bash
18
+ pnpm add @rcompat/is
19
+ ```
20
+
21
+ ```bash
22
+ yarn add @rcompat/is
23
+ ```
24
+
25
+ ```bash
26
+ bun add @rcompat/is
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### nullish
32
+
33
+ Checks if a value is `null` or `undefined`.
34
+
35
+ ```js
36
+ import is from "@rcompat/is";
37
+
38
+ is.nullish(null); // true
39
+ is.nullish(undefined); // true
40
+ is.nullish(0); // false
41
+ is.nullish(""); // false
42
+ is.nullish(false); // false
43
+ ```
44
+
45
+ ### defined
46
+
47
+ Checks if a value is not `undefined`.
48
+
49
+ ```js
50
+ import is from "@rcompat/is";
51
+
52
+ is.defined("hello"); // true
53
+ is.defined(0); // true
54
+ is.defined(null); // true
55
+ is.defined(undefined); // false
56
+ ```
57
+
58
+ ### truthy
59
+
60
+ Checks if a value is truthy.
61
+
62
+ ```js
63
+ import is from "@rcompat/is";
64
+
65
+ is.truthy(1); // true
66
+ is.truthy("hello"); // true
67
+ is.truthy([]); // true
68
+ is.truthy(0); // false
69
+ is.truthy(""); // false
70
+ is.truthy(null); // false
71
+ ```
72
+
73
+ ### falsy
74
+
75
+ Checks if a value is falsy.
76
+
77
+ ```js
78
+ import is from "@rcompat/is";
79
+
80
+ is.falsy(0); // true
81
+ is.falsy(""); // true
82
+ is.falsy(null); // true
83
+ is.falsy(undefined); // true
84
+ is.falsy(false); // true
85
+ is.falsy(NaN); // true
86
+ is.falsy(1); // false
87
+ ```
88
+
89
+ ### empty
90
+
91
+ Checks if a value is empty (strings, arrays, Sets, Maps, objects).
92
+
93
+ ```js
94
+ import is from "@rcompat/is";
95
+
96
+ is.empty(""); // true
97
+ is.empty([]); // true
98
+ is.empty({}); // true
99
+ is.empty(new Set()); // true
100
+ is.empty(new Map()); // true
101
+ is.empty("hello"); // false
102
+ is.empty([1, 2]); // false
103
+ is.empty({ a: 1 }); // false
104
+ ```
105
+
106
+ ### blank
107
+
108
+ Checks if a string is empty or contains only whitespace.
109
+
110
+ ```js
111
+ import is from "@rcompat/is";
112
+
113
+ is.blank(""); // true
114
+ is.blank(" "); // true
115
+ is.blank("\t\n"); // true
116
+ is.blank("hello"); // false
117
+ is.blank(" hi "); // false
118
+ ```
119
+
120
+ ### numeric
121
+
122
+ Checks if a string represents a valid number.
123
+
124
+ ```js
125
+ import is from "@rcompat/is";
126
+
127
+ is.numeric("123"); // true
128
+ is.numeric("-45.67"); // true
129
+ is.numeric("1e10"); // true
130
+ is.numeric("+3.14"); // true
131
+ is.numeric("abc"); // false
132
+ is.numeric(""); // false
133
+ is.numeric("12px"); // false
134
+ ```
135
+
136
+ ### int
137
+
138
+ Checks if a value is an integer number.
139
+
140
+ ```js
141
+ import is from "@rcompat/is";
142
+
143
+ is.int(42); // true
144
+ is.int(-10); // true
145
+ is.int(0); // true
146
+ is.int(3.14); // false
147
+ is.int(NaN); // false
148
+ is.int("42"); // false
149
+ ```
150
+
151
+ ### uint
152
+
153
+ Checks if a value is a positive integer (unsigned).
154
+
155
+ ```js
156
+ import is from "@rcompat/is";
157
+
158
+ is.uint(1); // true
159
+ is.uint(100); // true
160
+ is.uint(0); // false
161
+ is.uint(-1); // false
162
+ is.uint(3.14); // false
163
+ ```
164
+
165
+ ### safeint
166
+
167
+ Checks if a value is a safe integer (within JavaScript's safe range).
168
+
169
+ ```js
170
+ import is from "@rcompat/is";
171
+
172
+ is.safeint(42); // true
173
+ is.safeint(Number.MAX_SAFE_INTEGER); // true
174
+ is.safeint(Number.MAX_SAFE_INTEGER + 1); // false
175
+ is.safeint(3.14); // false
176
+ ```
177
+
178
+ ### finite
179
+
180
+ Checks if a number or bigint is finite.
181
+
182
+ ```js
183
+ import is from "@rcompat/is";
184
+
185
+ is.finite(42); // true
186
+ is.finite(3.14); // true
187
+ is.finite(100n); // true (bigints are always finite)
188
+ is.finite(Infinity); // false
189
+ is.finite(-Infinity); // false
190
+ is.finite(NaN); // false
191
+ ```
192
+
193
+ ### nan
194
+
195
+ Checks if a value is `NaN`.
196
+
197
+ ```js
198
+ import is from "@rcompat/is";
199
+
200
+ is.nan(NaN); // true
201
+ is.nan(Number.NaN); // true
202
+ is.nan(0 / 0); // true
203
+ is.nan(42); // false
204
+ is.nan("NaN"); // false
205
+ ```
206
+
207
+ ### primitive
208
+
209
+ Checks if a value is a primitive type.
210
+
211
+ ```js
212
+ import is from "@rcompat/is";
213
+
214
+ is.primitive("hello"); // true
215
+ is.primitive(42); // true
216
+ is.primitive(true); // true
217
+ is.primitive(null); // true
218
+ is.primitive(undefined); // true
219
+ is.primitive(Symbol()); // true
220
+ is.primitive(100n); // true
221
+ is.primitive({}); // false
222
+ is.primitive([]); // false
223
+ ```
224
+
225
+ ### dict
226
+
227
+ Checks if a value is a plain object (not array, Date, class instance, etc.).
228
+
229
+ ```js
230
+ import is from "@rcompat/is";
231
+
232
+ is.dict({}); // true
233
+ is.dict({ a: 1 }); // true
234
+ is.dict(Object.create(null)); // true
235
+ is.dict([]); // false
236
+ is.dict(new Date()); // false
237
+ is.dict(new Map()); // false
238
+ is.dict(null); // false
239
+ ```
240
+
241
+ ### newable
242
+
243
+ Checks if a value is a constructor (can be called with `new`).
244
+
245
+ ```js
246
+ import is from "@rcompat/is";
247
+
248
+ is.newable(class {}); // true
249
+ is.newable(function() {}); // true
250
+ is.newable(Date); // true
251
+ is.newable(() => {}); // false (arrow functions)
252
+ is.newable({}); // false
253
+ ```
254
+
255
+ ### boolish
256
+
257
+ Checks if a value is the string `"true"` or `"false"`.
258
+
259
+ ```js
260
+ import is from "@rcompat/is";
261
+
262
+ is.boolish("true"); // true
263
+ is.boolish("false"); // true
264
+ is.boolish(true); // false (not a string)
265
+ is.boolish("yes"); // false
266
+ is.boolish("1"); // false
267
+ ```
268
+
269
+ ## API Reference
270
+
271
+ All functions follow the same pattern:
272
+
273
+ ```ts
274
+ declare function is<Name>(value: unknown): value is <Type>;
275
+ ```
276
+
277
+ | Function | Type Guard | Description |
278
+ |---------------|---------------------|--------------------------------|
279
+ | `nullish` | `null \| undefined` | `null` or `undefined` |
280
+ | `defined` | `unknown` | not `undefined` |
281
+ | `truthy` | `unknown` | `true` in boolean contexts |
282
+ | `falsy` | `unknown` | `false` in boolean contexts |
283
+ | `empty` | `unknown` | empty collection/string/object |
284
+ | `blank` | `string` | empty/whitespace string |
285
+ | `numeric` | `string` | numeric string |
286
+ | `int` | `number` | integer number |
287
+ | `uint` | `number \| bigint` | unsigned (positive) integer |
288
+ | `safeint` | `number` | safe integer |
289
+ | `finite` | `number \| bigint` | finite number |
290
+ | `nan` | `number` | `NaN` |
291
+ | `primitive` | `Primitive` | primitive type |
292
+ | `dict` | `Dict` | plain object |
293
+ | `newable` | `Newable` | constructor |
294
+ | `boolish` | `"true" \| "false"` | boolean string |
295
+
296
+ ## Examples
297
+
298
+ ### Filter valid values
299
+
300
+ ```js
301
+ import is from "@rcompat/is";
302
+
303
+ const values = [1, null, 2, undefined, 3];
304
+
305
+ values.filter(is.defined); // [1, null, 2, 3]
306
+ values.filter(v => !is.nullish(v)); // [1, 2, 3]
307
+ ```
308
+
309
+ ### Parse configuration
310
+
311
+ ```js
312
+ import is from "@rcompat/is";
313
+
314
+ function parseEnvVar(value) {
315
+ if (is.boolish(value)) return value === "true";
316
+ if (is.numeric(value)) return Number(value);
317
+ return value;
318
+ }
319
+
320
+ parseEnvVar("true"); // true
321
+ parseEnvVar("42"); // 42
322
+ parseEnvVar("hello"); // "hello"
323
+ ```
324
+
325
+ ### Validate input
326
+
327
+ ```js
328
+ import is from "@rcompat/is";
329
+
330
+ function validateForm(data) {
331
+ const errors = [];
332
+
333
+ if (is.blank(data.name)) {
334
+ errors.push("Name is required");
335
+ }
336
+
337
+ if (!uint(data.age)) {
338
+ errors.push("Age must be a positive integer");
339
+ }
340
+
341
+ return errors;
342
+ }
343
+ ```
344
+
345
+ ### Type-safe guards
346
+
347
+ ```js
348
+ import is from "@rcompat/is";
349
+
350
+ function process(value) {
351
+ if (is.primitive(value)) {
352
+ // TypeScript knows: value is:
353
+ // string | number | boolean | bigint | symbol | null | undefined
354
+ return String(value);
355
+ }
356
+
357
+ if (is.dict(value)) {
358
+ // TypeScript knows: value is Record<string, unknown>
359
+ return JSON.stringify(value);
360
+ }
361
+
362
+ return "[complex object]";
363
+ }
364
+ ```
365
+
366
+ ## Cross-Runtime Compatibility
367
+
368
+ | Runtime | Supported |
369
+ |---------|-----------|
370
+ | Node.js | ✓ |
371
+ | Deno | ✓ |
372
+ | Bun | ✓ |
373
+
374
+ No configuration required — just import and use.
375
+
376
+ ## License
377
+
378
+ MIT
379
+
380
+ ## Contributing
381
+
382
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) in the repository root.
383
+
@@ -0,0 +1,3 @@
1
+ declare const _default: (arg: any) => arg is any[];
2
+ export default _default;
3
+ //# sourceMappingURL=array.d.ts.map
@@ -0,0 +1,2 @@
1
+ export default Array.isArray;
2
+ //# sourceMappingURL=array.js.map
@@ -0,0 +1,2 @@
1
+ export default function isDate(x: unknown): x is Date;
2
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1,4 @@
1
+ export default function isDate(x) {
2
+ return x instanceof Date;
3
+ }
4
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1,3 @@
1
+ import type Dict from "@rcompat/type/Dict";
2
+ export default function isDict(x: unknown): x is Dict;
3
+ //# sourceMappingURL=dict.d.ts.map
@@ -0,0 +1,7 @@
1
+ export default function isDict(x) {
2
+ if (typeof x !== "object" || x === null)
3
+ return false;
4
+ const prototype = Object.getPrototypeOf(x);
5
+ return prototype === Object.prototype || prototype === null;
6
+ }
7
+ //# sourceMappingURL=dict.js.map
@@ -5,12 +5,6 @@ export default function isEmpty(x) {
5
5
  return x.size === 0;
6
6
  if (typeof x === "object" && x !== null)
7
7
  return Object.keys(x).length === 0;
8
- if (x && typeof x === "object") {
9
- const prototype = Object.getPrototypeOf(x);
10
- if (prototype === Object.prototype || prototype === null) {
11
- return Object.keys(x).length === 0;
12
- }
13
- }
14
8
  return false;
15
9
  }
16
10
  //# sourceMappingURL=empty.js.map
@@ -1,10 +1,8 @@
1
1
  export default function isFinite(x) {
2
- if (typeof x === "bigint") {
2
+ if (typeof x === "bigint")
3
3
  return true;
4
- }
5
- if (typeof x === "number") {
4
+ if (typeof x === "number")
6
5
  return Number.isFinite(x);
7
- }
8
6
  return false;
9
7
  }
10
8
  //# sourceMappingURL=finite.js.map
@@ -0,0 +1,48 @@
1
+ import empty from "#empty";
2
+ import newable from "#newable";
3
+ import numeric from "#numeric";
4
+ import object from "#object";
5
+ import primitive from "#primitive";
6
+ import type Dict from "@rcompat/type/Dict";
7
+ import type Nullish from "@rcompat/type/Nullish";
8
+ declare function isDate(x: unknown): x is Date;
9
+ declare function isDefined(x: unknown): x is {} | null;
10
+ declare function isDict(x: unknown): x is Dict;
11
+ declare function isError(x: unknown): x is Error;
12
+ declare function isFalsy(x: unknown): boolean;
13
+ declare function isNullish(x: unknown): x is Nullish;
14
+ declare function isPromise(x: unknown): x is Promise<unknown>;
15
+ declare function isRegExp(x: unknown): x is RegExp;
16
+ declare function isTruthy(x: unknown): boolean;
17
+ declare function isURL(x: unknown): x is URL;
18
+ declare function isMap(x: unknown): x is Map<unknown, unknown>;
19
+ declare function isSet(x: unknown): x is Set<unknown>;
20
+ declare const _default: {
21
+ array: (arg: any) => arg is any[];
22
+ blank: (x: unknown) => x is string;
23
+ boolish: (x: unknown) => x is import("@rcompat/type/Boolish").default;
24
+ date: typeof isDate;
25
+ defined: typeof isDefined;
26
+ dict: typeof isDict;
27
+ empty: typeof empty;
28
+ error: typeof isError;
29
+ falsy: typeof isFalsy;
30
+ finite: (x: unknown) => x is bigint | number;
31
+ int: (x: unknown) => x is bigint | number;
32
+ map: typeof isMap;
33
+ nan: (x: unknown) => x is number;
34
+ newable: typeof newable;
35
+ nullish: typeof isNullish;
36
+ numeric: typeof numeric;
37
+ object: typeof object;
38
+ primitive: typeof primitive;
39
+ promise: typeof isPromise;
40
+ regexp: typeof isRegExp;
41
+ safeint: (x: unknown) => x is number;
42
+ set: typeof isSet;
43
+ truthy: typeof isTruthy;
44
+ uint: (x: unknown) => x is bigint | number;
45
+ url: typeof isURL;
46
+ };
47
+ export default _default;
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,74 @@
1
+ import empty from "#empty";
2
+ import newable from "#newable";
3
+ import numbers from "#numbers";
4
+ import numeric from "#numeric";
5
+ import object from "#object";
6
+ import primitive from "#primitive";
7
+ import strings from "#strings";
8
+ function isDate(x) {
9
+ return x instanceof Date;
10
+ }
11
+ function isDefined(x) {
12
+ return x !== undefined;
13
+ }
14
+ function isDict(x) {
15
+ if (typeof x !== "object" || x === null)
16
+ return false;
17
+ const prototype = Object.getPrototypeOf(x);
18
+ return prototype === Object.prototype || prototype === null;
19
+ }
20
+ function isError(x) {
21
+ return x instanceof Error;
22
+ }
23
+ function isFalsy(x) {
24
+ return !x;
25
+ }
26
+ function isNullish(x) {
27
+ return x === null || x === undefined;
28
+ }
29
+ function isPromise(x) {
30
+ return x instanceof Promise;
31
+ }
32
+ function isRegExp(x) {
33
+ return x instanceof RegExp;
34
+ }
35
+ function isTruthy(x) {
36
+ return !!x;
37
+ }
38
+ function isURL(x) {
39
+ return x instanceof URL;
40
+ }
41
+ function isMap(x) {
42
+ return x instanceof Map;
43
+ }
44
+ function isSet(x) {
45
+ return x instanceof Set;
46
+ }
47
+ export default {
48
+ array: Array.isArray,
49
+ blank: strings.isBlank,
50
+ boolish: strings.isBoolish,
51
+ date: isDate,
52
+ defined: isDefined,
53
+ dict: isDict,
54
+ empty,
55
+ error: isError,
56
+ falsy: isFalsy,
57
+ finite: numbers.isFinite,
58
+ int: numbers.isInt,
59
+ map: isMap,
60
+ nan: numbers.isNaN,
61
+ newable,
62
+ nullish: isNullish,
63
+ numeric,
64
+ object,
65
+ primitive,
66
+ promise: isPromise,
67
+ regexp: isRegExp,
68
+ safeint: numbers.isSafeint,
69
+ set: isSet,
70
+ truthy: isTruthy,
71
+ uint: numbers.isUint,
72
+ url: isURL,
73
+ };
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export default function isInt(x: unknown): x is number;
2
+ //# sourceMappingURL=int.d.ts.map
@@ -1,6 +1,6 @@
1
- export default function isInteger(x) {
1
+ export default function isInt(x) {
2
2
  if (typeof x === "number")
3
3
  return Number.isInteger(x);
4
4
  return false;
5
5
  }
6
- //# sourceMappingURL=integer.js.map
6
+ //# sourceMappingURL=int.js.map
@@ -0,0 +1,14 @@
1
+ declare function isFinite(x: unknown): x is bigint | number;
2
+ declare function isInt(x: unknown): x is bigint | number;
3
+ declare function isNaN(x: unknown): x is number;
4
+ declare function isSafeint(x: unknown): x is number;
5
+ declare function isUint(x: unknown): x is bigint | number;
6
+ declare const _default: {
7
+ isFinite: typeof isFinite;
8
+ isInt: typeof isInt;
9
+ isNaN: typeof isNaN;
10
+ isSafeint: typeof isSafeint;
11
+ isUint: typeof isUint;
12
+ };
13
+ export default _default;
14
+ //# sourceMappingURL=numbers.d.ts.map
@@ -0,0 +1,37 @@
1
+ function isFinite(x) {
2
+ if (typeof x === "bigint")
3
+ return true;
4
+ if (typeof x === "number")
5
+ return Number.isFinite(x);
6
+ return false;
7
+ }
8
+ function isInt(x) {
9
+ if (typeof x === "number")
10
+ return Number.isInteger(x);
11
+ if (typeof x === "bigint")
12
+ return true;
13
+ return false;
14
+ }
15
+ function isNaN(x) {
16
+ return typeof x === "number" && Number.isNaN(x);
17
+ }
18
+ function isSafeint(x) {
19
+ if (typeof x === "number")
20
+ return Number.isSafeInteger(x);
21
+ return false;
22
+ }
23
+ function isUint(x) {
24
+ if (typeof x === "bigint")
25
+ return x >= 0n;
26
+ if (typeof x === "number")
27
+ return Number.isInteger(x) && x >= 0;
28
+ return false;
29
+ }
30
+ export default {
31
+ isFinite,
32
+ isInt,
33
+ isNaN,
34
+ isSafeint,
35
+ isUint,
36
+ };
37
+ //# sourceMappingURL=numbers.js.map
@@ -1,12 +1,10 @@
1
1
  const DECIMAL = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
2
2
  export default function isNumeric(x) {
3
- if (typeof x !== "string") {
3
+ if (typeof x !== "string")
4
4
  return false;
5
- }
6
5
  const trimmed = x.trim();
7
- if (trimmed === "") {
6
+ if (trimmed === "")
8
7
  return false;
9
- }
10
8
  return DECIMAL.test(trimmed);
11
9
  }
12
10
  //# sourceMappingURL=numeric.js.map
@@ -0,0 +1,2 @@
1
+ export default function isObject(x: unknown): x is object;
2
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1,4 @@
1
+ export default function isObject(x) {
2
+ return typeof x === "object" && x !== null;
3
+ }
4
+ //# sourceMappingURL=object.js.map
@@ -1,8 +1,8 @@
1
1
  const primitives = [
2
- "string",
3
- "number",
4
- "boolean",
5
2
  "bigint",
3
+ "boolean",
4
+ "number",
5
+ "string",
6
6
  "symbol",
7
7
  "undefined",
8
8
  ];
@@ -0,0 +1,2 @@
1
+ export default function isPromise(x: unknown): x is Promise<unknown>;
2
+ //# sourceMappingURL=promise.d.ts.map
@@ -0,0 +1,4 @@
1
+ export default function isPromise(x) {
2
+ return x instanceof Promise;
3
+ }
4
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1,2 @@
1
+ export default function isRegExp(x: unknown): x is RegExp;
2
+ //# sourceMappingURL=regexp.d.ts.map
@@ -0,0 +1,4 @@
1
+ export default function isRegExp(x) {
2
+ return x instanceof RegExp;
3
+ }
4
+ //# sourceMappingURL=regexp.js.map
@@ -0,0 +1,2 @@
1
+ export default function isSafeint(x: unknown): x is number;
2
+ //# sourceMappingURL=safeint.d.ts.map
@@ -1,6 +1,6 @@
1
- export default function isSafeInteger(x) {
1
+ export default function isSafeint(x) {
2
2
  if (typeof x === "number")
3
3
  return Number.isSafeInteger(x);
4
4
  return false;
5
5
  }
6
- //# sourceMappingURL=safe-integer.js.map
6
+ //# sourceMappingURL=safeint.js.map
@@ -0,0 +1,9 @@
1
+ import type Boolish from "@rcompat/type/Boolish";
2
+ declare function isBlank(x: unknown): x is string;
3
+ declare function isBoolish(x: unknown): x is Boolish;
4
+ declare const _default: {
5
+ isBlank: typeof isBlank;
6
+ isBoolish: typeof isBoolish;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1,11 @@
1
+ function isBlank(x) {
2
+ return typeof x === "string" && /^\s*$/.test(x);
3
+ }
4
+ function isBoolish(x) {
5
+ return x === "true" || x === "false";
6
+ }
7
+ export default {
8
+ isBlank,
9
+ isBoolish,
10
+ };
11
+ //# sourceMappingURL=strings.js.map
@@ -1,5 +1,5 @@
1
- import isInteger from "#integer";
1
+ import int from "#int";
2
2
  export default function isUint(x) {
3
- return isInteger(x) && BigInt(x) > 0n;
3
+ return int(x) && BigInt(x) >= 0n;
4
4
  }
5
5
  //# sourceMappingURL=uint.js.map
@@ -0,0 +1,2 @@
1
+ export default function isURL(x: unknown): x is URL;
2
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1,4 @@
1
+ export default function isURL(x) {
2
+ return x instanceof URL;
3
+ }
4
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rcompat/is",
3
- "version": "0.1.3",
4
- "description": "Standard library value qualifying",
3
+ "version": "0.2.0",
4
+ "description": "Standard library identity checks",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",
7
7
  "files": [
@@ -22,9 +22,9 @@
22
22
  }
23
23
  },
24
24
  "exports": {
25
- "./*": {
26
- "apekit": "./src/public/*.ts",
27
- "default": "./lib/public/*.js"
25
+ ".": {
26
+ "apekit": "./src/public/index.ts",
27
+ "default": "./lib/public/index.js"
28
28
  }
29
29
  },
30
30
  "scripts": {
@@ -1,2 +0,0 @@
1
- export default function isInteger(x: unknown): x is number;
2
- //# sourceMappingURL=integer.d.ts.map
@@ -1,2 +0,0 @@
1
- export default function isSafeInteger(x: unknown): x is number;
2
- //# sourceMappingURL=safe-integer.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#blank";
2
- //# sourceMappingURL=blank.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#blank";
2
- //# sourceMappingURL=blank.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#boolish";
2
- //# sourceMappingURL=boolish.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#boolish";
2
- //# sourceMappingURL=boolish.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#defined";
2
- //# sourceMappingURL=defined.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#defined";
2
- //# sourceMappingURL=defined.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#empty";
2
- //# sourceMappingURL=empty.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#empty";
2
- //# sourceMappingURL=empty.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#falsy";
2
- //# sourceMappingURL=falsy.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#falsy";
2
- //# sourceMappingURL=falsy.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#finite";
2
- //# sourceMappingURL=finite.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#finite";
2
- //# sourceMappingURL=finite.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#integer";
2
- //# sourceMappingURL=integer.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#integer";
2
- //# sourceMappingURL=integer.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#nan";
2
- //# sourceMappingURL=nan.d.ts.map
package/lib/public/nan.js DELETED
@@ -1,2 +0,0 @@
1
- export { default } from "#nan";
2
- //# sourceMappingURL=nan.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#newable";
2
- //# sourceMappingURL=newable.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#newable";
2
- //# sourceMappingURL=newable.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#nullish";
2
- //# sourceMappingURL=nullish.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#nullish";
2
- //# sourceMappingURL=nullish.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#numeric";
2
- //# sourceMappingURL=numeric.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#numeric";
2
- //# sourceMappingURL=numeric.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#primitive";
2
- //# sourceMappingURL=primitive.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#primitive";
2
- //# sourceMappingURL=primitive.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#safe-integer";
2
- //# sourceMappingURL=safe-integer.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#safe-integer";
2
- //# sourceMappingURL=safe-integer.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#truthy";
2
- //# sourceMappingURL=truthy.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#truthy";
2
- //# sourceMappingURL=truthy.js.map
@@ -1,2 +0,0 @@
1
- export { default } from "#uint";
2
- //# sourceMappingURL=uint.d.ts.map
@@ -1,2 +0,0 @@
1
- export { default } from "#uint";
2
- //# sourceMappingURL=uint.js.map