1 | const lib = require('./nopt-lib')
|
2 | const defaultTypeDefs = require('./type-defs')
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | module.exports = exports = nopt
|
11 | exports.clean = clean
|
12 | exports.typeDefs = defaultTypeDefs
|
13 | exports.lib = lib
|
14 |
|
15 | function nopt (types = {}, shorthands = {}, args = process.argv, slice = 2) {
|
16 | return lib.nopt(args.slice(slice), {
|
17 | types,
|
18 | shorthands: shorthands || {},
|
19 | typeDefs: exports.typeDefs,
|
20 | invalidHandler: exports.invalidHandler,
|
21 | })
|
22 | }
|
23 |
|
24 | function clean (data, types, typeDefs = exports.typeDefs) {
|
25 | return lib.clean(data, {
|
26 | types,
|
27 | typeDefs,
|
28 | invalidHandler: exports.invalidHandler,
|
29 | })
|
30 | }
|