Socket
Socket
Sign inDemoInstall

@sindresorhus/is

Package Overview
Dependencies
0
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

25

dist/index.js

@@ -70,15 +70,17 @@ "use strict";

is.symbol = isOfType('symbol');
is.numericString = (value) => is.string(value) && value.length > 0 && !Number.isNaN(Number(value));
is.numericString = (value) => is.string(value) && !is.emptyStringOrWhitespace(value) && !Number.isNaN(Number(value));
is.array = Array.isArray;
is.buffer = (value) => !is.nullOrUndefined(value) && !is.nullOrUndefined(value.constructor) && is.function_(value.constructor.isBuffer) && value.constructor.isBuffer(value);
is.buffer = (value) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.isBuffer) === null || _c === void 0 ? void 0 : _c.call(_b, value)) !== null && _d !== void 0 ? _d : false; };
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value));
is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]);
is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]);
is.iterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.iterator]); };
is.asyncIterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.asyncIterator]); };
is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw);
is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw);
is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value);
const hasPromiseAPI = (value) => is.object(value) &&
is.function_(value.then) && // eslint-disable-line promise/prefer-await-to-then
is.function_(value.catch);
const hasPromiseAPI = (value) => {
var _a, _b;
return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a.then) &&
is.function_((_b = value) === null || _b === void 0 ? void 0 : _b.catch);
};
is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value);

@@ -192,2 +194,3 @@ is.generatorFunction = isObjectOfType("GeneratorFunction" /* GeneratorFunction */);

is.observable = (value) => {
var _a, _b, _c, _d;
if (!value) {

@@ -197,6 +200,6 @@ return false;

// eslint-disable-next-line no-use-extend-native/no-use-extend-native
if (value[Symbol.observable] && value === value[Symbol.observable]()) {
if (value === ((_b = (_a = value)[Symbol.observable]) === null || _b === void 0 ? void 0 : _b.call(_a))) {
return true;
}
if (value['@@observable'] && value === value['@@observable']()) {
if (value === ((_d = (_c = value)['@@observable']) === null || _d === void 0 ? void 0 : _d.call(_c))) {
return true;

@@ -216,3 +219,3 @@ }

is.nonEmptyString = (value) => is.string(value) && value.length > 0;
const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false;
const isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value);
is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);

@@ -228,3 +231,3 @@ is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;

const predicateOnArray = (method, predicate, values) => {
if (is.function_(predicate) === false) {
if (!is.function_(predicate)) {
throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);

@@ -231,0 +234,0 @@ }

{
"name": "@sindresorhus/is",
"version": "2.1.0",
"version": "2.1.1",
"description": "Type check values",

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

"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},

@@ -52,16 +52,16 @@ "main": "dist",

"@sindresorhus/tsconfig": "^0.7.0",
"@types/jsdom": "^12.2.4",
"@types/node": "^12.12.6",
"@types/jsdom": "^16.1.0",
"@types/node": "^13.7.4",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"ava": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.20.0",
"ava": "^3.3.0",
"del-cli": "^2.0.0",
"eslint-config-xo-typescript": "^0.24.1",
"eslint-config-xo-typescript": "^0.26.0",
"jsdom": "^16.0.1",
"rxjs": "^6.4.0",
"tempy": "^0.3.0",
"tempy": "^0.4.0",
"ts-node": "^8.3.0",
"typescript": "^3.7.5",
"xo": "^0.25.3",
"typescript": "~3.8.2",
"xo": "^0.26.1",
"zen-observable": "^0.8.8"

@@ -72,4 +72,2 @@ },

"ava": {
"babel": false,
"compileEnhancements": false,
"extensions": [

@@ -76,0 +74,0 @@ "ts"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc