mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-18 00:03:38 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
77
node_modules/minimist-options/index.js
generated
vendored
Normal file
77
node_modules/minimist-options/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
|
||||
const isPlainObject = require('is-plain-obj');
|
||||
const arrify = require('arrify');
|
||||
|
||||
const push = (obj, prop, value) => {
|
||||
if (!obj[prop]) {
|
||||
obj[prop] = [];
|
||||
}
|
||||
|
||||
obj[prop].push(value);
|
||||
};
|
||||
|
||||
const insert = (obj, prop, key, value) => {
|
||||
if (!obj[prop]) {
|
||||
obj[prop] = {};
|
||||
}
|
||||
|
||||
obj[prop][key] = value;
|
||||
};
|
||||
|
||||
const passthroughOptions = ['stopEarly', 'unknown', '--'];
|
||||
|
||||
module.exports = options => {
|
||||
options = options || {};
|
||||
|
||||
const result = {};
|
||||
|
||||
passthroughOptions.forEach(key => {
|
||||
if (options[key]) {
|
||||
result[key] = options[key];
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(options).forEach(key => {
|
||||
let value = options[key];
|
||||
|
||||
if (key === 'arguments') {
|
||||
key = '_';
|
||||
}
|
||||
|
||||
// If short form is used
|
||||
// convert it to long form
|
||||
// e.g. { 'name': 'string' }
|
||||
if (typeof value === 'string') {
|
||||
value = {type: value};
|
||||
}
|
||||
|
||||
if (isPlainObject(value)) {
|
||||
const props = value;
|
||||
|
||||
if (props.type) {
|
||||
const type = props.type;
|
||||
|
||||
if (type === 'string') {
|
||||
push(result, 'string', key);
|
||||
}
|
||||
|
||||
if (type === 'boolean') {
|
||||
push(result, 'boolean', key);
|
||||
}
|
||||
}
|
||||
|
||||
const aliases = arrify(props.alias);
|
||||
|
||||
aliases.forEach(alias => {
|
||||
insert(result, 'alias', alias, key);
|
||||
});
|
||||
|
||||
if ({}.hasOwnProperty.call(props, 'default')) {
|
||||
insert(result, 'default', key, props.default);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
21
node_modules/minimist-options/license
generated
vendored
Normal file
21
node_modules/minimist-options/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Vadim Demedes <vdemedes@gmail.com> (vadimdemedes.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.
|
||||
30
node_modules/minimist-options/package.json
generated
vendored
Normal file
30
node_modules/minimist-options/package.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "minimist-options",
|
||||
"version": "3.0.2",
|
||||
"description": "Pretty options for minimist",
|
||||
"repository": "vadimdemedes/minimist-options",
|
||||
"author": "Vadim Demedes <vdemedes@gmail.com>",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"minimist",
|
||||
"argv",
|
||||
"args"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"arrify": "^1.0.1",
|
||||
"is-plain-obj": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.18.2",
|
||||
"xo": "^0.18.2"
|
||||
}
|
||||
}
|
||||
63
node_modules/minimist-options/readme.md
generated
vendored
Normal file
63
node_modules/minimist-options/readme.md
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# minimist-options [](https://travis-ci.org/vadimdemedes/minimist-options)
|
||||
|
||||
> Write options for [minimist](https://npmjs.org/package/minimist) in a comfortable way.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install --save minimist-options
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const buildOptions = require('minimist-options');
|
||||
const minimist = require('minimist');
|
||||
|
||||
const options = buildOptions({
|
||||
name: {
|
||||
type: 'string',
|
||||
alias: 'n',
|
||||
default: 'john'
|
||||
},
|
||||
|
||||
force: {
|
||||
type: 'boolean',
|
||||
alias: ['f', 'o'],
|
||||
default: false
|
||||
},
|
||||
|
||||
published: 'boolean',
|
||||
|
||||
// special option for positional arguments (`_` in minimist)
|
||||
arguments: 'string'
|
||||
});
|
||||
|
||||
const args = minimist(options);
|
||||
```
|
||||
|
||||
instead of:
|
||||
|
||||
```js
|
||||
const minimist = require('minimist');
|
||||
|
||||
const options = {
|
||||
string: ['name', '_'],
|
||||
boolean: ['force', 'published'],
|
||||
alias: {
|
||||
n: 'name',
|
||||
f: 'force',
|
||||
o: 'force'
|
||||
},
|
||||
default: {
|
||||
name: 'john',
|
||||
f: false
|
||||
}
|
||||
};
|
||||
|
||||
const args = minimist(options);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Vadim Demedes](https://vadimdemedes.com)
|
||||
Reference in New Issue
Block a user