Comparing version 3.7.1 to 3.8.0
@@ -148,2 +148,38 @@ 'use strict'; | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Map} | ||
*/ | ||
function isMap(payload) { | ||
return getType(payload) === 'Map'; | ||
} | ||
/** | ||
* Returns whether the payload is a WeakMap | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakMap} | ||
*/ | ||
function isWeakMap(payload) { | ||
return getType(payload) === 'WeakMap'; | ||
} | ||
/** | ||
* Returns whether the payload is a Set | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Set} | ||
*/ | ||
function isSet(payload) { | ||
return getType(payload) === 'Set'; | ||
} | ||
/** | ||
* Returns whether the payload is a WeakSet | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakSet} | ||
*/ | ||
function isWeakSet(payload) { | ||
return getType(payload) === 'WeakSet'; | ||
} | ||
/** | ||
* Returns whether the payload is a Symbol | ||
@@ -259,2 +295,3 @@ * | ||
exports.isFunction = isFunction; | ||
exports.isMap = isMap; | ||
exports.isNull = isNull; | ||
@@ -269,2 +306,3 @@ exports.isNullOrUndefined = isNullOrUndefined; | ||
exports.isRegExp = isRegExp; | ||
exports.isSet = isSet; | ||
exports.isString = isString; | ||
@@ -274,1 +312,3 @@ exports.isSymbol = isSymbol; | ||
exports.isUndefined = isUndefined; | ||
exports.isWeakMap = isWeakMap; | ||
exports.isWeakSet = isWeakSet; |
@@ -144,2 +144,38 @@ /** | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Map} | ||
*/ | ||
function isMap(payload) { | ||
return getType(payload) === 'Map'; | ||
} | ||
/** | ||
* Returns whether the payload is a WeakMap | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakMap} | ||
*/ | ||
function isWeakMap(payload) { | ||
return getType(payload) === 'WeakMap'; | ||
} | ||
/** | ||
* Returns whether the payload is a Set | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Set} | ||
*/ | ||
function isSet(payload) { | ||
return getType(payload) === 'Set'; | ||
} | ||
/** | ||
* Returns whether the payload is a WeakSet | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakSet} | ||
*/ | ||
function isWeakSet(payload) { | ||
return getType(payload) === 'WeakSet'; | ||
} | ||
/** | ||
* Returns whether the payload is a Symbol | ||
@@ -244,2 +280,2 @@ * | ||
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 }; | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyString, isError, isFile, isFullString, isFunction, isMap, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet }; |
{ | ||
"name": "is-what", | ||
"sideEffects": false, | ||
"version": "3.7.1", | ||
"version": "3.8.0", | ||
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.", | ||
@@ -50,25 +50,29 @@ "main": "dist/index.cjs.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.7", | ||
"@babel/core": "^7.9.0", | ||
"@types/babel-core": "^6.25.6", | ||
"@types/jest": "^25.1.4", | ||
"@typescript-eslint/eslint-plugin": "^2.23.0", | ||
"@typescript-eslint/parser": "^2.23.0", | ||
"ava": "^3.5.0", | ||
"@types/jest": "^25.2.1", | ||
"@typescript-eslint/eslint-plugin": "^2.27.0", | ||
"@typescript-eslint/parser": "^2.27.0", | ||
"ava": "^3.6.0", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^25.1.0", | ||
"babel-jest": "^25.3.0", | ||
"babel-preset-env": "^1.7.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-tree-shaking": "^1.8.0", | ||
"jest": "^25.1.0", | ||
"jest": "^25.3.0", | ||
"regenerator-runtime": "^0.13.5", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"ts-node": "^8.6.2", | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3" | ||
}, | ||
"ava": { | ||
"extensions": ["ts"], | ||
"require": ["ts-node/register"] | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
} | ||
} |
@@ -158,2 +158,42 @@ /** | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Map} | ||
*/ | ||
export function isMap (payload: any): payload is Map<any, any> { | ||
return getType(payload) === 'Map' | ||
} | ||
/** | ||
* Returns whether the payload is a WeakMap | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakMap} | ||
*/ | ||
export function isWeakMap (payload: any): payload is WeakMap<any, any> { | ||
return getType(payload) === 'WeakMap' | ||
} | ||
/** | ||
* Returns whether the payload is a Set | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Set} | ||
*/ | ||
export function isSet (payload: any): payload is Set<any> { | ||
return getType(payload) === 'Set' | ||
} | ||
/** | ||
* Returns whether the payload is a WeakSet | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakSet} | ||
*/ | ||
export function isWeakSet (payload: any): payload is WeakSet<any> { | ||
return getType(payload) === 'WeakSet' | ||
} | ||
/** | ||
* Returns whether the payload is a Symbol | ||
@@ -160,0 +200,0 @@ * |
@@ -22,2 +22,6 @@ import test from 'ava' | ||
isType, | ||
isMap, | ||
isWeakMap, | ||
isSet, | ||
isWeakSet, | ||
// isBlob, | ||
@@ -56,2 +60,6 @@ // isFile, | ||
t.is(isSymbol(Symbol()), true) | ||
t.is(isMap(new Map()), true) | ||
t.is(isWeakMap(new WeakMap()), true) | ||
t.is(isSet(new Set()), true) | ||
t.is(isWeakSet(new WeakSet()), true) | ||
// t.is(isBlob(blob), true) | ||
@@ -78,2 +86,6 @@ // t.is(isFile(new File([''], '', { type: 'text/html' })), true) | ||
t.is(isSymbol(NaN), false) | ||
t.is(isMap(new WeakMap()), false) | ||
t.is(isWeakMap(new Map()), false) | ||
t.is(isSet(new WeakSet()), false) | ||
t.is(isWeakSet(new Set()), false) | ||
t.is(isNullOrUndefined(NaN), false) | ||
@@ -80,0 +92,0 @@ }) |
@@ -118,2 +118,30 @@ /** | ||
/** | ||
* Returns whether the payload is a Map | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Map} | ||
*/ | ||
export declare function isMap(payload: any): payload is Map<any, any>; | ||
/** | ||
* Returns whether the payload is a WeakMap | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakMap} | ||
*/ | ||
export declare function isWeakMap(payload: any): payload is WeakMap<any, any>; | ||
/** | ||
* Returns whether the payload is a Set | ||
* | ||
* @param {*} payload | ||
* @returns {payload is Set} | ||
*/ | ||
export declare function isSet(payload: any): payload is Set<any>; | ||
/** | ||
* Returns whether the payload is a WeakSet | ||
* | ||
* @param {*} payload | ||
* @returns {payload is WeakSet} | ||
*/ | ||
export declare function isWeakSet(payload: any): payload is WeakSet<any>; | ||
/** | ||
* Returns whether the payload is a Symbol | ||
@@ -120,0 +148,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
53578
1530