Nucleus Powered Mitochondria

    task-js

    0.0.5 • Public • Published

    Task.js

    The base task class.

    Usage

    var Task = require('task-js');
     
    var ConcatTask = Task.extend({
        name: 'concat',
        options: {
            separator: {
                description: "Concatenated input will be joined on this string.",
                default: process.platform === 'win32' ? '\r\n' : '\n'
            }
        },
        execute: function(resolve){
            var inputs = this.inputs;
            var options = this.options;
            var separator = options.separator;
            var res = inputs.map(function(record){
                return record.content;
            }).reduce(function (c1, c2) {
                return String(c1) + String(separator) + String(c2);
            })
            resolve(res);
        }
    });
     
    var concatTask = new ConcatTask;
    concatTask.run(
        [ {content: 'file1'}, {content: 'file2'}, {content: 'file3'} ],
        { separator: "+" }
    ).then(function(res){
        console.log(res);
    }, function(err){
        console.log(err.message);
    });

    Keywords

    Install

    npm i task-js

    DownloadsWeekly Downloads

    8

    Version

    0.0.5

    License

    MIT

    Last publish

    Collaborators

    • yuanyan