1.3.0 • Published 2 years ago

subprogram v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

subprogram

Utility to turn individual ES modules into programs that can be run.

Usage

You can turn ES module into runnable node program. This is an ES alternative to if (require.main === module) { ... } pattern.

import { script } from "subprogram"

export const main () => {
  console.log("Hello world")
}

script({ ...import.meta, main })

When above program is run as node script.js it will run a main function of the module, if module is imported no action will take place.

1.3.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.0

3 years ago