1.0.8 • Published 3 years ago

js-exec-utils v1.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

js-exec-utils

Description

nodejs: Execute script/module/package/function in shell

Installation

npm install js-exec-utils

UsageSample

eg: vi sample/math.js

const {runIfMain} = require("js-exec-utils");
module.exports = {
    name: 'math calculator',
    tips: `node ${__filename} sum ...args`,
    sum: (...args) => {
        return [0, ...args].reduce((a, b) => Number(a) + Number(b));
    }
};
runIfMain(__filename, module.exports);

then shell > cd sample && node math.js sum 1 2 3 4

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago