@magic/types 0.1.32 → 0.1.33
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/README.md +6 -1
- package/package.json +3 -3
- package/src/fns.js +3 -2
- package/types/fns.d.ts +1 -1
- package/types/index.d.ts +3 -3
- package/types/lib.d.ts +3 -3
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"author": "Wizards & Witches",
|
|
5
5
|
"homepage": "https://github.com/magic/types",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@magic-themes/docs": "0.0.15",
|
|
47
47
|
"@magic/core": "0.0.156",
|
|
48
48
|
"@magic/format": "0.0.72",
|
|
49
|
-
"@magic/test": "0.2.
|
|
50
|
-
"typescript": "
|
|
49
|
+
"@magic/test": "0.2.30",
|
|
50
|
+
"typescript": "6.0.2"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"magic",
|
package/src/fns.js
CHANGED
|
@@ -520,9 +520,10 @@ export const isNone = (arr, t) => !isSome(arr, t)
|
|
|
520
520
|
|
|
521
521
|
/**
|
|
522
522
|
* Check if a value is an instance of a given constructor
|
|
523
|
+
* @template T
|
|
523
524
|
* @param {unknown} e - value to check
|
|
524
|
-
* @param {new (...args: any[]) =>
|
|
525
|
-
* @returns {
|
|
525
|
+
* @param {new (...args: any[]) => T} t - constructor function
|
|
526
|
+
* @returns {e is T} - true if value is an instance of constructor
|
|
526
527
|
*/
|
|
527
528
|
export const isInstanceOf = (e, t) => (!t ? false : e instanceof t)
|
|
528
529
|
|
package/types/fns.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ export function isComparable(a: unknown): a is string | number | boolean
|
|
|
140
140
|
export function isEvery<T>(arr: T | T[], t: ((v: T) => boolean) | string): boolean
|
|
141
141
|
export function isSome<T>(arr: T | T[], t: ((v: T) => boolean) | string): boolean
|
|
142
142
|
export function isNone<T>(arr: T | T[], t: ((v: T) => boolean) | string): boolean
|
|
143
|
-
export function isInstanceOf(e: unknown, t: new (...args: any[]) =>
|
|
143
|
+
export function isInstanceOf<T>(e: unknown, t: new (...args: any[]) => T): e is T
|
|
144
144
|
export function isError(e: unknown): e is Error
|
|
145
145
|
export function isDate(e: unknown): e is Date
|
|
146
146
|
export function isRegExp(e: unknown): e is RegExp
|
package/types/index.d.ts
CHANGED
|
@@ -480,9 +480,9 @@ export const is: {
|
|
|
480
480
|
all: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
481
481
|
some: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
482
482
|
none: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
483
|
-
instance: (e: unknown, t: new (...args: any[]) =>
|
|
484
|
-
instanceof: (e: unknown, t: new (...args: any[]) =>
|
|
485
|
-
instanceOf: (e: unknown, t: new (...args: any[]) =>
|
|
483
|
+
instance: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
484
|
+
instanceof: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
485
|
+
instanceOf: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
486
486
|
isCase: ((s: unknown, c?: 'up' | 'down') => boolean) & {
|
|
487
487
|
upper: (s: unknown) => boolean
|
|
488
488
|
lower: (s: unknown) => boolean
|
package/types/lib.d.ts
CHANGED
|
@@ -478,9 +478,9 @@ export const is: {
|
|
|
478
478
|
all: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
479
479
|
some: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
480
480
|
none: <T>(arr: T | T[], t: ((v: T) => boolean) | string) => boolean
|
|
481
|
-
instance: (e: unknown, t: new (...args: any[]) =>
|
|
482
|
-
instanceof: (e: unknown, t: new (...args: any[]) =>
|
|
483
|
-
instanceOf: (e: unknown, t: new (...args: any[]) =>
|
|
481
|
+
instance: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
482
|
+
instanceof: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
483
|
+
instanceOf: <T>(e: unknown, t: new (...args: any[]) => T) => e is T
|
|
484
484
|
isCase: ((s: unknown, c?: 'up' | 'down') => boolean) & {
|
|
485
485
|
upper: (s: unknown) => boolean
|
|
486
486
|
lower: (s: unknown) => boolean
|