1.0.0 • Published 3 years ago

swisstool v1.0.0

Weekly downloads
-
License
GPL-2.0-only
Repository
github
Last release
3 years ago

swisstool

Small helper functions needed in every project

asyncFilter

  const items = [1, 2, 3, 4];
  const isEven = n => new Promise(res => res(n % 2 === 0));
  const evenNumbers = await asyncFilter(items, isEven);
  // [2, 4]

wait

const { wait } = require("scraping-toolbox");

// Wait 80ms, plus a random number between 0 and 20 additional milliseconds
await wait(80, 20);