Socket
Socket
Sign inDemoInstall

@pushrocks/smartpromise

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pushrocks/smartpromise - npm Package Compare versions

Comparing version 3.0.6 to 3.1.1

dist_ts/index.d.ts

1

npmextra.json

@@ -7,2 +7,3 @@ {

"gitzone": {
"projectType": "npm",
"module": {

@@ -9,0 +10,0 @@ "githost": "gitlab.com",

36

package.json
{
"name": "@pushrocks/smartpromise",
"private": false,
"version": "3.0.6",
"version": "3.1.1",
"description": "simple promises and Deferred constructs",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)"
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
},

@@ -24,20 +24,24 @@ "repository": {

"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.5",
"tslint": "^5.20.0",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.11.8",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

@@ -45,3 +45,3 @@ export interface IResolve<T> {

export let defer = <T>() => {
export const defer = <T>() => {
return new Deferred<T>();

@@ -53,3 +53,3 @@ };

*/
export let resolvedPromise = <T>(value?: T): Promise<T> => {
export const resolvedPromise = <T>(value?: T): Promise<T> => {
return Promise.resolve(value);

@@ -61,3 +61,3 @@ };

*/
export let rejectedPromise = err => {
export const rejectedPromise = (err) => {
return Promise.reject(err);

@@ -70,9 +70,15 @@ };

export let map = async <T>(inputArg: T[], functionArg: IAsyncFunction<T>) => {
let promiseArray: Promise<any>[] = [];
let resultArray = [];
for (let item of inputArg) {
let promise: Promise<any> = functionArg(item);
/**
* accepts an array of inputs and a function that accepts the input.
* runs all items with the function and returns the result array when all items have run
* @param inputArg
* @param functionArg
*/
export const map = async <T>(inputArg: T[], functionArg: IAsyncFunction<T>) => {
const promiseArray: Promise<any>[] = [];
const resultArray = [];
for (const item of inputArg) {
const promise: Promise<any> = functionArg(item);
promiseArray.push(promise);
promise.then(x => {
promise.then((x) => {
resultArray.push(x);

@@ -84,1 +90,10 @@ });

};
export const timeoutWrap = (ms, promise) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('timeout'));
}, ms);
promise.then(resolve, reject);
});
};
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