@supercharge/goodies
Advanced tools
Comparing version 1.5.1 to 1.6.0
# Changelog | ||
## [1.6.0](https://github.com/supercharge/streams/compare/v1.5.1...v1.6.0) - 2020-12-10 | ||
### Added | ||
- `isFunction(input)` method determines whether the given `input` is a function | ||
- `esmResolve(input)` method returns the resolved export of `input` from ESM and CommonJS | ||
### Updated | ||
- bump dependencies | ||
- change `main` entrypoint in `package.json` to `dist` folder | ||
- move test runner from `@hapi/lab` to `jest` | ||
- move assertions from `@hapi/code` to `jest` | ||
## [1.5.1](https://github.com/supercharge/goodies/compare/v1.5.0...v1.5.1) - 2020-07-21 | ||
### Fixed | ||
- fixed the GitHub Action workflow to successfully publish the package in the GitHub Package Registry | ||
## [1.5.0](https://github.com/supercharge/goodies/compare/v1.4.0...v1.5.0) - 2020-07-21 | ||
@@ -5,0 +24,0 @@ |
@@ -98,2 +98,10 @@ export declare class Goodies { | ||
ifNullish<R>(predicate: boolean, callback: () => R | Promise<R>): undefined | R | Promise<R>; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
* | ||
* @param input | ||
* | ||
* @returns {*} | ||
*/ | ||
esmResolve(input: any): any; | ||
} |
@@ -163,3 +163,14 @@ 'use strict'; | ||
} | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
* | ||
* @param input | ||
* | ||
* @returns {*} | ||
*/ | ||
esmResolve(input) { | ||
return (input === null || input === void 0 ? void 0 : input.default) ? input.default | ||
: input; | ||
} | ||
} | ||
exports.Goodies = Goodies; |
@@ -20,3 +20,2 @@ /** | ||
export declare function tap<T>(value: T, callback?: (value: T) => Promise<any>): Promise<T>; | ||
export declare function tap<T>(value: T, callback?: (value: T) => any): T; | ||
/** | ||
@@ -40,4 +39,16 @@ * Calls the given `callback` function with the given `value` and returns | ||
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; | ||
/** | ||
* Determine whether the given `input` is a function. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {Boolean} | ||
* | ||
* @example | ||
* isFunction('no') // false | ||
* isFunction(() => {}) // true | ||
* isFunction(function () {}) // true | ||
*/ | ||
export declare function isFunction(input?: any): Boolean; | ||
/** | ||
* Determine whether the given `promise` is a Promise. | ||
@@ -71,1 +82,9 @@ * | ||
export declare function ifNullish<R>(input: boolean, callback: () => Promise<R>): undefined | Promise<R>; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {*} | ||
*/ | ||
export declare function esmResolve(input: any): any; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ifNullish = exports.isAsyncFunction = exports.isPromise = exports.upon = exports.tap = void 0; | ||
exports.esmResolve = exports.ifNullish = exports.isAsyncFunction = exports.isPromise = exports.isFunction = exports.upon = exports.tap = void 0; | ||
const goodies_1 = require("./goodies"); | ||
@@ -14,2 +14,18 @@ function tap(value, callback) { | ||
/** | ||
* Determine whether the given `input` is a function. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {Boolean} | ||
* | ||
* @example | ||
* isFunction('no') // false | ||
* isFunction(() => {}) // true | ||
* isFunction(function () {}) // true | ||
*/ | ||
function isFunction(input) { | ||
return new goodies_1.Goodies().isFunction(input); | ||
} | ||
exports.isFunction = isFunction; | ||
/** | ||
* Determine whether the given `promise` is a Promise. | ||
@@ -44,1 +60,12 @@ * | ||
exports.ifNullish = ifNullish; | ||
/** | ||
* Returns the resolved ESM default exports and CommonJS (module) exports. | ||
* | ||
* @param {*} input | ||
* | ||
* @returns {*} | ||
*/ | ||
function esmResolve(input) { | ||
return new goodies_1.Goodies().esmResolve(input); | ||
} | ||
exports.esmResolve = esmResolve; |
{ | ||
"name": "@supercharge/goodies", | ||
"description": "Async utility functions for Node.js and JavaScript", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"author": "Marcus Pöhls <marcus@superchargejs.com>", | ||
@@ -11,14 +11,13 @@ "bugs": { | ||
"devDependencies": { | ||
"@hapi/code": "~7.0.0", | ||
"@hapi/lab": "~21.0.0", | ||
"@supercharge/tsconfig": "~1.0.0", | ||
"@typescript-eslint/parser": "~2.34.0", | ||
"@typescript-eslint/eslint-plugin": "~2.34.0", | ||
"eslint": "~6.8.0", | ||
"eslint-config-standard-with-typescript": "~16.0.0", | ||
"eslint-plugin-import": "~2.20.2", | ||
"@types/jest": "~26.0.18", | ||
"@typescript-eslint/eslint-plugin": "~4.9.1", | ||
"eslint": "~7.15.0", | ||
"eslint-config-standard-with-typescript": "~19.0.1", | ||
"eslint-plugin-import": "~2.22.1", | ||
"eslint-plugin-node": "~11.1.0", | ||
"eslint-plugin-promise": "~4.2.1", | ||
"eslint-plugin-standard": "~4.0.1", | ||
"typescript": "~3.9.7" | ||
"eslint-plugin-standard": "~4.1.0", | ||
"jest": "~26.6.3", | ||
"typescript": "~4.1.2" | ||
}, | ||
@@ -29,4 +28,3 @@ "engines": { | ||
"files": [ | ||
"dist", | ||
"index.js" | ||
"dist" | ||
], | ||
@@ -44,3 +42,3 @@ "homepage": "https://github.com/supercharge/goodies", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "dist", | ||
"publishConfig": { | ||
@@ -56,9 +54,7 @@ "access": "public" | ||
"lint": "eslint src --ext .js,.ts", | ||
"lint:fix": "eslint . --fix", | ||
"list:tests": "lab --assert @hapi/code --dry --verbose", | ||
"lint:fix": "npm run lint -- --fix", | ||
"test": "npm run build && npm run lint && npm run test:run", | ||
"test:run": "lab --assert @hapi/code --leaks --coverage --reporter console --output stdout --reporter html --output ./coverage/coverage.html", | ||
"test:single": "lab --assert @hapi/code --leaks --lint --id" | ||
"test:run": "jest" | ||
}, | ||
"types": "dist" | ||
} |
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
19802
11
437
8