Comparing version 3.6.0 to 3.7.0
@@ -139,3 +139,3 @@ 'use strict'; | ||
/** | ||
* Returns whether the payload is a regular expression | ||
* Returns whether the payload is a regular expression (RegExp) | ||
* | ||
@@ -158,3 +158,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a date, and that the date is Valid | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
@@ -168,3 +168,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a blob | ||
* Returns whether the payload is a Blob | ||
* | ||
@@ -178,3 +178,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a file | ||
* Returns whether the payload is a File | ||
* | ||
@@ -188,3 +188,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a promise | ||
* Returns whether the payload is a Promise | ||
* | ||
@@ -198,2 +198,11 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Error} | ||
*/ | ||
function isError(payload) { | ||
return getType(payload) === 'Error'; | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -251,2 +260,3 @@ * | ||
exports.isEmptyString = isEmptyString; | ||
exports.isError = isError; | ||
exports.isFile = isFile; | ||
@@ -253,0 +263,0 @@ exports.isFullString = isFullString; |
@@ -135,3 +135,3 @@ /** | ||
/** | ||
* Returns whether the payload is a regular expression | ||
* Returns whether the payload is a regular expression (RegExp) | ||
* | ||
@@ -154,3 +154,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a date, and that the date is Valid | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
@@ -164,3 +164,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a blob | ||
* Returns whether the payload is a Blob | ||
* | ||
@@ -174,3 +174,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a file | ||
* Returns whether the payload is a File | ||
* | ||
@@ -184,3 +184,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a promise | ||
* Returns whether the payload is a Promise | ||
* | ||
@@ -194,2 +194,11 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Error} | ||
*/ | ||
function isError(payload) { | ||
return getType(payload) === 'Error'; | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -240,2 +249,2 @@ * | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyString, isFile, isFullString, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRegExp, isString, isSymbol, isType, isUndefined }; | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyString, isError, isFile, isFullString, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRegExp, isString, isSymbol, isType, isUndefined }; |
{ | ||
"name": "is-what", | ||
"sideEffects": false, | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.", | ||
@@ -70,9 +70,5 @@ "main": "dist/index.cjs.js", | ||
"ava": { | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
"extensions": ["ts"], | ||
"require": ["ts-node/register"] | ||
} | ||
} |
@@ -148,3 +148,3 @@ /** | ||
/** | ||
* Returns whether the payload is a regular expression | ||
* Returns whether the payload is a regular expression (RegExp) | ||
* | ||
@@ -169,3 +169,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a date, and that the date is Valid | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
@@ -180,3 +180,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a blob | ||
* Returns whether the payload is a Blob | ||
* | ||
@@ -191,3 +191,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a file | ||
* Returns whether the payload is a File | ||
* | ||
@@ -202,3 +202,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a promise | ||
* Returns whether the payload is a Promise | ||
* | ||
@@ -213,2 +213,12 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Error} | ||
*/ | ||
export function isError (payload: any): payload is Error { | ||
return getType(payload) === 'Error' | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -215,0 +225,0 @@ * |
import test from 'ava' | ||
import { | ||
isError, | ||
isObject, | ||
@@ -29,2 +30,3 @@ isPlainObject, | ||
test('Basic true tests', t => { | ||
t.is(isError(new Error('')), true) | ||
t.is(isUndefined(undefined), true) | ||
@@ -60,2 +62,3 @@ t.is(isNull(null), true) | ||
test('Basic false tests', t => { | ||
t.is(isError({}), false) | ||
t.is(isNumber(NaN), false) | ||
@@ -62,0 +65,0 @@ t.is(isDate(new Date('_')), false) |
@@ -111,3 +111,3 @@ /** | ||
/** | ||
* Returns whether the payload is a regular expression | ||
* Returns whether the payload is a regular expression (RegExp) | ||
* | ||
@@ -126,3 +126,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a date, and that the date is Valid | ||
* Returns whether the payload is a Date, and that the date is valid | ||
* | ||
@@ -134,3 +134,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a blob | ||
* Returns whether the payload is a Blob | ||
* | ||
@@ -142,3 +142,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a file | ||
* Returns whether the payload is a File | ||
* | ||
@@ -150,3 +150,3 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is a promise | ||
* Returns whether the payload is a Promise | ||
* | ||
@@ -158,2 +158,9 @@ * @param {*} payload | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Error} | ||
*/ | ||
export declare function isError(payload: any): payload is Error; | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -160,0 +167,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49998
1377