@supercharge/goodies
Advanced tools
Comparing version 1.10.1 to 1.11.0
@@ -14,4 +14,4 @@ 'use strict'; | ||
function esmRequire(path) { | ||
return esmResolve_1.esmResolve(require(path)); | ||
return (0, esmResolve_1.esmResolve)(require(path)); | ||
} | ||
exports.esmRequire = esmRequire; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
function esmResolve(input) { | ||
return (input === null || input === void 0 ? void 0 : input.default) | ||
return input?.default | ||
? input.default | ||
@@ -15,0 +15,0 @@ : input; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
function ifNullish(input, callback) { | ||
if (isNullish_1.isNullish(input)) { | ||
if ((0, isNullish_1.isNullish)(input)) { | ||
return callback(); | ||
@@ -9,0 +9,0 @@ } |
'use strict'; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function isAsyncFunction(input: any): boolean; | ||
export declare function isAsyncFunction(input: any): input is Promise<any>; |
@@ -13,4 +13,4 @@ 'use strict'; | ||
function isAsyncFunction(input) { | ||
return isFunction_1.isFunction(input) && input.constructor.name === 'AsyncFunction'; | ||
return (0, isFunction_1.isFunction)(input) && input.constructor.name === 'AsyncFunction'; | ||
} | ||
exports.isAsyncFunction = isAsyncFunction; |
@@ -22,4 +22,4 @@ 'use strict'; | ||
function isNotNullish(input) { | ||
return !isNullish_1.isNullish(input); | ||
return !(0, isNullish_1.isNullish)(input); | ||
} | ||
exports.isNotNullish = isNotNullish; |
@@ -17,4 +17,4 @@ 'use strict'; | ||
function isPromise(promise) { | ||
return !!promise && isFunction_1.isFunction(promise.then); | ||
return !!promise && (0, isFunction_1.isFunction)(promise.then); | ||
} | ||
exports.isPromise = isPromise; |
@@ -8,6 +8,6 @@ 'use strict'; | ||
function tap(value, callback) { | ||
if (isPromise_1.isPromise(value)) { | ||
if ((0, isPromise_1.isPromise)(value)) { | ||
return tapAsync(value, callback); | ||
} | ||
if (isAsyncFunction_1.isAsyncFunction(callback)) { | ||
if ((0, isAsyncFunction_1.isAsyncFunction)(callback)) { | ||
return tapAsync(value, callback); | ||
@@ -30,3 +30,3 @@ } | ||
} | ||
if (isFunction_1.isFunction(callback)) { | ||
if ((0, isFunction_1.isFunction)(callback)) { | ||
callback(value); | ||
@@ -48,6 +48,6 @@ } | ||
} | ||
if (isPromise_1.isPromise(value)) { | ||
if ((0, isPromise_1.isPromise)(value)) { | ||
value = await value; | ||
} | ||
if (isFunction_1.isFunction(callback)) { | ||
if ((0, isFunction_1.isFunction)(callback)) { | ||
await callback(value); | ||
@@ -54,0 +54,0 @@ } |
@@ -8,6 +8,6 @@ 'use strict'; | ||
function upon(value, callback) { | ||
if (isPromise_1.isPromise(value)) { | ||
if ((0, isPromise_1.isPromise)(value)) { | ||
return uponAsync(value, callback); | ||
} | ||
if (isAsyncFunction_1.isAsyncFunction(callback)) { | ||
if ((0, isAsyncFunction_1.isAsyncFunction)(callback)) { | ||
return uponAsync(value, callback); | ||
@@ -30,3 +30,3 @@ } | ||
} | ||
return isFunction_1.isFunction(callback) | ||
return (0, isFunction_1.isFunction)(callback) | ||
? callback(value) | ||
@@ -44,8 +44,8 @@ : value; | ||
async function uponAsync(value, callback) { | ||
if (isPromise_1.isPromise(value)) { | ||
if ((0, isPromise_1.isPromise)(value)) { | ||
value = await value; | ||
} | ||
return isFunction_1.isFunction(callback) | ||
return (0, isFunction_1.isFunction)(callback) | ||
? callback(value) | ||
: value; | ||
} |
{ | ||
"name": "@supercharge/goodies", | ||
"description": "Utility functions for Node.js and JavaScript", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"author": "Marcus Pöhls <marcus@superchargejs.com>", | ||
@@ -10,14 +10,13 @@ "bugs": { | ||
"devDependencies": { | ||
"@supercharge/tsconfig": "~2.0.0", | ||
"@types/node": "~16.6.2", | ||
"@typescript-eslint/eslint-plugin": "~4.29.2", | ||
"ava": "~4.1.0", | ||
"eslint": "~7.32.0", | ||
"eslint-config-standard-with-typescript": "~20.0.0", | ||
"eslint-plugin-import": "~2.25.4", | ||
"eslint-plugin-node": "~11.1.0", | ||
"eslint-plugin-promise": "~5.1.0", | ||
"eslint-plugin-standard": "~4.1.0", | ||
"nyc": "~15.1.0", | ||
"typescript": "~4.3.5" | ||
"@japa/run-failed-tests": "~1.0.7", | ||
"@japa/runner": "~2.0.9", | ||
"@japa/spec-reporter": "~1.1.12", | ||
"@supercharge/eslint-config-typescript": "~2.3.0", | ||
"@supercharge/tsconfig": "~4.0.0", | ||
"@types/node": "~18.6.2", | ||
"@typescript-eslint/eslint-plugin": "~5.31.0", | ||
"c8": "~7.12.0", | ||
"eslint": "~8.20.0", | ||
"expect": "~28.1.3", | ||
"typescript": "~4.7.4" | ||
}, | ||
@@ -52,5 +51,6 @@ "main": "dist/index.js", | ||
"lint:fix": "npm run lint -- --fix", | ||
"posttest": "c8 report --reporter=html", | ||
"test": "npm run build && npm run lint && npm run test:run", | ||
"test:run": "nyc --reporter=html --reporter=text ava" | ||
"test:run": "c8 node bin/test.js" | ||
} | ||
} |
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
16180
11
395