minimist-options
Advanced tools
Comparing version 2.0.1 to 2.0.2
44
index.js
@@ -6,7 +6,21 @@ 'use strict'; | ||
function minimistOptions(options) { | ||
if (!options) { | ||
options = {}; | ||
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; | ||
}; | ||
module.exports = options => { | ||
options = options || {}; | ||
const result = {}; | ||
@@ -21,5 +35,3 @@ | ||
if (typeof value === 'string') { | ||
value = { | ||
type: value | ||
}; | ||
value = {type: value}; | ||
} | ||
@@ -55,20 +67,2 @@ | ||
return result; | ||
} | ||
module.exports = minimistOptions; | ||
function push(obj, prop, value) { | ||
if (!obj[prop]) { | ||
obj[prop] = []; | ||
} | ||
obj[prop].push(value); | ||
} | ||
function insert(obj, prop, key, value) { | ||
if (!obj[prop]) { | ||
obj[prop] = {}; | ||
} | ||
obj[prop][key] = value; | ||
} | ||
}; |
{ | ||
"name": "minimist-options", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Pretty options for minimist", | ||
"repository": "vdemedes/minimist-options", | ||
"repository": "vadimdemedes/minimist-options", | ||
"author": "Vadim Demedes <vdemedes@gmail.com>", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"keywords": [ | ||
@@ -16,2 +13,8 @@ "minimist", | ||
], | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"engines": { | ||
"node": ">= 4" | ||
}, | ||
"files": [ | ||
@@ -25,8 +28,5 @@ "index.js" | ||
"devDependencies": { | ||
"ava": "^0.16.0", | ||
"ava": "^0.18.2", | ||
"xo": "^0.16.0" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# minimist-options [![Build Status](https://travis-ci.org/vdemedes/minimist-options.svg?branch=master)](https://travis-ci.org/vdemedes/minimist-options) | ||
# minimist-options [![Build Status](https://travis-ci.org/vadimdemedes/minimist-options.svg?branch=master)](https://travis-ci.org/vadimdemedes/minimist-options) | ||
@@ -8,3 +8,3 @@ > Write options for [minimist](https://npmjs.org/package/minimist) in a comfortable way. | ||
``` | ||
$ npm install minimist-options --save | ||
$ npm install --save minimist-options | ||
``` | ||
@@ -21,3 +21,3 @@ | ||
type: 'string', | ||
alias: 'n', | ||
aliases: 'n', | ||
default: 'john' | ||
@@ -28,3 +28,3 @@ }, | ||
type: 'boolean', | ||
alias: 'f', | ||
aliases: ['f', 'o'], | ||
default: false | ||
@@ -49,3 +49,4 @@ }, | ||
n: 'name', | ||
f: 'force' | ||
f: 'force', | ||
o: 'force' | ||
}, | ||
@@ -63,2 +64,2 @@ default: { | ||
MIT © [Vadym Demedes](http://vadimdemedes.com) | ||
MIT © [Vadim Demedes](https://vadimdemedes.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
61
3730
48