$
This commit is contained in:
82
node_modules/yargs-unparser/CHANGELOG.md
generated
vendored
Normal file
82
node_modules/yargs-unparser/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [2.0.0](https://www.github.com/yargs/yargs-unparser/compare/v1.6.4...v2.0.0) (2020-10-02)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* upgrade deps drop Node 6/8 (#71)
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* upgrade deps drop Node 6/8 ([#71](https://www.github.com/yargs/yargs-unparser/issues/71)) ([c686882](https://www.github.com/yargs/yargs-unparser/commit/c686882f5ad554be44169e3745e741cb4ec898d0))
|
||||
|
||||
### [1.6.4](https://www.github.com/yargs/yargs-unparser/compare/v1.6.3...v1.6.4) (2020-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **security:** upgraded flat to version ^5.0.2 ([9bd7c67](https://www.github.com/yargs/yargs-unparser/commit/9bd7c672e12417319c5d4de79070d9c7cd5107f2))
|
||||
|
||||
### [1.6.3](https://www.github.com/yargs/yargs-unparser/compare/v1.6.2...v1.6.3) (2020-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* test automatic publish ([209a487](https://www.github.com/yargs/yargs-unparser/commit/209a4870af799f4b200c2a89d7b7e50c9fd5fd1f))
|
||||
|
||||
### [1.6.2](https://www.github.com/yargs/yargs-unparser/compare/v1.6.1...v1.6.2) (2020-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **readme:** marketing was injected dubiously into README ([#60](https://www.github.com/yargs/yargs-unparser/issues/60)) ([1167667](https://www.github.com/yargs/yargs-unparser/commit/1167667886fcb103c747e3c9855f353ee0e41c03))
|
||||
|
||||
### [1.6.1](https://www.github.com/yargs/yargs-unparser/compare/v1.6.0...v1.6.1) (2020-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** downgrade yargs, such that we continue supporting Node 6 ([#57](https://www.github.com/yargs/yargs-unparser/issues/57)) ([f69406c](https://www.github.com/yargs/yargs-unparser/commit/f69406c34bead63011590f7b51a24a6f311c1a48))
|
||||
|
||||
## 1.6.0 (2019-07-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **security:** update deps addressing recent audit vulnerabilities ([#40](https://github.com/yargs/yargs-unparser/issues/40)) ([2e74f1b](https://github.com/yargs/yargs-unparser/commit/2e74f1b))
|
||||
* address bug with camelCased flattened keys ([#32](https://github.com/yargs/yargs-unparser/issues/32)) ([981533a](https://github.com/yargs/yargs-unparser/commit/981533a))
|
||||
* **deps:** updated the lodash version to fix vulnerability ([#39](https://github.com/yargs/yargs-unparser/issues/39)) ([7375966](https://github.com/yargs/yargs-unparser/commit/7375966))
|
||||
* **package:** update yargs to version 10.0.3 ([f1eb4cb](https://github.com/yargs/yargs-unparser/commit/f1eb4cb))
|
||||
* **package:** update yargs to version 11.0.0 ([6aa7c91](https://github.com/yargs/yargs-unparser/commit/6aa7c91))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add interoperation with minimist ([ba477f5](https://github.com/yargs/yargs-unparser/commit/ba477f5))
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
# 1.5.0 (2018-11-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update yargs to version 10.0.3 ([f1eb4cb](https://github.com/yargs/yargs-unparser/commit/f1eb4cb))
|
||||
* **package:** update yargs to version 11.0.0 ([6aa7c91](https://github.com/yargs/yargs-unparser/commit/6aa7c91))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add interoperation with minimist ([ba477f5](https://github.com/yargs/yargs-unparser/commit/ba477f5))
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/moxystudio/yargs-unparser/compare/v1.3.0...v1.4.0) (2017-12-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add interoperation with minimist ([ba477f5](https://github.com/moxystudio/yargs-unparser/commit/ba477f5))
|
21
node_modules/yargs-unparser/LICENSE
generated
vendored
Normal file
21
node_modules/yargs-unparser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Made With MOXY Lda <hello@moxy.studio>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
86
node_modules/yargs-unparser/README.md
generated
vendored
Normal file
86
node_modules/yargs-unparser/README.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# yargs-unparser
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/yargs-unparser
|
||||
[npm-image]:http://img.shields.io/npm/v/yargs-unparser.svg
|
||||
[downloads-image]:http://img.shields.io/npm/dm/yargs-unparser.svg
|
||||
|
||||
Converts back a `yargs` argv object to its original array form.
|
||||
|
||||
Probably the unparser word doesn't even exist, but it sounds nice and goes well with [yargs-parser](https://github.com/yargs/yargs-parser).
|
||||
|
||||
The code originally lived in [MOXY](https://github.com/moxystudio)'s GitHub but was later moved here for discoverability.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
`$ npm install yargs-unparser`
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const parse = require('yargs-parser');
|
||||
const unparse = require('yargs-unparser');
|
||||
|
||||
const argv = parse(['--no-boolean', '--number', '4', '--string', 'foo'], {
|
||||
boolean: ['boolean'],
|
||||
number: ['number'],
|
||||
string: ['string'],
|
||||
});
|
||||
// { boolean: false, number: 4, string: 'foo', _: [] }
|
||||
|
||||
const unparsedArgv = unparse(argv);
|
||||
// ['--no-boolean', '--number', '4', '--string', 'foo'];
|
||||
```
|
||||
|
||||
The second argument of `unparse` accepts an options object:
|
||||
|
||||
- `alias`: The [aliases](https://github.com/yargs/yargs-parser#requireyargs-parserargs-opts) so that duplicate options aren't generated
|
||||
- `default`: The [default](https://github.com/yargs/yargs-parser#requireyargs-parserargs-opts) values so that the options with default values are omitted
|
||||
- `command`: The [command](https://github.com/yargs/yargs/blob/master/docs/advanced.md#commands) first argument so that command names and positional arguments are handled correctly
|
||||
|
||||
### Example with `command` options
|
||||
|
||||
```js
|
||||
const yargs = require('yargs');
|
||||
const unparse = require('yargs-unparser');
|
||||
|
||||
const argv = yargs
|
||||
.command('my-command <positional>', 'My awesome command', (yargs) =>
|
||||
yargs
|
||||
.option('boolean', { type: 'boolean' })
|
||||
.option('number', { type: 'number' })
|
||||
.option('string', { type: 'string' })
|
||||
)
|
||||
.parse(['my-command', 'hello', '--no-boolean', '--number', '4', '--string', 'foo']);
|
||||
// { positional: 'hello', boolean: false, number: 4, string: 'foo', _: ['my-command'] }
|
||||
|
||||
const unparsedArgv = unparse(argv, {
|
||||
command: 'my-command <positional>',
|
||||
});
|
||||
// ['my-command', 'hello', '--no-boolean', '--number', '4', '--string', 'foo'];
|
||||
```
|
||||
|
||||
### Caveats
|
||||
|
||||
The returned array can be parsed again by `yargs-parser` using the default configuration. If you used custom configuration that you want `yargs-unparser` to be aware, please fill an [issue](https://github.com/yargs/yargs-unparser/issues).
|
||||
|
||||
If you `coerce` in weird ways, things might not work correctly.
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
`$ npm test`
|
||||
`$ npm test -- --watch` during development
|
||||
|
||||
## Supported Node.js Versions
|
||||
|
||||
Libraries in this ecosystem make a best effort to track
|
||||
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
|
||||
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://opensource.org/licenses/MIT)
|
166
node_modules/yargs-unparser/index.js
generated
vendored
Normal file
166
node_modules/yargs-unparser/index.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
'use strict';
|
||||
|
||||
const flatten = require('flat');
|
||||
const camelcase = require('camelcase');
|
||||
const decamelize = require('decamelize');
|
||||
const isPlainObj = require('is-plain-obj');
|
||||
|
||||
function isAlias(key, alias) {
|
||||
// TODO Switch to Object.values one Node.js 6 is dropped
|
||||
return Object.keys(alias).some((id) => [].concat(alias[id]).indexOf(key) !== -1);
|
||||
}
|
||||
|
||||
function hasDefaultValue(key, value, defaults) {
|
||||
return value === defaults[key];
|
||||
}
|
||||
|
||||
function isCamelCased(key, argv) {
|
||||
return /[A-Z]/.test(key) && camelcase(key) === key && // Is it camel case?
|
||||
argv[decamelize(key, '-')] != null; // Is the standard version defined?
|
||||
}
|
||||
|
||||
function keyToFlag(key) {
|
||||
return key.length === 1 ? `-${key}` : `--${key}`;
|
||||
}
|
||||
|
||||
function parseCommand(cmd) {
|
||||
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
|
||||
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
|
||||
const bregex = /\.*[\][<>]/g;
|
||||
const firstCommand = splitCommand.shift();
|
||||
|
||||
if (!firstCommand) { throw new Error(`No command found in: ${cmd}`); }
|
||||
const parsedCommand = {
|
||||
cmd: firstCommand.replace(bregex, ''),
|
||||
demanded: [],
|
||||
optional: [],
|
||||
};
|
||||
|
||||
splitCommand.forEach((cmd, i) => {
|
||||
let variadic = false;
|
||||
|
||||
cmd = cmd.replace(/\s/g, '');
|
||||
if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) { variadic = true; }
|
||||
if (/^\[/.test(cmd)) {
|
||||
parsedCommand.optional.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic,
|
||||
});
|
||||
} else {
|
||||
parsedCommand.demanded.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return parsedCommand;
|
||||
}
|
||||
|
||||
function unparseOption(key, value, unparsed) {
|
||||
if (typeof value === 'string') {
|
||||
unparsed.push(keyToFlag(key), value);
|
||||
} else if (value === true) {
|
||||
unparsed.push(keyToFlag(key));
|
||||
} else if (value === false) {
|
||||
unparsed.push(`--no-${key}`);
|
||||
} else if (Array.isArray(value)) {
|
||||
value.forEach((item) => unparseOption(key, item, unparsed));
|
||||
} else if (isPlainObj(value)) {
|
||||
const flattened = flatten(value, { safe: true });
|
||||
|
||||
for (const flattenedKey in flattened) {
|
||||
if (!isCamelCased(flattenedKey, flattened)) {
|
||||
unparseOption(`${key}.${flattenedKey}`, flattened[flattenedKey], unparsed);
|
||||
}
|
||||
}
|
||||
// Fallback case (numbers and other types)
|
||||
} else if (value != null) {
|
||||
unparsed.push(keyToFlag(key), `${value}`);
|
||||
}
|
||||
}
|
||||
|
||||
function unparsePositional(argv, options, unparsed) {
|
||||
const knownPositional = [];
|
||||
|
||||
// Unparse command if set, collecting all known positional arguments
|
||||
// e.g.: build <first> <second> <rest...>
|
||||
if (options.command) {
|
||||
const { 0: cmd, index } = options.command.match(/[^<[]*/);
|
||||
const { demanded, optional } = parseCommand(`foo ${options.command.substr(index + cmd.length)}`);
|
||||
|
||||
// Push command (can be a deep command)
|
||||
unparsed.push(...cmd.trim().split(/\s+/));
|
||||
|
||||
// Push positional arguments
|
||||
[...demanded, ...optional].forEach(({ cmd: cmds, variadic }) => {
|
||||
knownPositional.push(...cmds);
|
||||
|
||||
const cmd = cmds[0];
|
||||
const args = (variadic ? argv[cmd] || [] : [argv[cmd]])
|
||||
.filter((arg) => arg != null)
|
||||
.map((arg) => `${arg}`);
|
||||
|
||||
unparsed.push(...args);
|
||||
});
|
||||
}
|
||||
|
||||
// Unparse unkown positional arguments
|
||||
argv._ && unparsed.push(...argv._.slice(knownPositional.length));
|
||||
|
||||
return knownPositional;
|
||||
}
|
||||
|
||||
function unparseOptions(argv, options, knownPositional, unparsed) {
|
||||
for (const key of Object.keys(argv)) {
|
||||
const value = argv[key];
|
||||
|
||||
if (
|
||||
// Remove positional arguments
|
||||
knownPositional.includes(key) ||
|
||||
// Remove special _, -- and $0
|
||||
['_', '--', '$0'].includes(key) ||
|
||||
// Remove aliases
|
||||
isAlias(key, options.alias) ||
|
||||
// Remove default values
|
||||
hasDefaultValue(key, value, options.default) ||
|
||||
// Remove camel-cased
|
||||
isCamelCased(key, argv)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unparseOption(key, argv[key], unparsed);
|
||||
}
|
||||
}
|
||||
|
||||
function unparseEndOfOptions(argv, options, unparsed) {
|
||||
// Unparse ending (--) arguments if set
|
||||
argv['--'] && unparsed.push('--', ...argv['--']);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
function unparser(argv, options) {
|
||||
options = Object.assign({
|
||||
alias: {},
|
||||
default: {},
|
||||
command: null,
|
||||
}, options);
|
||||
|
||||
const unparsed = [];
|
||||
|
||||
// Unparse known & unknown positional arguments (foo <first> <second> [rest...])
|
||||
// All known positional will be returned so that they are not added as flags
|
||||
const knownPositional = unparsePositional(argv, options, unparsed);
|
||||
|
||||
// Unparse option arguments (--foo hello --bar hi)
|
||||
unparseOptions(argv, options, knownPositional, unparsed);
|
||||
|
||||
// Unparse "end-of-options" arguments (stuff after " -- ")
|
||||
unparseEndOfOptions(argv, options, unparsed);
|
||||
|
||||
return unparsed;
|
||||
}
|
||||
|
||||
module.exports = unparser;
|
101
node_modules/yargs-unparser/node_modules/camelcase/index.d.ts
generated
vendored
Normal file
101
node_modules/yargs-unparser/node_modules/camelcase/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
declare namespace camelcase {
|
||||
interface Options {
|
||||
/**
|
||||
Uppercase the first character: `foo-bar` → `FooBar`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly pascalCase?: boolean;
|
||||
|
||||
/**
|
||||
Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly preserveConsecutiveUppercase?: boolean;
|
||||
|
||||
/**
|
||||
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
||||
|
||||
Default: The host environment’s current locale.
|
||||
|
||||
@example
|
||||
```
|
||||
import camelCase = require('camelcase');
|
||||
|
||||
camelCase('lorem-ipsum', {locale: 'en-US'});
|
||||
//=> 'loremIpsum'
|
||||
camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
||||
//=> 'loremİpsum'
|
||||
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
||||
//=> 'loremIpsum'
|
||||
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
||||
//=> 'loremİpsum'
|
||||
```
|
||||
*/
|
||||
readonly locale?: string | readonly string[];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
||||
|
||||
Correctly handles Unicode strings.
|
||||
|
||||
@param input - String to convert to camel case.
|
||||
|
||||
@example
|
||||
```
|
||||
import camelCase = require('camelcase');
|
||||
|
||||
camelCase('foo-bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo_bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('розовый_пушистый_единороги');
|
||||
//=> 'розовыйПушистыйЕдинороги'
|
||||
|
||||
camelCase('Foo-Bar', {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase('--foo.bar', {pascalCase: false});
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
|
||||
//=> 'fooBAR'
|
||||
|
||||
camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true}));
|
||||
//=> 'FooBAR'
|
||||
|
||||
camelCase('foo bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
console.log(process.argv[3]);
|
||||
//=> '--foo-bar'
|
||||
camelCase(process.argv[3]);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['foo', 'bar']);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
|
||||
//=> 'FooBAR'
|
||||
|
||||
camelCase('lorem-ipsum', {locale: 'en-US'});
|
||||
//=> 'loremIpsum'
|
||||
```
|
||||
*/
|
||||
declare function camelcase(
|
||||
input: string | readonly string[],
|
||||
options?: camelcase.Options
|
||||
): string;
|
||||
|
||||
export = camelcase;
|
91
node_modules/yargs-unparser/node_modules/camelcase/index.js
generated
vendored
Normal file
91
node_modules/yargs-unparser/node_modules/camelcase/index.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
const preserveCamelCase = (string, locale) => {
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
const character = string[i];
|
||||
|
||||
if (isLastCharLower && /[\p{Lu}]/u.test(character)) {
|
||||
string = string.slice(0, i) + '-' + string.slice(i);
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i++;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) {
|
||||
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = character.toLocaleLowerCase(locale) === character && character.toLocaleUpperCase(locale) !== character;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = character.toLocaleUpperCase(locale) === character && character.toLocaleLowerCase(locale) !== character;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
const preserveConsecutiveUppercase = input => {
|
||||
return input.replace(/^[\p{Lu}](?![\p{Lu}])/gu, m1 => m1.toLowerCase());
|
||||
};
|
||||
|
||||
const postProcess = (input, options) => {
|
||||
return input.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase(options.locale))
|
||||
.replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase(options.locale));
|
||||
};
|
||||
|
||||
const camelCase = (input, options) => {
|
||||
if (!(typeof input === 'string' || Array.isArray(input))) {
|
||||
throw new TypeError('Expected the input to be `string | string[]`');
|
||||
}
|
||||
|
||||
options = {
|
||||
pascalCase: false,
|
||||
preserveConsecutiveUppercase: false,
|
||||
...options
|
||||
};
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
input = input.map(x => x.trim())
|
||||
.filter(x => x.length)
|
||||
.join('-');
|
||||
} else {
|
||||
input = input.trim();
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (input.length === 1) {
|
||||
return options.pascalCase ? input.toLocaleUpperCase(options.locale) : input.toLocaleLowerCase(options.locale);
|
||||
}
|
||||
|
||||
const hasUpperCase = input !== input.toLocaleLowerCase(options.locale);
|
||||
|
||||
if (hasUpperCase) {
|
||||
input = preserveCamelCase(input, options.locale);
|
||||
}
|
||||
|
||||
input = input.replace(/^[_.\- ]+/, '');
|
||||
|
||||
if (options.preserveConsecutiveUppercase) {
|
||||
input = preserveConsecutiveUppercase(input);
|
||||
} else {
|
||||
input = input.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
if (options.pascalCase) {
|
||||
input = input.charAt(0).toLocaleUpperCase(options.locale) + input.slice(1);
|
||||
}
|
||||
|
||||
return postProcess(input, options);
|
||||
};
|
||||
|
||||
module.exports = camelCase;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = camelCase;
|
9
node_modules/yargs-unparser/node_modules/camelcase/license
generated
vendored
Normal file
9
node_modules/yargs-unparser/node_modules/camelcase/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
44
node_modules/yargs-unparser/node_modules/camelcase/package.json
generated
vendored
Normal file
44
node_modules/yargs-unparser/node_modules/camelcase/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "camelcase",
|
||||
"version": "6.2.0",
|
||||
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/camelcase",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert",
|
||||
"pascalcase",
|
||||
"pascal-case"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.28.3"
|
||||
}
|
||||
}
|
128
node_modules/yargs-unparser/node_modules/camelcase/readme.md
generated
vendored
Normal file
128
node_modules/yargs-unparser/node_modules/camelcase/readme.md
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
# camelcase [](https://travis-ci.com/sindresorhus/camelcase)
|
||||
|
||||
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
|
||||
|
||||
Correctly handles Unicode strings.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install camelcase
|
||||
```
|
||||
|
||||
*If you need to support Firefox, stay on version 5 as version 6 uses regex features not available in Firefox.*
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const camelCase = require('camelcase');
|
||||
|
||||
camelCase('foo-bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo_bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('розовый_пушистый_единороги');
|
||||
//=> 'розовыйПушистыйЕдинороги'
|
||||
|
||||
camelCase('Foo-Bar', {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase('--foo.bar', {pascalCase: false});
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
|
||||
//=> 'fooBAR'
|
||||
|
||||
camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true}));
|
||||
//=> 'FooBAR'
|
||||
|
||||
camelCase('foo bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
console.log(process.argv[3]);
|
||||
//=> '--foo-bar'
|
||||
camelCase(process.argv[3]);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['foo', 'bar']);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
|
||||
//=> 'FooBAR'
|
||||
|
||||
camelCase('lorem-ipsum', {locale: 'en-US'});
|
||||
//=> 'loremIpsum'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### camelCase(input, options?)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string | string[]`
|
||||
|
||||
String to convert to camel case.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### pascalCase
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Uppercase the first character: `foo-bar` → `FooBar`
|
||||
|
||||
##### preserveConsecutiveUppercase
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
||||
|
||||
##### locale
|
||||
|
||||
Type: `string | string[]`\
|
||||
Default: The host environment’s current locale.
|
||||
|
||||
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
||||
|
||||
```js
|
||||
const camelCase = require('camelcase');
|
||||
|
||||
camelCase('lorem-ipsum', {locale: 'en-US'});
|
||||
//=> 'loremIpsum'
|
||||
|
||||
camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
||||
//=> 'loremİpsum'
|
||||
|
||||
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
||||
//=> 'loremIpsum'
|
||||
|
||||
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
||||
//=> 'loremİpsum'
|
||||
```
|
||||
|
||||
## camelcase for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
||||
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
||||
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
|
||||
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
|
||||
- [camelcase-keys](https://github.com/sindresorhus/camelcase-keys) - Convert object keys to camel case
|
20
node_modules/yargs-unparser/node_modules/decamelize/index.d.ts
generated
vendored
Normal file
20
node_modules/yargs-unparser/node_modules/decamelize/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
Convert a camelized string into a lowercased one with a custom separator: `unicornRainbow` → `unicorn_rainbow`.
|
||||
|
||||
@param string - The camelcase string to decamelize.
|
||||
@param separator - The separator to use to put in between the words from `string`. Default: `'_'`.
|
||||
|
||||
@example
|
||||
```
|
||||
import decamelize = require('decamelize');
|
||||
|
||||
decamelize('unicornRainbow');
|
||||
//=> 'unicorn_rainbow'
|
||||
|
||||
decamelize('unicornRainbow', '-');
|
||||
//=> 'unicorn-rainbow'
|
||||
```
|
||||
*/
|
||||
declare function decamelize(string: string, separator?: string): string;
|
||||
|
||||
export = decamelize;
|
12
node_modules/yargs-unparser/node_modules/decamelize/index.js
generated
vendored
Normal file
12
node_modules/yargs-unparser/node_modules/decamelize/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (text, separator = '_') => {
|
||||
if (!(typeof text === 'string' && typeof separator === 'string')) {
|
||||
throw new TypeError('The `text` and `separator` arguments should be of type `string`');
|
||||
}
|
||||
|
||||
return text
|
||||
.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, `$1${separator}$2`)
|
||||
.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, `$1${separator}$2`)
|
||||
.toLowerCase();
|
||||
};
|
9
node_modules/yargs-unparser/node_modules/decamelize/license
generated
vendored
Normal file
9
node_modules/yargs-unparser/node_modules/decamelize/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
40
node_modules/yargs-unparser/node_modules/decamelize/package.json
generated
vendored
Normal file
40
node_modules/yargs-unparser/node_modules/decamelize/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "decamelize",
|
||||
"version": "4.0.0",
|
||||
"description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/decamelize",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"decamelize",
|
||||
"decamelcase",
|
||||
"camelcase",
|
||||
"lowercase",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"string",
|
||||
"text",
|
||||
"convert"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
51
node_modules/yargs-unparser/node_modules/decamelize/readme.md
generated
vendored
Normal file
51
node_modules/yargs-unparser/node_modules/decamelize/readme.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# decamelize [](https://travis-ci.org/sindresorhus/decamelize)
|
||||
|
||||
> Convert a camelized string into a lowercased one with a custom separator<br>
|
||||
> Example: `unicornRainbow` → `unicorn_rainbow`
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install decamelize
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const decamelize = require('decamelize');
|
||||
|
||||
decamelize('unicornRainbow');
|
||||
//=> 'unicorn_rainbow'
|
||||
|
||||
decamelize('unicornRainbow', '-');
|
||||
//=> 'unicorn-rainbow'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### decamelize(input, separator?)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### separator
|
||||
|
||||
Type: `string`\
|
||||
Default: `'_'`
|
||||
|
||||
## Related
|
||||
|
||||
See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-decamelize?utm_source=npm-decamelize&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
49
node_modules/yargs-unparser/package.json
generated
vendored
Normal file
49
node_modules/yargs-unparser/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "yargs-unparser",
|
||||
"description": "Converts back a yargs argv object to its original array form",
|
||||
"version": "2.0.0",
|
||||
"keywords": [
|
||||
"yargs",
|
||||
"unparse",
|
||||
"expand",
|
||||
"inverse",
|
||||
"argv"
|
||||
],
|
||||
"author": "André Cruz <andre@moxy.studio>",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"homepage": "https://github.com/yargs/yargs-unparser",
|
||||
"repository": "yargs/yargs-unparser",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"files": [],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"fix": "eslint . --fix",
|
||||
"test": "jest --env node --coverage",
|
||||
"prerelease": "npm t && npm run lint",
|
||||
"precommit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.1.0",
|
||||
"eslint-config-moxy": "^7.1.0",
|
||||
"husky": "^3.0.1",
|
||||
"jest": "^24.9.0",
|
||||
"lint-staged": "^9.5.0",
|
||||
"minimist": "^1.2.5",
|
||||
"yargs-parser": "^18.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase": "^6.0.0",
|
||||
"decamelize": "^4.0.0",
|
||||
"flat": "^5.0.2",
|
||||
"is-plain-obj": "^2.1.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user