@pushrocks/smartpromise
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -37,3 +37,3 @@ export interface IResolve<T> { | ||
export declare const map: <T>(inputArg: T[], functionArg: IAsyncFunction<T>) => Promise<any[]>; | ||
export declare const timeoutWrap: (ms: any, promise: any) => Promise<unknown>; | ||
export declare const timeoutWrap: <T = any>(promiseArg: Promise<T>, timeoutInMs: number) => Promise<unknown>; | ||
export {}; |
@@ -65,10 +65,10 @@ "use strict"; | ||
}; | ||
exports.timeoutWrap = (ms, promise) => { | ||
exports.timeoutWrap = (promiseArg, timeoutInMs) => { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
reject(new Error('timeout')); | ||
}, ms); | ||
promise.then(resolve, reject); | ||
}, timeoutInMs); | ||
promiseArg.then(resolve, reject); | ||
}); | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFVQSxNQUFhLFFBQVE7SUFnQm5CO1FBQ0UsSUFBSSxDQUFDLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBSSxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRTtZQUNoRCxJQUFJLENBQUMsT0FBTyxHQUFHLENBQUMsUUFBNEIsRUFBRSxFQUFFO2dCQUM5QyxJQUFJLENBQUMsTUFBTSxHQUFHLFdBQVcsQ0FBQztnQkFDMUIsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUM7Z0JBQzVCLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztZQUNwQixDQUFDLENBQUM7WUFDRixJQUFJLENBQUMsTUFBTSxHQUFHLENBQUMsTUFBVyxFQUFFLEVBQUU7Z0JBQzVCLElBQUksQ0FBQyxNQUFNLEdBQ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FDO0FBQ3JCLENBQUMsQ0FBQztBQUVXLFFBQUEsV0FBVyxHQUFHLENBQVUsVUFBc0IsRUFBRSxXQUFtQixFQUFFLEVBQUU7SUFDbEYsT0FBTyxJQUFJLE9BQU8sQ0FBQyxDQUFDLE9BQU8sRUFBRSxNQUFNLEVBQUUsRUFBRTtRQUNyQyxVQUFVLENBQUMsR0FBRyxFQUFFO1lBQ2QsTUFBTSxDQUFDLElBQUksS0FBSyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7UUFDL0IsQ0FBQyxFQUFFLFdBQVcsQ0FBQyxDQUFDO1FBQ2hCLFVBQVUsQ0FBQyxJQUFJLENBQUMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQ25DLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDIn0= |
{ | ||
"name": "@pushrocks/smartpromise", | ||
"private": false, | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "simple promises and Deferred constructs", | ||
@@ -6,0 +6,0 @@ "main": "dist_ts/index.js", |
@@ -87,9 +87,9 @@ export interface IResolve<T> { | ||
export const timeoutWrap = (ms, promise) => { | ||
export const timeoutWrap = <T = any>(promiseArg: Promise<T>, timeoutInMs: number) => { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
reject(new Error('timeout')); | ||
}, ms); | ||
promise.then(resolve, reject); | ||
}, timeoutInMs); | ||
promiseArg.then(resolve, reject); | ||
}); | ||
}; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13206
0