Socket
Socket
Sign inDemoInstall

@sindresorhus/is

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sindresorhus/is - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

18

dist/index.js

@@ -203,3 +203,3 @@ "use strict";

is.plainObject = (value) => {
// From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js
// From: https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
if (toString.call(value) !== '[object Object]') {

@@ -286,5 +286,11 @@ return false;

is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
const assertType = (condition, description, value) => {
const assertType = (condition, description, value, options = {}) => {
if (!condition) {
throw new TypeError(`Expected value which is \`${description}\`, received value of type \`${is(value)}\`.`);
const { multipleValues } = options;
const valuesMessage = multipleValues ?
`received values of types ${[
...new Set(value.map(singleValue => `\`${is(singleValue)}\``))
].join(', ')}` :
`received value of type \`${is(value)}\``;
throw new TypeError(`Expected value which is \`${description}\`, ${valuesMessage}.`);
}

@@ -381,4 +387,6 @@ };

// Variadic functions.
any: (predicate, ...values) => assertType(is.any(predicate, ...values), "predicate returns truthy for any value" /* any */, values),
all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values" /* all */, values)
any: (predicate, ...values) => {
return assertType(is.any(predicate, ...values), "predicate returns truthy for any value" /* any */, values, { multipleValues: true });
},
all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values" /* all */, values, { multipleValues: true })
};

@@ -385,0 +393,0 @@ // Some few keywords are reserved, but we'll populate them for Node.js users

{
"name": "@sindresorhus/is",
"version": "4.0.0",
"version": "4.0.1",
"description": "Type check values",

@@ -20,3 +20,3 @@ "license": "MIT",

"test": "xo && ava",
"prepublishOnly": "npm run build"
"prepare": "npm run build"
},

@@ -23,0 +23,0 @@ "files": [

@@ -1,2 +0,2 @@

# is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is)
# is

@@ -3,0 +3,0 @@ > Type check values

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