# asynkron

> asynkron is utility module to make async loops and reduces

Latest version **1.1.0** (published 2020-03-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install asynkron
pnpm add asynkron
yarn add asynkron
bun add asynkron
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-03-21 |
| First published | 2020-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | abrahem ali alhofe |
| Maintainers | bemocode |

## Links

- npm: https://www.npmjs.com/package/asynkron
- Repository: https://github.com/AbrahemAlhofe/asynkron
- Homepage: https://github.com/AbrahemAlhofe/asynkron#readme
- Issues: https://github.com/AbrahemAlhofe/asynkron/issues
- npm.io page: https://npm.io/package/asynkron

## Recent versions

- 1.1.0 (latest) — 2020-03-21
- 1.0.0 — 2020-03-21

## README

# Asynkron :

asynkron is utility module to make async loops and reduces

# Features :

- very very small

- No ( Maximum call size ) error

- you can break loop

- you can change key name of object

- specify result type Array / Object

- it used by [qlink]([https://www.npmjs.com/package/qlink-server](https://www.npmjs.com/package/qlink-server) and [qreal]([https://www.npmjs.com/package/qreal](https://www.npmjs.com/package/qreal)

# Install :
just require it in node environment but in browser environment use unpkg src
```html
<script src='https://unpkg.com/asynkron'></script>
```

# Usage :

just pass Array / object what you want to make loop

> asynkron return promise so you can use async / await with it

```javascript
const asynkron = require('asynkron');
const fs = require('fs');

asynkron(['./file1', './file2', './file3'], (filepath, index, done, result) => {
    // done( item, index? )
    fs.readFile(filepath, (err, file) => {
        if ( err ) {
            // pass item and index false to break loop
            done(false, false)
        } else {
            done(file)
        }
    })
}).then(files => console.log( files ))
```

to use asynkron with object and change key name of it just pass result value

```javascript
const asynkron = require('asynkron');
const fs = require('fs');
asynkron(['./file1', './file2', './file3'], (filepath, index, done, result) => {
     // done( item, index? )
     fs.readFile(filepath, (err, file) => {
         if ( err ) {
             // pass item and index false to break loop
             done(false, false)
         } else {
             done(file, filepath)
         }
     })
}, {} /* Result */ ).then(files => console.log( files ))
// asynkron will resolve
{
    './file1' : { ... },
    ...
}
```

---
_Source: https://npm.io/package/asynkron · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
