Comparing version 3.8.0 to 3.9.0
@@ -26,3 +26,3 @@ /* eslint-disable */ | ||
const plugins = [ | ||
typescript({useTsconfigDeclarationDir: true}), | ||
typescript({ useTsconfigDeclarationDir: true, tsconfigOverride: { exclude: ['test/**/*'] } }), | ||
] | ||
@@ -37,11 +37,14 @@ | ||
plugins, | ||
external | ||
external, | ||
} | ||
// defaults.output | ||
config.output = config.output.map(output => { | ||
return Object.assign({ | ||
sourcemap: false, | ||
name: className, | ||
exports: 'named', | ||
}, output) | ||
return Object.assign( | ||
{ | ||
sourcemap: false, | ||
name: className, | ||
exports: 'named', | ||
}, | ||
output | ||
) | ||
}) | ||
@@ -55,6 +58,6 @@ return Object.assign(defaults, config) | ||
output: [ | ||
{file: 'dist/index.cjs.js', format: 'cjs'}, | ||
{file: 'dist/index.esm.js', format: 'esm'}, | ||
{ file: 'dist/index.cjs.js', format: 'cjs' }, | ||
{ file: 'dist/index.esm.js', format: 'esm' }, | ||
], | ||
}), | ||
] |
@@ -238,2 +238,11 @@ 'use strict'; | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is typeof NaN} | ||
*/ | ||
function isNaNValue(payload) { | ||
return getType(payload) === 'Number' && isNaN(payload); | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -296,2 +305,3 @@ * | ||
exports.isMap = isMap; | ||
exports.isNaNValue = isNaNValue; | ||
exports.isNull = isNull; | ||
@@ -298,0 +308,0 @@ exports.isNullOrUndefined = isNullOrUndefined; |
@@ -234,2 +234,11 @@ /** | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is typeof NaN} | ||
*/ | ||
function isNaNValue(payload) { | ||
return getType(payload) === 'Number' && isNaN(payload); | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -280,2 +289,2 @@ * | ||
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 }; | ||
export { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, 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.8.0", | ||
"version": "3.9.0", | ||
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.", | ||
@@ -66,2 +66,3 @@ "main": "dist/index.cjs.js", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"tsconfig-paths": "^3.9.0", | ||
"ts-node": "^8.8.2", | ||
@@ -71,9 +72,5 @@ "typescript": "^3.8.3" | ||
"ava": { | ||
"extensions": [ | ||
"ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
] | ||
"extensions": ["ts"], | ||
"require": ["tsconfig-paths/register", "ts-node/register"] | ||
} | ||
} |
@@ -258,2 +258,12 @@ /** | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is typeof NaN} | ||
*/ | ||
export function isNaNValue (payload: any): payload is typeof NaN { | ||
return getType(payload) === 'Number' && isNaN(payload) | ||
} | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -260,0 +270,0 @@ * |
@@ -29,2 +29,3 @@ import test from 'ava' | ||
isPromise, | ||
isNaNValue, | ||
} from '../src/index' | ||
@@ -92,2 +93,35 @@ | ||
test('NaN tests', t => { | ||
t.is(isNaNValue(NaN), true) | ||
t.is(isNaNValue(new Error('')), false) | ||
t.is(isNaNValue(undefined), false) | ||
t.is(isNaNValue(null), false) | ||
t.is(isNaNValue(undefined), false) | ||
t.is(isNaNValue({}), false) | ||
t.is(isNaNValue(new Object()), false) | ||
t.is( | ||
isNaNValue(_ => {}), | ||
false | ||
) | ||
t.is(isNaNValue([]), false) | ||
t.is(isNaNValue(new Array()), false) | ||
t.is(isNaNValue(''), false) | ||
t.is(isNaNValue('_'), false) | ||
t.is(isNaNValue(''), false) | ||
t.is(isNaNValue(' '), false) | ||
t.is(isNaNValue(true), false) | ||
t.is(isNaNValue(false), false) | ||
t.is(isNaNValue(/./), false) | ||
t.is(isNaNValue(/./gi), false) | ||
t.is(isNaNValue(0), false) | ||
t.is(isNaNValue(1), false) | ||
t.is(isNaNValue(new Date()), false) | ||
t.is(isNaNValue(Symbol()), false) | ||
t.is(isNaNValue(new Map()), false) | ||
t.is(isNaNValue(new WeakMap()), false) | ||
t.is(isNaNValue(new Set()), false) | ||
t.is(isNaNValue(new WeakSet()), false) | ||
t.is(isNaNValue(new Promise((resolve, reject) => {})), false) | ||
}) | ||
test('Primitive tests', t => { | ||
@@ -94,0 +128,0 @@ // true |
@@ -7,4 +7,5 @@ { | ||
"include": [ | ||
"src/**/*" | ||
"src/**/*", | ||
"test/**/*" | ||
] | ||
} |
@@ -188,2 +188,9 @@ /** | ||
/** | ||
* Returns whether the payload is an Error | ||
* | ||
* @param {*} payload | ||
* @returns {payload is typeof NaN} | ||
*/ | ||
export declare function isNaNValue(payload: any): payload is typeof NaN; | ||
/** | ||
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol) | ||
@@ -190,0 +197,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
55622
1602
19