@rcompat/is 0.4.0 → 0.4.2

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