Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@supercharge/goodies

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supercharge/goodies - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

10

CHANGELOG.md
# Changelog
## [1.5.0](https://github.com/supercharge/goodies/compare/v1.4.0...v1.5.0) - 2020-07-21
### Added
- `ifNullish(predicate, callback)` method running the `callback` function if the given `predicate` is `undefined` or `null`
### Updated
- bump dependencies
- improved type definitions on `upon` for returned values allowing IntelliSense to kick in
## [1.4.0](https://github.com/supercharge/goodies/compare/v1.3.0...v1.4.0) - 2020-05-23

@@ -5,0 +15,0 @@

@@ -89,2 +89,11 @@ export declare class Goodies {

isAsyncFunction(input: any): Boolean;
/**
* Runs the given `callback` if the `predicate` is `null` or `undefined`.
*
* @param {Boolean} predicate
* @param {Function} callback
*
* @returns {*}
*/
ifNullish<R>(predicate: boolean, callback: () => R | Promise<R>): undefined | R | Promise<R>;
}

@@ -150,3 +150,16 @@ 'use strict';

}
/**
* Runs the given `callback` if the `predicate` is `null` or `undefined`.
*
* @param {Boolean} predicate
* @param {Function} callback
*
* @returns {*}
*/
ifNullish(predicate, callback) {
if (predicate === null || predicate === undefined) {
return callback();
}
}
}
exports.Goodies = Goodies;

17

dist/index.d.ts

@@ -36,6 +36,6 @@ /**

*/
export declare function upon<T>(value: Promise<T>, callback?: (value: T) => Promise<any>): Promise<any>;
export declare function upon<T>(value: Promise<T>, callback?: (value: T) => any): Promise<any>;
export declare function upon<T>(value: T, callback?: (value: T) => Promise<any>): Promise<any>;
export declare function upon<T>(value: T, callback?: (value: T) => any): any;
export declare function upon<T, R>(value: Promise<T>, callback?: (value: T) => Promise<any>): Promise<R>;
export declare function upon<T, R>(value: Promise<T>, callback?: (value: T) => R): Promise<R>;
export declare function upon<T, R>(value: T, callback?: (value: T) => Promise<R>): Promise<R>;
export declare function upon<T, R>(value: T, callback?: (value: T) => R): R;
/**

@@ -61,1 +61,10 @@ * Determine whether the given `promise` is a Promise.

export declare function isAsyncFunction(input: any): Boolean;
/**
* Runs the given `callback` if the `predicate` is `null` or `undefined`.
*
* @param {Boolean} predicate
* @param {Function} callback
*
* @returns {*}
*/
export declare function ifNullish<R>(input: boolean, callback: () => Promise<R>): undefined | Promise<R>;
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAsyncFunction = exports.isPromise = exports.upon = exports.tap = void 0;
exports.ifNullish = exports.isAsyncFunction = exports.isPromise = exports.upon = exports.tap = void 0;
const goodies_1 = require("./goodies");

@@ -39,1 +39,5 @@ function tap(value, callback) {

exports.isAsyncFunction = isAsyncFunction;
function ifNullish(input, callback) {
return new goodies_1.Goodies().ifNullish(input, callback);
}
exports.ifNullish = ifNullish;
{
"name": "@supercharge/goodies",
"description": "Async utility functions for Node.js and JavaScript",
"version": "1.4.0",
"version": "1.5.0",
"author": "Marcus Pöhls <marcus@superchargejs.com>",

@@ -17,3 +17,3 @@ "bugs": {

"eslint": "~6.8.0",
"eslint-config-standard-with-typescript": "~17.0.0",
"eslint-config-standard-with-typescript": "~16.0.0",
"eslint-plugin-import": "~2.20.2",

@@ -23,3 +23,3 @@ "eslint-plugin-node": "~11.1.0",

"eslint-plugin-standard": "~4.0.1",
"typescript": "~3.9.3"
"typescript": "~3.9.7"
},

@@ -26,0 +26,0 @@ "engines": {

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