sync-array
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Arry operation

Sync funcitons for Array.

Void Excepton Maximum call stack size exceeded

Installation

yarn add sync-array

or

npm i --save sync-array

Examples

import array from 'sync-array';
// import forEach from 'sync-array/foreach';
// const { forEach, map, every, filter, some, reduce, reduceRight } = require('sync-array').default;
 
function sleep(timeout: number){
    return new Promise<void>((resolve)=>{
        setTimeout(resolve, timeout);
    });
}
 
const arr = [1000, 500, 100];
 
arr.forEach(async (it)=>{
    await sleep(it);
    console.log(it);
});
 
// 100
// 500
// 1000
 
array.forEach(arr, async (it)=>{
    await sleep(it);
    console.log(it);
});
// 1000
// 500
// 100
 

Package Sidebar

Install

npm i sync-array

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

26.6 kB

Total Files

21

Last publish

Collaborators

  • taoqf