Morris
Morris

Reputation: 601

require yargs package - NodeJS

What is the differences of var argv = require("yargs") and var argv = require("yargs").argv? Into variable argv how the same time that i require a package, there are all functions/modules of package but .argv what is it?

Thanks all Morris

Upvotes: 0

Views: 1107

Answers (1)

Tom Jardine-McNamara
Tom Jardine-McNamara

Reputation: 2608

require('yargs') loads the yargs module whih will immediately parse command line options for you. .argv will contain the options and values the user passes. You could also write it as :

const yargs = require ('yargs')
const argv = yargs.argv

Upvotes: 2

Related Questions