-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
181 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns the object type of the given payload | ||
* | ||
* @param {any} payload | ||
* @returns {string} | ||
*/ | ||
export declare function getType(payload: any): string; | ||
/** Returns the object type of the given payload */ | ||
export declare function getType(payload: unknown): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
/** | ||
* Returns the object type of the given payload | ||
* | ||
* @param {any} payload | ||
* @returns {string} | ||
*/ | ||
/** Returns the object type of the given payload */ | ||
export function getType(payload) { | ||
return Object.prototype.toString.call(payload).slice(8, -1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is an array | ||
* | ||
* @param {any} payload | ||
* @returns {payload is any[]} | ||
*/ | ||
export declare function isArray(payload: any): payload is any[]; | ||
/** Returns whether the payload is an array */ | ||
export declare function isArray(payload: unknown): payload is unknown[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is an array | ||
* | ||
* @param {any} payload | ||
* @returns {payload is any[]} | ||
*/ | ||
/** Returns whether the payload is an array */ | ||
export function isArray(payload) { | ||
return getType(payload) === 'Array'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a Blob | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Blob} | ||
*/ | ||
export declare function isBlob(payload: any): payload is Blob; | ||
/** Returns whether the payload is a Blob */ | ||
export declare function isBlob(payload: unknown): payload is Blob; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is a Blob | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Blob} | ||
*/ | ||
/** Returns whether the payload is a Blob */ | ||
export function isBlob(payload) { | ||
return getType(payload) === 'Blob'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a boolean | ||
* | ||
* @param {any} payload | ||
* @returns {payload is boolean} | ||
*/ | ||
export declare function isBoolean(payload: any): payload is boolean; | ||
/** Returns whether the payload is a boolean */ | ||
export declare function isBoolean(payload: unknown): payload is boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is a boolean | ||
* | ||
* @param {any} payload | ||
* @returns {payload is boolean} | ||
*/ | ||
/** Returns whether the payload is a boolean */ | ||
export function isBoolean(payload) { | ||
return getType(payload) === 'Boolean'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Date} | ||
*/ | ||
export declare function isDate(payload: any): payload is Date; | ||
/** Returns whether the payload is a Date, and that the date is valid */ | ||
export declare function isDate(payload: unknown): payload is Date; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Date} | ||
*/ | ||
/** Returns whether the payload is a Date, and that the date is valid */ | ||
export function isDate(payload) { | ||
return getType(payload) === 'Date' && !isNaN(payload); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {any} payload | ||
* @returns {payload is []} | ||
*/ | ||
export declare function isEmptyArray(payload: any): payload is []; | ||
/** Returns whether the payload is a an empty array */ | ||
export declare function isEmptyArray(payload: unknown): payload is []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { isArray } from './isArray.js'; | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {any} payload | ||
* @returns {payload is []} | ||
*/ | ||
/** Returns whether the payload is a an empty array */ | ||
export function isEmptyArray(payload) { | ||
return isArray(payload) && payload.length === 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
/** | ||
* Returns whether the payload is a an empty object (excluding special classes or objects with other | ||
* prototypes) | ||
* | ||
* @param {any} payload | ||
* @returns {payload is { [K in any]: never }} | ||
*/ | ||
export declare function isEmptyObject(payload: any): payload is { | ||
[K in any]: never; | ||
export declare function isEmptyObject(payload: unknown): payload is { | ||
[K in string | symbol | number]: never; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is '' | ||
* | ||
* @param {any} payload | ||
* @returns {payload is string} | ||
*/ | ||
export declare function isEmptyString(payload: any): payload is string; | ||
/** Returns whether the payload is '' */ | ||
export declare function isEmptyString(payload: unknown): payload is string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
/** | ||
* Returns whether the payload is '' | ||
* | ||
* @param {any} payload | ||
* @returns {payload is string} | ||
*/ | ||
/** Returns whether the payload is '' */ | ||
export function isEmptyString(payload) { | ||
return payload === ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Error} | ||
*/ | ||
export declare function isError(payload: any): payload is Error; | ||
/** Returns whether the payload is an Error */ | ||
export declare function isError(payload: unknown): payload is Error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Error} | ||
*/ | ||
/** Returns whether the payload is an Error */ | ||
export function isError(payload) { | ||
return getType(payload) === 'Error' || payload instanceof Error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a File | ||
* | ||
* @param {any} payload | ||
* @returns {payload is File} | ||
*/ | ||
export declare function isFile(payload: any): payload is File; | ||
/** Returns whether the payload is a File */ | ||
export declare function isFile(payload: unknown): payload is File; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is a File | ||
* | ||
* @param {any} payload | ||
* @returns {payload is File} | ||
*/ | ||
/** Returns whether the payload is a File */ | ||
export function isFile(payload) { | ||
return getType(payload) === 'File'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a an array with at least 1 item | ||
* | ||
* @param {any} payload | ||
* @returns {payload is any[]} | ||
*/ | ||
export declare function isFullArray(payload: any): payload is any[]; | ||
/** Returns whether the payload is a an array with at least 1 item */ | ||
export declare function isFullArray(payload: unknown): payload is unknown[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { isArray } from './isArray.js'; | ||
/** | ||
* Returns whether the payload is a an array with at least 1 item | ||
* | ||
* @param {any} payload | ||
* @returns {payload is any[]} | ||
*/ | ||
/** Returns whether the payload is a an array with at least 1 item */ | ||
export function isFullArray(payload) { | ||
return isArray(payload) && payload.length > 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a string, BUT returns false for '' | ||
* | ||
* @param {any} payload | ||
* @returns {payload is string} | ||
*/ | ||
export declare function isFullString(payload: any): payload is string; | ||
/** Returns whether the payload is a string, BUT returns false for '' */ | ||
export declare function isFullString(payload: unknown): payload is string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { isString } from './isString.js'; | ||
/** | ||
* Returns whether the payload is a string, BUT returns false for '' | ||
* | ||
* @param {any} payload | ||
* @returns {payload is string} | ||
*/ | ||
/** Returns whether the payload is a string, BUT returns false for '' */ | ||
export function isFullString(payload) { | ||
return isString(payload) && payload !== ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
export type AnyFunction = (...args: any[]) => any; | ||
/** | ||
* Returns whether the payload is a function (regular or async) | ||
* | ||
* @param {any} payload | ||
* @returns {payload is AnyFunction} | ||
*/ | ||
export declare function isFunction(payload: any): payload is AnyFunction; | ||
export type AnyFunction = (...args: unknown[]) => unknown; | ||
/** Returns whether the payload is a function (regular or async) */ | ||
export declare function isFunction(payload: unknown): payload is AnyFunction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
/** | ||
* Returns whether the payload is a function (regular or async) | ||
* | ||
* @param {any} payload | ||
* @returns {payload is AnyFunction} | ||
*/ | ||
/** Returns whether the payload is a function (regular or async) */ | ||
export function isFunction(payload) { | ||
return typeof payload === 'function'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Map<any, any>} | ||
*/ | ||
export declare function isMap(payload: any): payload is Map<any, any>; | ||
/** Returns whether the payload is a Map */ | ||
export declare function isMap(payload: unknown): payload is Map<unknown, unknown>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { getType } from './getType.js'; | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {any} payload | ||
* @returns {payload is Map<any, any>} | ||
*/ | ||
/** Returns whether the payload is a Map */ | ||
export function isMap(payload) { | ||
return getType(payload) === 'Map'; | ||
} |
Oops, something went wrong.