@rcompat/is 0.4.1 → 0.4.3

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.
@@ -5,9 +5,11 @@ import object from "#object";
5
5
  import primitive from "#primitive";
6
6
  import type { Dict, Nullish, UnknownFunction } from "@rcompat/type";
7
7
  declare function isArray(x: unknown): x is unknown[];
8
+ declare function isArrayBuffer(x: unknown): x is ArrayBuffer;
8
9
  declare function isBigint(x: unknown): x is bigint;
9
10
  declare function isBlob(x: unknown): x is Blob;
10
11
  declare function isBoolean(x: unknown): x is boolean;
12
+ declare function isBytes(x: unknown): x is Uint8Array;
11
13
  declare function isDate(x: unknown): x is Date;
12
14
  declare function isDefined(x: unknown): x is {} | null;
13
15
  declare function isDict(x: unknown): x is Dict;
@@ -22,6 +24,8 @@ declare function isNullish(x: unknown): x is Nullish;
22
24
  declare function isNumber(x: unknown): x is number;
23
25
  declare function isPromise(x: unknown): x is Promise<unknown>;
24
26
  declare function isRegExp(x: unknown): x is RegExp;
27
+ declare function isRequest(x: unknown): x is Request;
28
+ declare function isResponse(x: unknown): x is Response;
25
29
  declare function isSet(x: unknown): x is Set<unknown>;
26
30
  declare function isString(x: unknown): x is string;
27
31
  declare function isSymbol(x: unknown): x is symbol;
@@ -31,11 +35,13 @@ declare function isUndefined(x: unknown): x is undefined;
31
35
  declare function isURL(x: unknown): x is URL;
32
36
  declare const _default: {
33
37
  array: typeof isArray;
38
+ arraybuffer: typeof isArrayBuffer;
34
39
  bigint: typeof isBigint;
35
40
  blank: (x: unknown) => x is string;
36
41
  blob: typeof isBlob;
37
42
  boolish: (x: unknown) => x is import("@rcompat/type").Boolish;
38
43
  boolean: typeof isBoolean;
44
+ bytes: typeof isBytes;
39
45
  date: typeof isDate;
40
46
  defined: typeof isDefined;
41
47
  dict: typeof isDict;
@@ -49,8 +55,8 @@ declare const _default: {
49
55
  iterable: typeof isIterable;
50
56
  map: typeof isMap;
51
57
  nan: (x: unknown) => x is number;
58
+ nonempty: <T>(x: T | Nullish) => x is T;
52
59
  newable: typeof newable;
53
- nonempty: (x: unknown) => boolean;
54
60
  null: typeof isNull;
55
61
  nullish: typeof isNullish;
56
62
  number: typeof isNumber;
@@ -58,6 +64,8 @@ declare const _default: {
58
64
  object: typeof object;
59
65
  primitive: typeof primitive;
60
66
  promise: typeof isPromise;
67
+ request: typeof isRequest;
68
+ response: typeof isResponse;
61
69
  regexp: typeof isRegExp;
62
70
  safeint: (x: unknown) => x is number;
63
71
  set: typeof isSet;
@@ -8,6 +8,9 @@ import strings from "#strings";
8
8
  function isArray(x) {
9
9
  return Array.isArray(x);
10
10
  }
11
+ function isArrayBuffer(x) {
12
+ return x instanceof ArrayBuffer;
13
+ }
11
14
  function isBigint(x) {
12
15
  return typeof x === "bigint";
13
16
  }
@@ -17,6 +20,9 @@ function isBlob(x) {
17
20
  function isBoolean(x) {
18
21
  return typeof x === "boolean";
19
22
  }
23
+ function isBytes(x) {
24
+ return x instanceof Uint8Array;
25
+ }
20
26
  function isDate(x) {
21
27
  return x instanceof Date;
22
28
  }
@@ -62,6 +68,12 @@ function isPromise(x) {
62
68
  function isRegExp(x) {
63
69
  return x instanceof RegExp;
64
70
  }
71
+ function isRequest(x) {
72
+ return x instanceof Request;
73
+ }
74
+ function isResponse(x) {
75
+ return x instanceof Response;
76
+ }
65
77
  function isSet(x) {
66
78
  return x instanceof Set;
67
79
  }
@@ -85,11 +97,13 @@ function isURL(x) {
85
97
  }
86
98
  export default {
87
99
  array: isArray,
100
+ arraybuffer: isArrayBuffer,
88
101
  bigint: isBigint,
89
102
  blank: strings.isBlank,
90
103
  blob: isBlob,
91
104
  boolish: strings.isBoolish,
92
105
  boolean: isBoolean,
106
+ bytes: isBytes,
93
107
  date: isDate,
94
108
  defined: isDefined,
95
109
  dict: isDict,
@@ -103,8 +117,8 @@ export default {
103
117
  iterable: isIterable,
104
118
  map: isMap,
105
119
  nan: numbers.isNaN,
106
- newable,
107
120
  nonempty: (x) => !empty(x),
121
+ newable,
108
122
  null: isNull,
109
123
  nullish: isNullish,
110
124
  number: isNumber,
@@ -112,8 +126,10 @@ export default {
112
126
  object,
113
127
  primitive,
114
128
  promise: isPromise,
129
+ request: isRequest,
130
+ response: isResponse,
115
131
  regexp: isRegExp,
116
- safeint: numbers.isSafeint,
132
+ safeint: numbers.isSafeInt,
117
133
  set: isSet,
118
134
  string: isString,
119
135
  symbol: isSymbol,
@@ -1,13 +1,13 @@
1
1
  declare function isFinite(x: unknown): x is bigint | number;
2
2
  declare function isInt(x: unknown): x is bigint | number;
3
3
  declare function isNaN(x: unknown): x is number;
4
- declare function isSafeint(x: unknown): x is number;
4
+ declare function isSafeInt(x: unknown): x is number;
5
5
  declare function isUint(x: unknown): x is bigint | number;
6
6
  declare const _default: {
7
7
  isFinite: typeof isFinite;
8
8
  isInt: typeof isInt;
9
9
  isNaN: typeof isNaN;
10
- isSafeint: typeof isSafeint;
10
+ isSafeInt: typeof isSafeInt;
11
11
  isUint: typeof isUint;
12
12
  };
13
13
  export default _default;
@@ -15,7 +15,7 @@ function isInt(x) {
15
15
  function isNaN(x) {
16
16
  return typeof x === "number" && Number.isNaN(x);
17
17
  }
18
- function isSafeint(x) {
18
+ function isSafeInt(x) {
19
19
  if (typeof x === "number")
20
20
  return Number.isSafeInteger(x);
21
21
  return false;
@@ -31,7 +31,7 @@ export default {
31
31
  isFinite,
32
32
  isInt,
33
33
  isNaN,
34
- isSafeint,
34
+ isSafeInt,
35
35
  isUint,
36
36
  };
37
37
  //# sourceMappingURL=numbers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcompat/is",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Standard library identity checks",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",