Socket
Socket
Sign inDemoInstall

is-what

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-what - npm Package Compare versions

Comparing version 3.9.1 to 3.10.0

10

dist/index.cjs.js

@@ -53,2 +53,11 @@ 'use strict';

/**
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
*
* @param {*} payload
* @returns {payload is {}}
*/
function isEmptyObject(payload) {
return isPlainObject(payload) && Object.keys(payload).length === 0;
}
/**
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)

@@ -299,2 +308,3 @@ *

exports.isDate = isDate;
exports.isEmptyObject = isEmptyObject;
exports.isEmptyString = isEmptyString;

@@ -301,0 +311,0 @@ exports.isError = isError;

11

dist/index.esm.js

@@ -49,2 +49,11 @@ /**

/**
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
*
* @param {*} payload
* @returns {payload is {}}
*/
function isEmptyObject(payload) {
return isPlainObject(payload) && Object.keys(payload).length === 0;
}
/**
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)

@@ -289,2 +298,2 @@ *

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 };
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 };

2

package.json
{
"name": "is-what",
"sideEffects": false,
"version": "3.9.1",
"version": "3.10.0",
"description": "JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.",

@@ -6,0 +6,0 @@ "main": "dist/index.cjs.js",

@@ -53,2 +53,12 @@ /**

/**
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
*
* @param {*} payload
* @returns {payload is {}}
*/
export function isEmptyObject (payload: any): payload is {} {
return isPlainObject(payload) && Object.keys(payload).length === 0
}
/**
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)

@@ -55,0 +65,0 @@ *

@@ -30,2 +30,3 @@ import test from 'ava'

isNaNValue,
isEmptyObject,
} from '../src/index'

@@ -93,2 +94,19 @@

test('isEmptyObject', t => {
t.is(isEmptyObject({}), true)
t.is(isEmptyObject(new Object()), true)
t.is(isEmptyObject('{}'), false)
t.is(isEmptyObject('{}'), false)
t.is(isEmptyObject(null), false)
t.is(isEmptyObject(new Date()), false)
t.is(isEmptyObject(new Error('')), false)
t.is(isEmptyObject(new Date()), false)
t.is(isEmptyObject(Symbol()), false)
t.is(isEmptyObject(new Map()), false)
t.is(isEmptyObject(new WeakMap()), false)
t.is(isEmptyObject(new Set()), false)
t.is(isEmptyObject(new WeakSet()), false)
})
test('NaN tests', t => {

@@ -95,0 +113,0 @@ t.is(isNaNValue(NaN), true)

@@ -41,2 +41,9 @@ /**

/**
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
*
* @param {*} payload
* @returns {payload is {}}
*/
export declare function isEmptyObject(payload: any): payload is {};
/**
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)

@@ -43,0 +50,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc