# abc

> Misc js helpers

Latest version **0.6.1** (published 2013-07-31) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.1 |
| Published | 2013-07-31 |
| First published | 2012-07-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Golubev Fedor |
| Maintainers | gregof |

## Links

- npm: https://www.npmjs.com/package/abc
- Repository: https://github.com/gregof/abc
- npm.io page: https://npm.io/package/abc

## Recent versions

- 0.6.1 (latest) — 2013-07-31
- 0.6.0 — 2013-07-30
- 0.5.1 — 2012-12-12
- 0.5.0 — 2012-12-12
- 0.4.1 — 2012-10-01
- 0.4.0 — 2012-09-19
- 0.3.0 — 2012-09-16
- 0.2.1 — 2012-08-24
- 0.2.0 — 2012-08-24
- 0.1.0 — 2012-07-19

## README

## abc

#### abc.async.forEach
```javascript
abc.async(array, action, [callback]);
```
```javascript
abc.async.forEach(
    [1,2,3],
    function (value, callback) {
        if (value === 1) {
            setTimeout(function () {
                callback(value * value);
            }, 200)
        } else {
            callback(value * value);
        }
    },
    function (results) {
        results; // [1, 4, 9]
        // finish
    }
);
```
```javascript
abc.async.forEach(
    [func1, func2, func3],
    function (results) {
        // finish
    }
);
function func1 (callback) {
    // ...
    callback();
}
// func2, func3
```
#### abc.async.sequence
```javascript
abc.sequence(array, action, [callback]);
```
```javascript
abc.async.sequence(
    [1,2,3],
    function (value, callback, previousResult) {
        value; // 1, 2, 3
        previousResult; // null, 1, 4
        
        if (value === 1) {
            setTimeout(function () {
                callback(value * value);
            }, 200)
        } else {
            callback(value * value);
        }
    },
    function (results) {
        results; // [1, 4, 9]
        // finish
    }
);
```
```javascript
abc.async.sequence(
    [func1, func2, func3],
    function (results) {
        // finish
    }
);
function func1 (callback, previousResult) {
    // ...
    callback();
}
// func2, func3
```

####abc.dir
Create dir, if it does not exist.
```javascript
abc.dir(dirPath, callback)
```

#### abc.file.read
```javascript
abc.file.read(filename, callback)
```
#### abc.file.write
```javascript
abc.file.write(filename, text, callback)
```
#### abc.file.copy
```javascript
abc.file.copy(sourceFileName, destinationFileName, callback)
```
#### abc.file.binRead
```javascript
abc.file.binRead(filename, callback)
```
#### abc.file.binWrite
```javascript
abc.file.binWrite(filename, data, callback)
```
#### abc.file.binCopy
```javascript
abc.file.binCopy(sourceFileName, destinationFileName, callback)
```

#### abc.extend
```javascript
abc.extend(origin, patch1 /*, ..., patchN */, recursive)
```

#### abc.find
Recursive find in dir. Calls fileCallback for each file, and completeCallback at end.
```javascript
abc.find(dirPath, fileCallback, completeCallback, {recursive: true, excludedDirs: ['node_modules']})

function fileCallback (file, dirPath) {
    file; // code.js
    dirPath; // src/
    return /.*\.js/.test(file); // find all js files
}
```

#### abc.Executer
Pool of actions limited by action executed in parallel.
```javascript
var executer = new abc.Executer(30); // No more then 30 actions in parallel.
executer.add(function (callback) {
    // do something async
    calllback();
});
```

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