source: trip-planner-front/node_modules/yargs-parser/browser.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1016 bytes
Line 
1// Main entrypoint for ESM web browser environments. Avoids using Node.js
2// specific libraries, such as "path".
3//
4// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
5import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
6import { YargsParser } from './build/lib/yargs-parser.js'
7const parser = new YargsParser({
8 cwd: () => { return '' },
9 format: (str, arg) => { return str.replace('%s', arg) },
10 normalize: (str) => { return str },
11 resolve: (str) => { return str },
12 require: () => {
13 throw Error('loading config from files not currently supported in browser')
14 },
15 env: () => {}
16})
17
18const yargsParser = function Parser (args, opts) {
19 const result = parser.parse(args.slice(), opts)
20 return result.argv
21}
22yargsParser.detailed = function (args, opts) {
23 return parser.parse(args.slice(), opts)
24}
25yargsParser.camelCase = camelCase
26yargsParser.decamelize = decamelize
27yargsParser.looksLikeNumber = looksLikeNumber
28
29export default yargsParser
Note: See TracBrowser for help on using the repository browser.