Monday, 19 February 2018

Can you pass command line args to a module during “require”

I want to create a library that can be required as const lib = require(“lib”) with a certain command line arg AS IF it were called as node lib.js defaultval, without having to pass it to the file where it’s being called.Sort of something like const lib = require(“lib defaultval”)Is there some setting in package.json that can be manipulated for this purpose?

Submitted February 19, 2018 at 10:31PM by alfredmuffin

No comments:

Post a Comment