abc

abc

Misc js-helpers for node.js

Showing:

Popularity

Downloads/wk

1K

GitHub Stars

3

Maintenance

Last Commit

8yrs ago

Contributors

2

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

abc

abc.async.forEach

abc.async(array, action, [callback]);
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
    }
);
abc.async.forEach(
    [func1, func2, func3],
    function (results) {
        // finish
    }
);
function func1 (callback) {
    // ...
    callback();
}
// func2, func3

abc.async.sequence

abc.sequence(array, action, [callback]);
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
    }
);
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.

abc.dir(dirPath, callback)

abc.file.read

abc.file.read(filename, callback)

abc.file.write

abc.file.write(filename, text, callback)

abc.file.copy

abc.file.copy(sourceFileName, destinationFileName, callback)

abc.file.binRead

abc.file.binRead(filename, callback)

abc.file.binWrite

abc.file.binWrite(filename, data, callback)

abc.file.binCopy

abc.file.binCopy(sourceFileName, destinationFileName, callback)

abc.extend

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

abc.find

Recursive find in dir. Calls fileCallback for each file, and completeCallback at end.

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.

var executer = new abc.Executer(30); // No more then 30 actions in parallel.
executer.add(function (callback) {
    // do something async
    calllback();
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial