Skip to content

Commit

Permalink
revert to rollup v1.7.4 for Node.js v4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Jul 29, 2021
1 parent cff71b1 commit f7df343
Show file tree
Hide file tree
Showing 5 changed files with 655 additions and 639 deletions.
48 changes: 23 additions & 25 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict';

var camelCase = require('lodash.camelcase');
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var camelCase__default = /*#__PURE__*/_interopDefaultLegacy(camelCase);
var camelCase = _interopDefault(require('lodash.camelcase'));

/**
* Takes any input and guarantees an array back.
Expand Down Expand Up @@ -38,20 +36,20 @@ var camelCase__default = /*#__PURE__*/_interopDefaultLegacy(camelCase);
* [ 1, 2, 3 ]
*/

function isObject$2 (input) {
function isObject (input) {
return typeof input === 'object' && input !== null
}

function isArrayLike$2 (input) {
return isObject$2(input) && typeof input.length === 'number'
function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
}

/**
* @param {*} - The input value to convert to an array
* @returns {Array}
* @alias module:array-back
*/
function arrayify$1 (input) {
function arrayify (input) {
if (Array.isArray(input)) {
return input
}
Expand All @@ -60,7 +58,7 @@ function arrayify$1 (input) {
return []
}

if (isArrayLike$2(input) || input instanceof Set) {
if (isArrayLike(input) || input instanceof Set) {
return Array.from(input)
}

Expand Down Expand Up @@ -109,7 +107,7 @@ function isArrayLike$1 (input) {
* @returns {Array}
* @alias module:array-back
*/
function arrayify (input) {
function arrayify$1 (input) {
if (Array.isArray(input)) {
return input
} else {
Expand Down Expand Up @@ -153,10 +151,10 @@ function arrayify (input) {
*/
function findReplace (array, testFn) {
const found = [];
const replaceWiths = arrayify(arguments);
const replaceWiths = arrayify$1(arguments);
replaceWiths.splice(0, 2);

arrayify(array).forEach((value, index) => {
arrayify$1(array).forEach((value, index) => {
let expanded = [];
replaceWiths.forEach(replaceWith => {
if (typeof replaceWith === 'function') {
Expand Down Expand Up @@ -214,7 +212,7 @@ class ArgvArray extends Array {
load (argv) {
this.clear();
if (argv && argv !== process.argv) {
argv = arrayify$1(argv);
argv = arrayify(argv);
} else {
/* if no argv supplied, assume we are parsing process.argv */
argv = process.argv.slice(0);
Expand Down Expand Up @@ -419,8 +417,8 @@ function isPlainObject (input) {
* // prints `true`
* }
*/
function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
function isArrayLike$2 (input) {
return isObject$2(input) && typeof input.length === 'number'
}

/**
Expand All @@ -429,7 +427,7 @@ function isArrayLike (input) {
* @returns {boolean}
* @static
*/
function isObject (input) {
function isObject$2 (input) {
return typeof input === 'object' && input !== null
}

Expand Down Expand Up @@ -578,8 +576,8 @@ var t = {
isString,
isBoolean,
isPlainObject,
isArrayLike,
isObject,
isArrayLike: isArrayLike$2,
isObject: isObject$2,
isDefined,
isFunction,
isClass,
Expand Down Expand Up @@ -1003,7 +1001,7 @@ class Definitions extends Array {

static from (definitions, caseInsensitive) {
if (definitions instanceof this) return definitions
const result = super.from(arrayify$1(definitions), def => OptionDefinition.create(def));
const result = super.from(arrayify(definitions), def => OptionDefinition.create(def));
result.validate(caseInsensitive);
return result
}
Expand All @@ -1016,7 +1014,7 @@ function halt (name, message) {
}

function containsValidGroup (def) {
return arrayify$1(def.group).some(group => group)
return arrayify(def.group).some(group => group)
}

function hasDuplicates (array) {
Expand Down Expand Up @@ -1218,7 +1216,7 @@ class Option {
resetToDefault () {
if (t.isDefined(this.definition.defaultValue)) {
if (this.definition.isMultiple()) {
_value.set(this, arrayify$1(this.definition.defaultValue).slice());
_value.set(this, arrayify(this.definition.defaultValue).slice());
} else {
_value.set(this, this.definition.defaultValue);
}
Expand Down Expand Up @@ -1274,7 +1272,7 @@ class Output extends Map {
options = options || {};
const output = {};
for (const item of this) {
const name = options.camelCase && item[0] !== '_unknown' ? camelCase__default['default'](item[0]) : item[0];
const name = options.camelCase && item[0] !== '_unknown' ? camelCase(item[0]) : item[0];
const option = item[1];
if (name === '_unknown' && !option.get().length) continue
output[name] = option.get();
Expand All @@ -1297,9 +1295,9 @@ class GroupedOutput extends Output {
if (unknown && unknown.length) grouped._unknown = unknown;

this.definitions.whereGrouped().forEach(def => {
const name = options.camelCase ? camelCase__default['default'](def.name) : def.name;
const name = options.camelCase ? camelCase(def.name) : def.name;
const outputValue = superOutputNoCamel[def.name];
for (const groupName of arrayify$1(def.group)) {
for (const groupName of arrayify(def.group)) {
grouped[groupName] = grouped[groupName] || {};
if (t.isDefined(outputValue)) {
grouped[groupName][name] = outputValue;
Expand All @@ -1308,7 +1306,7 @@ class GroupedOutput extends Output {
});

this.definitions.whereNotGrouped().forEach(def => {
const name = options.camelCase ? camelCase__default['default'](def.name) : def.name;
const name = options.camelCase ? camelCase(def.name) : def.name;
const outputValue = superOutputNoCamel[def.name];
if (t.isDefined(outputValue)) {
if (!grouped._none) grouped._none = {};
Expand Down
38 changes: 19 additions & 19 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ import camelCase from 'lodash.camelcase';
* [ 1, 2, 3 ]
*/

function isObject$2 (input) {
function isObject (input) {
return typeof input === 'object' && input !== null
}

function isArrayLike$2 (input) {
return isObject$2(input) && typeof input.length === 'number'
function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
}

/**
* @param {*} - The input value to convert to an array
* @returns {Array}
* @alias module:array-back
*/
function arrayify$1 (input) {
function arrayify (input) {
if (Array.isArray(input)) {
return input
}
Expand All @@ -54,7 +54,7 @@ function arrayify$1 (input) {
return []
}

if (isArrayLike$2(input) || input instanceof Set) {
if (isArrayLike(input) || input instanceof Set) {
return Array.from(input)
}

Expand Down Expand Up @@ -103,7 +103,7 @@ function isArrayLike$1 (input) {
* @returns {Array}
* @alias module:array-back
*/
function arrayify (input) {
function arrayify$1 (input) {
if (Array.isArray(input)) {
return input
} else {
Expand Down Expand Up @@ -147,10 +147,10 @@ function arrayify (input) {
*/
function findReplace (array, testFn) {
const found = [];
const replaceWiths = arrayify(arguments);
const replaceWiths = arrayify$1(arguments);
replaceWiths.splice(0, 2);

arrayify(array).forEach((value, index) => {
arrayify$1(array).forEach((value, index) => {
let expanded = [];
replaceWiths.forEach(replaceWith => {
if (typeof replaceWith === 'function') {
Expand Down Expand Up @@ -208,7 +208,7 @@ class ArgvArray extends Array {
load (argv) {
this.clear();
if (argv && argv !== process.argv) {
argv = arrayify$1(argv);
argv = arrayify(argv);
} else {
/* if no argv supplied, assume we are parsing process.argv */
argv = process.argv.slice(0);
Expand Down Expand Up @@ -413,8 +413,8 @@ function isPlainObject (input) {
* // prints `true`
* }
*/
function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
function isArrayLike$2 (input) {
return isObject$2(input) && typeof input.length === 'number'
}

/**
Expand All @@ -423,7 +423,7 @@ function isArrayLike (input) {
* @returns {boolean}
* @static
*/
function isObject (input) {
function isObject$2 (input) {
return typeof input === 'object' && input !== null
}

Expand Down Expand Up @@ -572,8 +572,8 @@ var t = {
isString,
isBoolean,
isPlainObject,
isArrayLike,
isObject,
isArrayLike: isArrayLike$2,
isObject: isObject$2,
isDefined,
isFunction,
isClass,
Expand Down Expand Up @@ -997,7 +997,7 @@ class Definitions extends Array {

static from (definitions, caseInsensitive) {
if (definitions instanceof this) return definitions
const result = super.from(arrayify$1(definitions), def => OptionDefinition.create(def));
const result = super.from(arrayify(definitions), def => OptionDefinition.create(def));
result.validate(caseInsensitive);
return result
}
Expand All @@ -1010,7 +1010,7 @@ function halt (name, message) {
}

function containsValidGroup (def) {
return arrayify$1(def.group).some(group => group)
return arrayify(def.group).some(group => group)
}

function hasDuplicates (array) {
Expand Down Expand Up @@ -1212,7 +1212,7 @@ class Option {
resetToDefault () {
if (t.isDefined(this.definition.defaultValue)) {
if (this.definition.isMultiple()) {
_value.set(this, arrayify$1(this.definition.defaultValue).slice());
_value.set(this, arrayify(this.definition.defaultValue).slice());
} else {
_value.set(this, this.definition.defaultValue);
}
Expand Down Expand Up @@ -1293,7 +1293,7 @@ class GroupedOutput extends Output {
this.definitions.whereGrouped().forEach(def => {
const name = options.camelCase ? camelCase(def.name) : def.name;
const outputValue = superOutputNoCamel[def.name];
for (const groupName of arrayify$1(def.group)) {
for (const groupName of arrayify(def.group)) {
grouped[groupName] = grouped[groupName] || {};
if (t.isDefined(outputValue)) {
grouped[groupName][name] = outputValue;
Expand Down Expand Up @@ -1392,4 +1392,4 @@ function commandLineArgs (optionDefinitions, options) {
return output.toObject({ skipUnknown: !options.partial, camelCase: options.camelCase })
}

export { commandLineArgs as default };
export default commandLineArgs;
Loading

0 comments on commit f7df343

Please sign in to comment.