@supercharge/goodies
Advanced tools
Comparing version 1.6.2 to 1.7.0
# Changelog | ||
## [1.7.0](https://github.com/supercharge/streams/compare/v1.6.2...v1.7.0) - 2020-12-15 | ||
### Added | ||
- `isNullish(input)` method to determine whether the given `input` is `null` or `undefined` | ||
### Updated | ||
- bump dependencies | ||
## [1.6.2](https://github.com/supercharge/goodies/compare/v1.6.1...v1.6.2) - 2020-12-10 | ||
@@ -5,0 +14,0 @@ |
@@ -99,2 +99,10 @@ export declare class Goodies { | ||
/** | ||
* Determine whether the given `input` is `null` or `undefined`. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {Boolean} | ||
*/ | ||
isNullish(input: any): boolean; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
@@ -101,0 +109,0 @@ * |
@@ -159,3 +159,3 @@ 'use strict'; | ||
ifNullish(predicate, callback) { | ||
if (predicate === null || predicate === undefined) { | ||
if (this.isNullish(predicate)) { | ||
return callback(); | ||
@@ -165,2 +165,12 @@ } | ||
/** | ||
* Determine whether the given `input` is `null` or `undefined`. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {Boolean} | ||
*/ | ||
isNullish(input) { | ||
return input === undefined || input === null; | ||
} | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
@@ -167,0 +177,0 @@ * |
@@ -83,2 +83,11 @@ /** | ||
/** | ||
* Runs the given `callback` if the `predicate` is `null` or `undefined`. | ||
* | ||
* @param {Boolean} predicate | ||
* @param {Function} callback | ||
* | ||
* @returns {*} | ||
*/ | ||
export declare function isNullish(input: any): boolean; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
@@ -85,0 +94,0 @@ * |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.esmResolve = exports.ifNullish = exports.isAsyncFunction = exports.isPromise = exports.isFunction = exports.upon = exports.tap = void 0; | ||
exports.esmResolve = exports.isNullish = exports.ifNullish = exports.isAsyncFunction = exports.isPromise = exports.isFunction = exports.upon = exports.tap = void 0; | ||
const goodies_1 = require("./goodies"); | ||
@@ -60,2 +60,14 @@ function tap(value, callback) { | ||
/** | ||
* Runs the given `callback` if the `predicate` is `null` or `undefined`. | ||
* | ||
* @param {Boolean} predicate | ||
* @param {Function} callback | ||
* | ||
* @returns {*} | ||
*/ | ||
function isNullish(input) { | ||
return new goodies_1.Goodies().isNullish(input); | ||
} | ||
exports.isNullish = isNullish; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
@@ -62,0 +74,0 @@ * |
{ | ||
"name": "@supercharge/goodies", | ||
"description": "Async utility functions for Node.js and JavaScript", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"author": "Marcus Pöhls <marcus@superchargejs.com>", | ||
@@ -12,4 +12,4 @@ "bugs": { | ||
"@supercharge/tsconfig": "~1.0.0", | ||
"@types/jest": "~26.0.18", | ||
"@typescript-eslint/eslint-plugin": "~4.9.1", | ||
"@types/jest": "~26.0.19", | ||
"@typescript-eslint/eslint-plugin": "~4.10.0", | ||
"eslint": "~7.15.0", | ||
@@ -22,3 +22,3 @@ "eslint-config-standard-with-typescript": "~19.0.1", | ||
"jest": "~26.6.3", | ||
"typescript": "~4.1.2" | ||
"typescript": "~4.1.3" | ||
}, | ||
@@ -25,0 +25,0 @@ "engines": { |
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
21404
478