@josecarlosrz/array-helper
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "@josecarlosrz/array-helper", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Array helper to have async behavior and some util methods", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
33
test.js
@@ -5,28 +5,31 @@ const arrayHelper = require('./'); | ||
function waitFor(seconds) | ||
{ | ||
const obj = { | ||
return new Promise(function(resolve, reject) { | ||
waitFor: function(seconds) { | ||
console.log('ok, waiting for ' + seconds + ' seconds'); | ||
setTimeout(function() { | ||
return new Promise(function(resolve, reject) { | ||
console.log('done!'); | ||
resolve(); | ||
console.log('ok, waiting for ' + seconds + ' seconds'); | ||
}, seconds * 1000); | ||
setTimeout(function() { | ||
console.log('done!'); | ||
resolve(); | ||
}, seconds * 1000); | ||
}); | ||
}); | ||
}, | ||
} | ||
}; | ||
(async function() { | ||
const y = await arrayHelper.filter(x, async function(element) { | ||
const y = await arrayHelper.map(x, async function(element) { | ||
await waitFor(element); | ||
return element === 4; | ||
await this.waitFor(element); | ||
return element * 2; | ||
}); | ||
}, obj); | ||
@@ -33,0 +36,0 @@ console.log(y); |
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
5498
133