is-what
Advanced tools
Comparing version 3.10.0 to 3.11.0
@@ -101,2 +101,11 @@ 'use strict'; | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {*} payload | ||
* @returns {payload is []} | ||
*/ | ||
function isEmptyArray(payload) { | ||
return isArray(payload) && payload.length === 0; | ||
} | ||
/** | ||
* Returns whether the payload is a string | ||
@@ -308,2 +317,3 @@ * | ||
exports.isDate = isDate; | ||
exports.isEmptyArray = isEmptyArray; | ||
exports.isEmptyObject = isEmptyObject; | ||
@@ -310,0 +320,0 @@ exports.isEmptyString = isEmptyString; |
@@ -97,2 +97,11 @@ /** | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {*} payload | ||
* @returns {payload is []} | ||
*/ | ||
function isEmptyArray(payload) { | ||
return isArray(payload) && payload.length === 0; | ||
} | ||
/** | ||
* Returns whether the payload is a string | ||
@@ -298,2 +307,2 @@ * | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyObject, isEmptyString, isError, isFile, isFullString, isFunction, isMap, isNaNValue, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet }; | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isFile, isFullString, isFunction, isMap, isNaNValue, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet }; |
{ | ||
"name": "is-what", | ||
"sideEffects": false, | ||
"version": "3.10.0", | ||
"version": "3.11.0", | ||
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.", | ||
@@ -50,26 +50,31 @@ "main": "dist/index.cjs.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/core": "^7.11.0", | ||
"@types/babel-core": "^6.25.6", | ||
"@types/jest": "^25.2.1", | ||
"@typescript-eslint/eslint-plugin": "^2.27.0", | ||
"@typescript-eslint/parser": "^2.27.0", | ||
"ava": "^3.6.0", | ||
"@types/jest": "^25.2.3", | ||
"@typescript-eslint/eslint-plugin": "^2.34.0", | ||
"@typescript-eslint/parser": "^2.34.0", | ||
"ava": "^3.11.0", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^25.3.0", | ||
"babel-jest": "^25.5.1", | ||
"babel-preset-env": "^1.7.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-tree-shaking": "^1.8.0", | ||
"jest": "^25.3.0", | ||
"regenerator-runtime": "^0.13.5", | ||
"jest": "^25.5.4", | ||
"regenerator-runtime": "^0.13.7", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"tsconfig-paths": "^3.9.0", | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3" | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.7" | ||
}, | ||
"ava": { | ||
"extensions": ["ts"], | ||
"require": ["tsconfig-paths/register", "ts-node/register"] | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"tsconfig-paths/register", | ||
"ts-node/register" | ||
] | ||
} | ||
} |
@@ -106,2 +106,12 @@ /** | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {*} payload | ||
* @returns {payload is []} | ||
*/ | ||
export function isEmptyArray (payload: any): payload is [] { | ||
return isArray(payload) && payload.length === 0 | ||
} | ||
/** | ||
* Returns whether the payload is a string | ||
@@ -108,0 +118,0 @@ * |
import test from 'ava' | ||
import { | ||
isError, | ||
isEmptyArray, | ||
isObject, | ||
@@ -110,2 +111,20 @@ isPlainObject, | ||
test('isEmptyArray', t => { | ||
t.is(isEmptyArray([]), true) | ||
t.is(isEmptyArray(new Array()), true) | ||
t.is(isEmptyArray(new Array(0)), true) | ||
t.is(isEmptyArray(new Array(1)), false) | ||
t.is(isEmptyArray([undefined]), false) | ||
t.is(isEmptyArray(null), false) | ||
t.is(isEmptyArray(new Date()), false) | ||
t.is(isEmptyArray(new Error('')), false) | ||
t.is(isEmptyArray(new Date()), false) | ||
t.is(isEmptyArray(Symbol()), false) | ||
t.is(isEmptyArray(new Map()), false) | ||
t.is(isEmptyArray(new WeakMap()), false) | ||
t.is(isEmptyArray(new Set()), false) | ||
t.is(isEmptyArray(new WeakSet()), false) | ||
}) | ||
test('NaN tests', t => { | ||
@@ -112,0 +131,0 @@ t.is(isNaNValue(NaN), true) |
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"declaration": true, | ||
@@ -4,0 +5,0 @@ "declarationDir": "./types/" |
@@ -81,2 +81,9 @@ /** | ||
/** | ||
* Returns whether the payload is a an empty array | ||
* | ||
* @param {*} payload | ||
* @returns {payload is []} | ||
*/ | ||
export declare function isEmptyArray(payload: any): payload is []; | ||
/** | ||
* Returns whether the payload is a string | ||
@@ -83,0 +90,0 @@ * |
58986
1706