--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
300
node_modules/inquirer/README.md
generated
vendored
Normal file
300
node_modules/inquirer/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
Inquirer.js
|
||||
===========
|
||||
|
||||
[](http://badge.fury.io/js/inquirer) [](http://travis-ci.org/SBoudrias/Inquirer.js) [](https://david-dm.org/SBoudrias/Inquirer.js)
|
||||
|
||||
A collection of common interactive command line user interfaces.
|
||||
|
||||
|
||||
## Goal and Philosophy
|
||||
|
||||
<img align="right" alt="Inquirer Logo" src="/assets/inquirer_readme.png" title="Inquirer.js"/>
|
||||
|
||||
**`Inquirer.js`** strives to be an easily embeddable and beautiful command line interface for [Node.js](https://nodejs.org/) (and perhaps the "CLI [Xanadu](https://en.wikipedia.org/wiki/Xanadu_(Citizen_Kane))").
|
||||
|
||||
**`Inquirer.js`** should ease the process of
|
||||
- providing *error feedback*
|
||||
- *asking questions*
|
||||
- *parsing* input
|
||||
- *validating* answers
|
||||
- managing *hierarchical prompts*
|
||||
|
||||
> **Note:** **`Inquirer.js`** provides the user interface, and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [Commander.js](https://github.com/visionmedia/commander.js).
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
### Installation
|
||||
|
||||
``` shell
|
||||
npm install inquirer
|
||||
```
|
||||
|
||||
```javascript
|
||||
var inquirer = require("inquirer");
|
||||
inquirer.prompt([/* Pass your questions in here */], function( answers ) {
|
||||
// Use user feedback for... whatever!!
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### Examples (Run it and see it)
|
||||
Checkout the `examples/` folder for code and interface examples.
|
||||
|
||||
``` shell
|
||||
node examples/pizza.js
|
||||
node examples/checkbox.js
|
||||
# etc...
|
||||
```
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
`inquirer.prompt( questions, callback )`
|
||||
|
||||
Launch the prompt interface (inquiry session)
|
||||
|
||||
- **questions** (Array) containing [Question Object](#question) (using the [reactive interface](#reactive-interface), you can also pass a `Rx.Observable` instance)
|
||||
- **callback** (Function) first parameter is the [Answers Object](#answers)
|
||||
|
||||
|
||||
### Objects
|
||||
|
||||
#### Question
|
||||
A question object is a `hash` containing question related values:
|
||||
|
||||
- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `confirm`,
|
||||
`list`, `rawlist`, `password`
|
||||
- **name**: (String) The name to use when storing the answer in the answers hash.
|
||||
- **message**: (String|Function) The question to print. If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
- **default**: (String|Number|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
Array values can be simple `strings`, or `objects` containing a `name` (to display) and a `value` properties (to save in the answers hash). Values can also be [a `Separator`](#separator).
|
||||
- **validate**: (Function) Receive the user input and should return `true` if the value is valid, and an error message (`String`) otherwise. If `false` is returned, a default error message is provided.
|
||||
- **filter**: (Function) Receive the user input and return the filtered value to be used inside the program. The value returned will be added to the _Answers_ hash.
|
||||
- **when**: (Function, Boolean) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked. The value can also be a simple boolean.
|
||||
|
||||
`default`, `choices`(if defined as functions), `validate`, `filter` and `when` functions can be called asynchronously using `this.async()`. You just have to pass the value you'd normally return to the callback option.
|
||||
|
||||
``` javascript
|
||||
{
|
||||
validate: function(input) {
|
||||
|
||||
// Declare function as asynchronous, and save the done callback
|
||||
var done = this.async();
|
||||
|
||||
// Do async stuff
|
||||
setTimeout(function() {
|
||||
if (typeof input !== "number") {
|
||||
// Pass the return value in the done callback
|
||||
done("You need to provide a number");
|
||||
return;
|
||||
}
|
||||
// Pass the return value in the done callback
|
||||
done(true);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Answers
|
||||
A key/value hash containing the client answers in each prompt.
|
||||
|
||||
- **Key** The `name` property of the _question_ object
|
||||
- **Value** (Depends on the prompt)
|
||||
- `confirm`: (Boolean)
|
||||
- `input` : User input (filtered if `filter` is defined) (String)
|
||||
- `rawlist`, `list` : Selected choice value (or name if no value specified) (String)
|
||||
|
||||
### Separator
|
||||
A separator can be added to any `choices` array:
|
||||
|
||||
```
|
||||
// In the question object
|
||||
choices: [ "Choice A", new inquirer.Separator(), "choice B" ]
|
||||
|
||||
// Which'll be displayed this way
|
||||
[?] What do you want to do?
|
||||
> Order a pizza
|
||||
Make a reservation
|
||||
--------
|
||||
Ask opening hours
|
||||
Talk to the receptionist
|
||||
```
|
||||
|
||||
The constructor takes a facultative `String` value that'll be use as the separator. If omitted, the separator will be `--------`.
|
||||
|
||||
Separator instances have a property `type` equal to `separator`. This should allow tools façading Inquirer interface from detecting separator types in lists.
|
||||
|
||||
Prompts type
|
||||
---------------------
|
||||
|
||||
> **Note:**: _allowed options written inside square brackets (`[]`) are optional. Others are required._
|
||||
|
||||
#### List - `{ type: "list" }`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that
|
||||
default must be the choice `index` in the array or a choice `value`)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Raw List - `{ type: "rawlist" }`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that
|
||||
default must the choice `index` in the array)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Expand - `{ type: "expand" }`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`, `filter`] properties. (Note that
|
||||
default must be the choice `index` in the array)
|
||||
|
||||
Note that the `choices` object will take an extra parameter called `key` for the `expand` prompt. This parameter must be a single (lowercased) character. The `h` option is added by the prompt and shouldn't be defined by the user.
|
||||
|
||||
See `examples/expand.js` for a running example.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Checkbox - `{ type: "checkbox" }`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `filter`, `validate`, `default`] properties. `default` is expected to be an Array of the checked choices value.
|
||||
|
||||
Choices marked as `{ checked: true }` will be checked by default.
|
||||
|
||||
Choices whose property `disabled` is truthy will be unselectable. If `disabled` is a string, then the string will be outputted next to the disabled choice, otherwise it'll default to `"Disabled"`. The `disabled` property can also be a synchronous function receiving the current answers as argument and returning a boolean or a string.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Confirm - `{ type: "confirm" }`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`] properties. `default` is expected to be a boolean if used.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Input - `{ type: "input" }`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`, `filter`, `validate`] properties.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Password - `{ type: "password" }`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`, `filter`, `validate`] properties.
|
||||
|
||||

|
||||
|
||||
## User Interfaces and layouts
|
||||
|
||||
Along with the prompts, Inquirer offers some basic text UI.
|
||||
|
||||
#### Bottom Bar - `inquirer.ui.BottomBar`
|
||||
|
||||
This UI present a fixed text at the bottom of a free text zone. This is useful to keep a message to the bottom of the screen while outputting command outputs on the higher section.
|
||||
|
||||
```javascript
|
||||
var ui = new inquirer.ui.BottomBar();
|
||||
|
||||
// pipe a Stream to the log zone
|
||||
outputStream.pipe( ui.log );
|
||||
|
||||
// Or simply write output
|
||||
ui.log.write("something just happened.");
|
||||
ui.log.write("Almost over, standby!");
|
||||
|
||||
// During processing, update the bottom bar content to display a loader
|
||||
// or output a progress bar, etc
|
||||
ui.updateBottomBar("new bottom bar content");
|
||||
```
|
||||
|
||||
#### Prompt - `inquirer.ui.Prompt`
|
||||
|
||||
This is UI layout used to run prompt. This layout is returned by `inquirer.prompt` and you should probably always use `inquirer.prompt` to interface with this UI.
|
||||
|
||||
|
||||
## Reactive interface
|
||||
|
||||
Internally, Inquirer uses the [JS reactive extension](https://github.com/Reactive-Extensions/RxJS) to handle events and async flows.
|
||||
|
||||
This mean you can take advantage of this feature to provide more advanced flows. For example, you can dynamically add questions to be asked:
|
||||
|
||||
```js
|
||||
var prompts = Rx.Observable.create(function( obs ) {
|
||||
obs.onNext({ /* question... */ });
|
||||
setTimeout(function () {
|
||||
obs.onNext({ /* question... */ });
|
||||
obs.onCompleted();
|
||||
});
|
||||
});
|
||||
|
||||
inquirer.prompt(prompts);
|
||||
```
|
||||
|
||||
And using the `process` property, you have access to more fine grained callbacks:
|
||||
|
||||
```js
|
||||
inquirer.prompt(prompts).process.subscribe(
|
||||
onEachAnswer,
|
||||
onError,
|
||||
onComplete
|
||||
);
|
||||
```
|
||||
|
||||
## Support (OS Terminals)
|
||||
|
||||
You should expect mostly good support for the CLI below. This does not mean we won't
|
||||
look at issues found on other command line - feel free to report any!
|
||||
|
||||
- **Mac OS**:
|
||||
- Terminal.app
|
||||
- iTerm
|
||||
- **Windows**:
|
||||
- cmd.exe
|
||||
- Powershell
|
||||
- Cygwin
|
||||
- **Ubuntu**:
|
||||
- Terminal
|
||||
|
||||
|
||||
## News on the march (Release notes)
|
||||
|
||||
Please refer to the [Github releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases)
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
**Style Guide**
|
||||
Please brief yourself on [Idiomatic.js](https://github.com/rwldrn/idiomatic.js) style guide with two space indent
|
||||
|
||||
**Unit test**
|
||||
Unit test are written in [Mocha](http://visionmedia.github.io/mocha/). Please add a unit test for every new feature or bug fix. `npm test` to run the test suite.
|
||||
|
||||
**Documentation**
|
||||
Add documentation for every API change. Feel free to send corrections
|
||||
or better docs!
|
||||
|
||||
**Pull Requests**
|
||||
Send _fixes_ PR on the `master` branch. Any new features should be send on the `wip`branch.
|
||||
|
||||
We're looking to offer good support for multiple prompts and environments. If you want to
|
||||
help, we'd like to keep a list of testers for each terminal/OS so we can contact you and
|
||||
get feedback before release. Let us know if you want to be added to the list (just tweet
|
||||
to @vaxilart) or just add your name to [the wiki](https://github.com/SBoudrias/Inquirer.js/wiki/Testers)
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2012 Simon Boudrias (twitter: @vaxilart)
|
||||
Licensed under the MIT license.
|
||||
79
node_modules/inquirer/lib/inquirer.js
generated
vendored
Normal file
79
node_modules/inquirer/lib/inquirer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* Inquirer.js
|
||||
* A collection of common interactive command line user interfaces.
|
||||
*/
|
||||
|
||||
var inquirer = module.exports;
|
||||
|
||||
|
||||
/**
|
||||
* Client interfaces
|
||||
*/
|
||||
|
||||
inquirer.prompts = {};
|
||||
|
||||
inquirer.Separator = require('./objects/separator');
|
||||
|
||||
inquirer.ui = {
|
||||
BottomBar: require('./ui/bottom-bar'),
|
||||
Prompt: require('./ui/prompt')
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new self-contained prompt module.
|
||||
*/
|
||||
inquirer.createPromptModule = function (opt) {
|
||||
var promptModule = function (questions, allDone) {
|
||||
var ui = new inquirer.ui.Prompt(promptModule.prompts, opt);
|
||||
ui.run(questions, allDone);
|
||||
return ui;
|
||||
};
|
||||
promptModule.prompts = {};
|
||||
|
||||
/**
|
||||
* Register a prompt type
|
||||
* @param {String} name Prompt type name
|
||||
* @param {Function} prompt Prompt constructor
|
||||
* @return {inquirer}
|
||||
*/
|
||||
|
||||
promptModule.registerPrompt = function (name, prompt) {
|
||||
promptModule.prompts[name] = prompt;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register the defaults provider prompts
|
||||
*/
|
||||
|
||||
promptModule.restoreDefaultPrompts = function () {
|
||||
this.registerPrompt('list', require('./prompts/list'));
|
||||
this.registerPrompt('input', require('./prompts/input'));
|
||||
this.registerPrompt('confirm', require('./prompts/confirm'));
|
||||
this.registerPrompt('rawlist', require('./prompts/rawlist'));
|
||||
this.registerPrompt('expand', require('./prompts/expand'));
|
||||
this.registerPrompt('checkbox', require('./prompts/checkbox'));
|
||||
this.registerPrompt('password', require('./prompts/password'));
|
||||
};
|
||||
|
||||
promptModule.restoreDefaultPrompts();
|
||||
|
||||
return promptModule;
|
||||
};
|
||||
|
||||
/**
|
||||
* Public CLI helper interface
|
||||
* @param {Array|Object|rx.Observable} questions - Questions settings array
|
||||
* @param {Function} cb - Callback being passed the user answers
|
||||
* @return {inquirer.ui.Prompt}
|
||||
*/
|
||||
|
||||
inquirer.prompt = inquirer.createPromptModule();
|
||||
|
||||
// Expose helper functions on the top level for easiest usage by common users
|
||||
inquirer.registerPrompt = function (name, prompt) {
|
||||
inquirer.prompt.registerPrompt(name, prompt);
|
||||
};
|
||||
inquirer.restoreDefaultPrompts = function () {
|
||||
inquirer.prompt.restoreDefaultPrompts();
|
||||
};
|
||||
34
node_modules/inquirer/lib/objects/choice.js
generated
vendored
Normal file
34
node_modules/inquirer/lib/objects/choice.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
|
||||
|
||||
/**
|
||||
* Choice object
|
||||
* Normalize input as choice object
|
||||
* @constructor
|
||||
* @param {String|Object} val Choice value. If an object is passed, it should contains
|
||||
* at least one of `value` or `name` property
|
||||
*/
|
||||
|
||||
var Choice = module.exports = function (val, answers) {
|
||||
// Don't process Choice and Separator object
|
||||
if (val instanceof Choice || val.type === 'separator') {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (_.isString(val)) {
|
||||
this.name = val;
|
||||
this.value = val;
|
||||
} else {
|
||||
_.extend(this, val, {
|
||||
name: val.name || val.value,
|
||||
value: val.hasOwnProperty('value') ? val.value : val.name
|
||||
});
|
||||
}
|
||||
|
||||
if (_.isFunction(val.disabled)) {
|
||||
this.disabled = val.disabled(answers);
|
||||
} else {
|
||||
this.disabled = val.disabled;
|
||||
}
|
||||
};
|
||||
111
node_modules/inquirer/lib/objects/choices.js
generated
vendored
Normal file
111
node_modules/inquirer/lib/objects/choices.js
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
'use strict';
|
||||
var assert = require('assert');
|
||||
var _ = require('lodash');
|
||||
var chalk = require('chalk');
|
||||
var Separator = require('./separator');
|
||||
var Choice = require('./choice');
|
||||
|
||||
|
||||
/**
|
||||
* Choices collection
|
||||
* Collection of multiple `choice` object
|
||||
* @constructor
|
||||
* @param {Array} choices All `choice` to keep in the collection
|
||||
*/
|
||||
|
||||
var Choices = module.exports = function (choices, answers) {
|
||||
this.choices = choices.map(function (val) {
|
||||
if (val.type === 'separator') {
|
||||
if (!(val instanceof Separator)) {
|
||||
val = new Separator(val.line);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
return new Choice(val, answers);
|
||||
});
|
||||
|
||||
this.realChoices = this.choices
|
||||
.filter(Separator.exclude)
|
||||
.filter(function (item) {
|
||||
return !item.disabled;
|
||||
});
|
||||
|
||||
Object.defineProperty(this, 'length', {
|
||||
get: function () {
|
||||
return this.choices.length;
|
||||
},
|
||||
set: function (val) {
|
||||
this.choices.length = val;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(this, 'realLength', {
|
||||
get: function () {
|
||||
return this.realChoices.length;
|
||||
},
|
||||
set: function () {
|
||||
throw new Error('Cannot set `realLength` of a Choices collection');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get a valid choice from the collection
|
||||
* @param {Number} selector The selected choice index
|
||||
* @return {Choice|Undefined} Return the matched choice or undefined
|
||||
*/
|
||||
|
||||
Choices.prototype.getChoice = function (selector) {
|
||||
assert(_.isNumber(selector));
|
||||
return this.realChoices[selector];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get a raw element from the collection
|
||||
* @param {Number} selector The selected index value
|
||||
* @return {Choice|Undefined} Return the matched choice or undefined
|
||||
*/
|
||||
|
||||
Choices.prototype.get = function (selector) {
|
||||
assert(_.isNumber(selector));
|
||||
return this.choices[selector];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Match the valid choices against a where clause
|
||||
* @param {Object} whereClause Lodash `where` clause
|
||||
* @return {Array} Matching choices or empty array
|
||||
*/
|
||||
|
||||
Choices.prototype.where = function (whereClause) {
|
||||
return _.where(this.realChoices, whereClause);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Pluck a particular key from the choices
|
||||
* @param {String} propertyName Property name to select
|
||||
* @return {Array} Selected properties
|
||||
*/
|
||||
|
||||
Choices.prototype.pluck = function (propertyName) {
|
||||
return _.pluck(this.realChoices, propertyName);
|
||||
};
|
||||
|
||||
|
||||
// Expose usual Array methods
|
||||
Choices.prototype.forEach = function () {
|
||||
return this.choices.forEach.apply(this.choices, arguments);
|
||||
};
|
||||
Choices.prototype.filter = function () {
|
||||
return this.choices.filter.apply(this.choices, arguments);
|
||||
};
|
||||
Choices.prototype.push = function () {
|
||||
var objs = _.map(arguments, function (val) { return new Choice(val); });
|
||||
this.choices.push.apply(this.choices, objs);
|
||||
this.realChoices = this.choices.filter(Separator.exclude);
|
||||
return this.choices;
|
||||
};
|
||||
35
node_modules/inquirer/lib/objects/separator.js
generated
vendored
Normal file
35
node_modules/inquirer/lib/objects/separator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
var chalk = require('chalk');
|
||||
var figures = require('figures');
|
||||
|
||||
|
||||
/**
|
||||
* Separator object
|
||||
* Used to space/separate choices group
|
||||
* @constructor
|
||||
* @param {String} line Separation line content (facultative)
|
||||
*/
|
||||
|
||||
var Separator = module.exports = function (line) {
|
||||
this.type = 'separator';
|
||||
this.line = chalk.dim(line || new Array(15).join(figures.line));
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function returning false if object is a separator
|
||||
* @param {Object} obj object to test against
|
||||
* @return {Boolean} `false` if object is a separator
|
||||
*/
|
||||
|
||||
Separator.exclude = function (obj) {
|
||||
return obj.type !== 'separator';
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringify separator
|
||||
* @return {String} the separator display string
|
||||
*/
|
||||
|
||||
Separator.prototype.toString = function () {
|
||||
return this.line;
|
||||
};
|
||||
177
node_modules/inquirer/lib/prompts/base.js
generated
vendored
Normal file
177
node_modules/inquirer/lib/prompts/base.js
generated
vendored
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/**
|
||||
* Base prompt implementation
|
||||
* Should be extended by prompt types.
|
||||
*/
|
||||
|
||||
var rx = require('rx-lite');
|
||||
var _ = require('lodash');
|
||||
var chalk = require('chalk');
|
||||
var ansiRegex = require('ansi-regex');
|
||||
var readline = require('readline');
|
||||
var cliWidth = require('cli-width');
|
||||
var runAsync = require('run-async');
|
||||
var Choices = require('../objects/choices');
|
||||
var ScreenManager = require('../utils/screen-manager');
|
||||
|
||||
|
||||
var Prompt = module.exports = function (question, rl, answers) {
|
||||
|
||||
// Setup instance defaults property
|
||||
_.assign(this, {
|
||||
answers: answers,
|
||||
status : 'pending'
|
||||
});
|
||||
|
||||
// Set defaults prompt options
|
||||
this.opt = _.defaults(_.clone(question), {
|
||||
validate: function () { return true; },
|
||||
filter: function (val) { return val; },
|
||||
when: function () { return true; }
|
||||
});
|
||||
|
||||
// Check to make sure prompt requirements are there
|
||||
if (!this.opt.message) {
|
||||
this.throwParamError('message');
|
||||
}
|
||||
if (!this.opt.name) {
|
||||
this.throwParamError('name');
|
||||
}
|
||||
|
||||
// Normalize choices
|
||||
if (Array.isArray(this.opt.choices)) {
|
||||
this.opt.choices = new Choices(this.opt.choices, answers);
|
||||
}
|
||||
|
||||
this.rl = rl;
|
||||
this.screen = new ScreenManager(this.rl);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session and manage output value filtering
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype.run = function( cb ) {
|
||||
this._run(function (value) {
|
||||
this.filter(value, cb);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
// default noop (this one should be overwritten in prompts)
|
||||
Prompt.prototype._run = function (cb) { cb(); };
|
||||
|
||||
|
||||
/**
|
||||
* Throw an error telling a required parameter is missing
|
||||
* @param {String} name Name of the missing param
|
||||
* @return {Throw Error}
|
||||
*/
|
||||
|
||||
Prompt.prototype.throwParamError = function (name) {
|
||||
throw new Error('You must provide a `' + name + '` parameter');
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate a given input
|
||||
* @param {String} value Input string
|
||||
* @param {Function} callback Pass `true` (if input is valid) or an error message as
|
||||
* parameter.
|
||||
* @return {null}
|
||||
*/
|
||||
|
||||
Prompt.prototype.validate = function (input, cb) {
|
||||
runAsync(this.opt.validate, cb, input);
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the provided validation method each time a submit event occur.
|
||||
* @param {Rx.Observable} submit - submit event flow
|
||||
* @return {Object} Object containing two observables: `success` and `error`
|
||||
*/
|
||||
Prompt.prototype.handleSubmitEvents = function (submit) {
|
||||
var self = this;
|
||||
var validation = submit.flatMap(function (value) {
|
||||
return rx.Observable.create(function (observer) {
|
||||
runAsync(self.opt.validate, function (isValid) {
|
||||
observer.onNext({ isValid: isValid, value: self.getCurrentValue(value) });
|
||||
observer.onCompleted();
|
||||
}, self.getCurrentValue(value), self.answers);
|
||||
});
|
||||
}).share();
|
||||
|
||||
var success = validation
|
||||
.filter(function (state) { return state.isValid === true; })
|
||||
.take(1);
|
||||
|
||||
var error = validation
|
||||
.filter(function (state) { return state.isValid !== true; })
|
||||
.takeUntil(success);
|
||||
|
||||
return {
|
||||
success: success,
|
||||
error: error
|
||||
};
|
||||
};
|
||||
|
||||
Prompt.prototype.getCurrentValue = function (value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter a given input before sending back
|
||||
* @param {String} value Input string
|
||||
* @param {Function} callback Pass the filtered input as parameter.
|
||||
* @return {null}
|
||||
*/
|
||||
|
||||
Prompt.prototype.filter = function (input, cb) {
|
||||
runAsync(this.opt.filter, cb, input);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the prompt line prefix
|
||||
* @param {String} [optionnal] String to concatenate to the prefix
|
||||
* @return {String} prompt prefix
|
||||
*/
|
||||
|
||||
Prompt.prototype.prefix = function (str) {
|
||||
str || (str = '');
|
||||
return chalk.green('?') + ' ' + str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the prompt line suffix
|
||||
* @param {String} [optionnal] String to concatenate to the suffix
|
||||
* @return {String} prompt suffix
|
||||
*/
|
||||
|
||||
var reStrEnd = new RegExp('(?:' + ansiRegex().source + ')$|$');
|
||||
|
||||
Prompt.prototype.suffix = function (str) {
|
||||
str || (str = '');
|
||||
|
||||
// make sure we get the `:` inside the styles
|
||||
if (str.length < 1 || /[a-z1-9]$/i.test(chalk.stripColor(str))) {
|
||||
str = str.replace(reStrEnd, ':$&');
|
||||
}
|
||||
|
||||
return str.trim() + ' ';
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate the prompt question string
|
||||
* @return {String} prompt question string
|
||||
*/
|
||||
|
||||
Prompt.prototype.getQuestion = function () {
|
||||
var message = chalk.green('?') + ' ' + chalk.bold(this.opt.message) + ' ';
|
||||
|
||||
// Append the default if available, and if question isn't answered
|
||||
if ( this.opt.default != null && this.status !== 'answered' ) {
|
||||
message += chalk.dim('('+ this.opt.default + ') ');
|
||||
}
|
||||
|
||||
return message;
|
||||
};
|
||||
215
node_modules/inquirer/lib/prompts/checkbox.js
generated
vendored
Normal file
215
node_modules/inquirer/lib/prompts/checkbox.js
generated
vendored
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/**
|
||||
* `list` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var cliCursor = require("cli-cursor");
|
||||
var figures = require("figures");
|
||||
var Base = require("./base");
|
||||
var observe = require("../utils/events");
|
||||
var utils = require("../utils/readline");
|
||||
var Paginator = require("../utils/paginator");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
Base.apply( this, arguments );
|
||||
|
||||
if (!this.opt.choices) {
|
||||
this.throwParamError("choices");
|
||||
}
|
||||
|
||||
if ( _.isArray(this.opt.default) ) {
|
||||
this.opt.choices.forEach(function( choice ) {
|
||||
if ( this.opt.default.indexOf(choice.value) >= 0 ) {
|
||||
choice.checked = true;
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
this.firstRender = true;
|
||||
this.pointer = 0;
|
||||
|
||||
// Make sure no default is set (so it won't be printed)
|
||||
this.opt.default = null;
|
||||
|
||||
this.paginator = new Paginator();
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
var events = observe(this.rl);
|
||||
|
||||
var validation = this.handleSubmitEvents( events.line );
|
||||
validation.success.forEach( this.onEnd.bind(this) );
|
||||
validation.error.forEach( this.onError.bind(this) );
|
||||
|
||||
events.normalizedUpKey.takeUntil( validation.success ).forEach( this.onUpKey.bind(this) );
|
||||
events.normalizedDownKey.takeUntil( validation.success ).forEach( this.onDownKey.bind(this) );
|
||||
events.numberKey.takeUntil( validation.success ).forEach( this.onNumberKey.bind(this) );
|
||||
events.spaceKey.takeUntil( validation.success ).forEach( this.onSpaceKey.bind(this) );
|
||||
|
||||
// Init the prompt
|
||||
cliCursor.hide();
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (error) {
|
||||
// Render question
|
||||
var cursor = 0;
|
||||
var message = this.getQuestion();
|
||||
|
||||
if ( this.firstRender ) {
|
||||
message += "(Press <space> to select)";
|
||||
}
|
||||
|
||||
// Render choices or answer depending on the state
|
||||
if ( this.status === "answered" ) {
|
||||
message += chalk.cyan( this.selection.join(", ") );
|
||||
} else {
|
||||
var choicesStr = renderChoices(this.opt.choices, this.pointer);
|
||||
message += "\n" + this.paginator.paginate(choicesStr, this.pointer);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
message += '\n' + chalk.red('>> ') + error;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
this.firstRender = false;
|
||||
|
||||
this.screen.render(message, { cursor: cursor });
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onEnd = function( state ) {
|
||||
|
||||
this.status = "answered";
|
||||
|
||||
// Rerender prompt (and clean subline error)
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
cliCursor.show();
|
||||
this.done( state.value );
|
||||
};
|
||||
|
||||
Prompt.prototype.onError = function ( state ) {
|
||||
this.render(state.isValid);
|
||||
};
|
||||
|
||||
Prompt.prototype.getCurrentValue = function () {
|
||||
var choices = this.opt.choices.filter(function( choice ) {
|
||||
return !!choice.checked && !choice.disabled;
|
||||
});
|
||||
|
||||
this.selection = _.pluck(choices, "name");
|
||||
return _.pluck(choices, "value");
|
||||
};
|
||||
|
||||
Prompt.prototype.onUpKey = function() {
|
||||
var len = this.opt.choices.realLength;
|
||||
this.pointer = (this.pointer > 0) ? this.pointer - 1 : len - 1;
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.onDownKey = function() {
|
||||
var len = this.opt.choices.realLength;
|
||||
this.pointer = (this.pointer < len - 1) ? this.pointer + 1 : 0;
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.onNumberKey = function( input ) {
|
||||
if ( input <= this.opt.choices.realLength ) {
|
||||
this.pointer = input - 1;
|
||||
this.toggleChoice( this.pointer );
|
||||
}
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.onSpaceKey = function( input ) {
|
||||
this.toggleChoice(this.pointer);
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.toggleChoice = function( index ) {
|
||||
var checked = this.opt.choices.getChoice(index).checked;
|
||||
this.opt.choices.getChoice(index).checked = !checked;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function for rendering checkbox choices
|
||||
* @param {Number} pointer Position of the pointer
|
||||
* @return {String} Rendered content
|
||||
*/
|
||||
|
||||
function renderChoices(choices, pointer) {
|
||||
var output = '';
|
||||
var separatorOffset = 0;
|
||||
|
||||
choices.forEach(function (choice, i) {
|
||||
if (choice.type === 'separator') {
|
||||
separatorOffset++;
|
||||
output += ' ' + choice + '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
if (choice.disabled) {
|
||||
separatorOffset++;
|
||||
output += ' - ' + choice.name;
|
||||
output += ' (' + (_.isString(choice.disabled) ? choice.disabled : 'Disabled') + ')';
|
||||
} else {
|
||||
var isSelected = (i - separatorOffset === pointer);
|
||||
output += isSelected ? chalk.cyan(figures.pointer) : ' ';
|
||||
output += getCheckbox(choice.checked) + ' ' + choice.name;
|
||||
}
|
||||
|
||||
output += '\n';
|
||||
});
|
||||
|
||||
return output.replace(/\n$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checkbox
|
||||
* @param {Boolean} checked - add a X or not to the checkbox
|
||||
* @return {String} Composited checkbox string
|
||||
*/
|
||||
|
||||
function getCheckbox(checked) {
|
||||
return checked ? chalk.green(figures.radioOn) : figures.radioOff;
|
||||
}
|
||||
110
node_modules/inquirer/lib/prompts/confirm.js
generated
vendored
Normal file
110
node_modules/inquirer/lib/prompts/confirm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* `confirm` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var Base = require("./base");
|
||||
var observe = require("../utils/events");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
Base.apply( this, arguments );
|
||||
|
||||
var rawDefault = true;
|
||||
|
||||
_.extend( this.opt, {
|
||||
filter: function( input ) {
|
||||
var value = rawDefault;
|
||||
if ( input != null && input !== "" ) {
|
||||
value = /^y(es)?/i.test(input);
|
||||
}
|
||||
return value;
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
if ( _.isBoolean(this.opt.default) ) {
|
||||
rawDefault = this.opt.default;
|
||||
}
|
||||
|
||||
this.opt.default = rawDefault ? "Y/n" : "y/N";
|
||||
|
||||
return this;
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
// Once user confirm (enter key)
|
||||
var events = observe(this.rl);
|
||||
events.keypress.takeUntil( events.line ).forEach( this.onKeypress.bind(this) );
|
||||
|
||||
events.line.take(1).forEach( this.onEnd.bind(this) );
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (answer) {
|
||||
var message = this.getQuestion();
|
||||
|
||||
if (typeof answer === "boolean") {
|
||||
message += chalk.cyan(answer ? "Yes" : "No");
|
||||
} else {
|
||||
message += this.rl.line;
|
||||
}
|
||||
|
||||
this.screen.render(message);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onEnd = function( input ) {
|
||||
this.status = "answered";
|
||||
|
||||
var output = this.opt.filter( input );
|
||||
this.render( output );
|
||||
|
||||
this.screen.done();
|
||||
this.done( input ); // send "input" because the master class will refilter
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onKeypress = function() {
|
||||
this.render();
|
||||
};
|
||||
257
node_modules/inquirer/lib/prompts/expand.js
generated
vendored
Normal file
257
node_modules/inquirer/lib/prompts/expand.js
generated
vendored
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
/**
|
||||
* `rawlist` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var Base = require("./base");
|
||||
var Separator = require("../objects/separator");
|
||||
var observe = require("../utils/events");
|
||||
var Paginator = require("../utils/paginator");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
Base.apply( this, arguments );
|
||||
|
||||
if ( !this.opt.choices ) {
|
||||
this.throwParamError("choices");
|
||||
}
|
||||
|
||||
this.validateChoices( this.opt.choices );
|
||||
|
||||
// Add the default `help` (/expand) option
|
||||
this.opt.choices.push({
|
||||
key : "h",
|
||||
name : "Help, list all options",
|
||||
value : "help"
|
||||
});
|
||||
|
||||
// Setup the default string (capitalize the default key)
|
||||
this.opt.default = this.generateChoicesString( this.opt.choices, this.opt.default );
|
||||
|
||||
this.paginator = new Paginator();
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
// Save user answer and update prompt to show selected option.
|
||||
var events = observe(this.rl);
|
||||
this.lineObs = events.line.forEach( this.onSubmit.bind(this) );
|
||||
this.keypressObs = events.keypress.forEach( this.onKeypress.bind(this) );
|
||||
|
||||
// Init the prompt
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (error, hint) {
|
||||
var cursor = 0;
|
||||
var message = this.getQuestion();
|
||||
|
||||
if ( this.status === "answered" ) {
|
||||
message += chalk.cyan( this.selected.name );
|
||||
} else if ( this.status === "expanded" ) {
|
||||
var choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
||||
message += this.paginator.paginate(choicesStr, this.selectedKey);
|
||||
message += "\n Answer: ";
|
||||
}
|
||||
|
||||
message += this.rl.line;
|
||||
|
||||
if (error) {
|
||||
message += '\n' + chalk.red('>> ') + error;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
if (hint) {
|
||||
message += '\n' + chalk.cyan('>> ') + hint;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
this.screen.render(message, { cursor: cursor });
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate the prompt choices string
|
||||
* @return {String} Choices string
|
||||
*/
|
||||
|
||||
Prompt.prototype.getChoices = function() {
|
||||
var output = "";
|
||||
|
||||
this.opt.choices.forEach(function( choice, i ) {
|
||||
output += "\n ";
|
||||
|
||||
if ( choice.type === "separator" ) {
|
||||
output += " " + choice;
|
||||
return;
|
||||
}
|
||||
|
||||
var choiceStr = choice.key + ") " + choice.name;
|
||||
if ( this.selectedKey === choice.key ) {
|
||||
choiceStr = chalk.cyan( choiceStr );
|
||||
}
|
||||
output += choiceStr;
|
||||
}.bind(this));
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onSubmit = function( input ) {
|
||||
if ( input == null || input === "" ) {
|
||||
input = this.rawDefault;
|
||||
}
|
||||
|
||||
var selected = this.opt.choices.where({ key : input.toLowerCase() })[0];
|
||||
|
||||
if ( selected != null && selected.key === "h" ) {
|
||||
this.selectedKey = "";
|
||||
this.status = "expanded";
|
||||
this.render();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( selected != null ) {
|
||||
this.status = "answered";
|
||||
this.selected = selected;
|
||||
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
|
||||
this.lineObs.dispose();
|
||||
this.keypressObs.dispose();
|
||||
this.screen.done();
|
||||
this.done( this.selected.value );
|
||||
return;
|
||||
}
|
||||
|
||||
// Input is invalid
|
||||
this.render("Please enter a valid command");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onKeypress = function( s, key ) {
|
||||
this.selectedKey = this.rl.line.toLowerCase();
|
||||
var selected = this.opt.choices.where({ key : this.selectedKey })[0];
|
||||
if ( this.status === "expanded" ) {
|
||||
this.render();
|
||||
} else {
|
||||
this.render(null, selected ? selected.name : null);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Validate the choices
|
||||
* @param {Array} choices
|
||||
*/
|
||||
|
||||
Prompt.prototype.validateChoices = function( choices ) {
|
||||
var formatError;
|
||||
var errors = [];
|
||||
var keymap = {};
|
||||
choices.filter(Separator.exclude).map(function( choice ) {
|
||||
if ( !choice.key || choice.key.length !== 1 ) {
|
||||
formatError = true;
|
||||
}
|
||||
if ( keymap[choice.key] ) {
|
||||
errors.push(choice.key);
|
||||
}
|
||||
keymap[ choice.key ] = true;
|
||||
choice.key = String( choice.key ).toLowerCase();
|
||||
});
|
||||
|
||||
if ( formatError ) {
|
||||
throw new Error("Format error: `key` param must be a single letter and is required.");
|
||||
}
|
||||
if ( keymap.h ) {
|
||||
throw new Error("Reserved key error: `key` param cannot be `h` - this value is reserved.");
|
||||
}
|
||||
if ( errors.length ) {
|
||||
throw new Error( "Duplicate key error: `key` param must be unique. Duplicates: " +
|
||||
_.uniq(errors).join(", ") );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a string out of the choices keys
|
||||
* @param {Array} choices
|
||||
* @param {Number} defaultIndex - the choice index to capitalize
|
||||
* @return {String} The rendered choices key string
|
||||
*/
|
||||
Prompt.prototype.generateChoicesString = function( choices, defaultIndex ) {
|
||||
var defIndex = 0;
|
||||
if ( _.isNumber(defaultIndex) && this.opt.choices.getChoice(defaultIndex) ) {
|
||||
defIndex = defaultIndex;
|
||||
}
|
||||
var defStr = this.opt.choices.pluck("key");
|
||||
this.rawDefault = defStr[ defIndex ];
|
||||
defStr[ defIndex ] = String( defStr[defIndex] ).toUpperCase();
|
||||
return defStr.join("");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function for rendering checkbox choices
|
||||
* @param {String} pointer Selected key
|
||||
* @return {String} Rendered content
|
||||
*/
|
||||
|
||||
function renderChoices (choices, pointer) {
|
||||
var output = '';
|
||||
|
||||
choices.forEach(function (choice, i) {
|
||||
output += '\n ';
|
||||
|
||||
if (choice.type === 'separator') {
|
||||
output += ' ' + choice;
|
||||
return;
|
||||
}
|
||||
|
||||
var choiceStr = choice.key + ') ' + choice.name;
|
||||
if (pointer === choice.key) {
|
||||
choiceStr = chalk.cyan(choiceStr);
|
||||
}
|
||||
output += choiceStr;
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
113
node_modules/inquirer/lib/prompts/input.js
generated
vendored
Normal file
113
node_modules/inquirer/lib/prompts/input.js
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
* `input` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var Base = require("./base");
|
||||
var observe = require("../utils/events");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
return Base.apply( this, arguments );
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
// Once user confirm (enter key)
|
||||
var events = observe(this.rl);
|
||||
var submit = events.line.map( this.filterInput.bind(this) );
|
||||
|
||||
var validation = this.handleSubmitEvents( submit );
|
||||
validation.success.forEach( this.onEnd.bind(this) );
|
||||
validation.error.forEach( this.onError.bind(this) );
|
||||
|
||||
events.keypress.takeUntil( validation.success ).forEach( this.onKeypress.bind(this) );
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (error) {
|
||||
var cursor = 0;
|
||||
var message = this.getQuestion();
|
||||
|
||||
if (this.status === 'answered') {
|
||||
message += chalk.cyan(this.answer);
|
||||
} else {
|
||||
message += this.rl.line;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
message += '\n' + chalk.red('>> ') + error;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
this.screen.render(message, { cursor: cursor });
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.filterInput = function( input ) {
|
||||
if ( !input ) {
|
||||
return this.opt.default != null ? this.opt.default : "";
|
||||
}
|
||||
return input;
|
||||
};
|
||||
|
||||
Prompt.prototype.onEnd = function( state ) {
|
||||
this.filter( state.value, function( filteredValue ) {
|
||||
this.answer = filteredValue;
|
||||
this.status = "answered";
|
||||
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
this.done( state.value );
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
Prompt.prototype.onError = function( state ) {
|
||||
this.render(state.isValid);
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onKeypress = function() {
|
||||
this.render();
|
||||
};
|
||||
172
node_modules/inquirer/lib/prompts/list.js
generated
vendored
Normal file
172
node_modules/inquirer/lib/prompts/list.js
generated
vendored
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
* `list` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var figures = require("figures");
|
||||
var cliCursor = require("cli-cursor");
|
||||
var Base = require("./base");
|
||||
var observe = require("../utils/events");
|
||||
var utils = require("../utils/readline");
|
||||
var Paginator = require("../utils/paginator");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
Base.apply( this, arguments );
|
||||
|
||||
if (!this.opt.choices) {
|
||||
this.throwParamError("choices");
|
||||
}
|
||||
|
||||
this.firstRender = true;
|
||||
this.selected = 0;
|
||||
|
||||
var def = this.opt.default;
|
||||
|
||||
// Default being a Number
|
||||
if ( _.isNumber(def) && def >= 0 && def < this.opt.choices.realLength ) {
|
||||
this.selected = def;
|
||||
}
|
||||
|
||||
// Default being a String
|
||||
if ( _.isString(def) ) {
|
||||
this.selected = this.opt.choices.pluck("value").indexOf( def );
|
||||
}
|
||||
|
||||
// Make sure no default is set (so it won't be printed)
|
||||
this.opt.default = null;
|
||||
|
||||
this.paginator = new Paginator();
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
var events = observe(this.rl);
|
||||
events.normalizedUpKey.takeUntil( events.line ).forEach( this.onUpKey.bind(this) );
|
||||
events.normalizedDownKey.takeUntil( events.line ).forEach( this.onDownKey.bind(this) );
|
||||
events.numberKey.takeUntil( events.line ).forEach( this.onNumberKey.bind(this) );
|
||||
events.line.take(1).forEach( this.onSubmit.bind(this) );
|
||||
|
||||
// Init the prompt
|
||||
cliCursor.hide();
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function() {
|
||||
// Render question
|
||||
var message = this.getQuestion();
|
||||
|
||||
if ( this.firstRender ) {
|
||||
message += chalk.dim( "(Use arrow keys)" );
|
||||
}
|
||||
|
||||
// Render choices or answer depending on the state
|
||||
if ( this.status === "answered" ) {
|
||||
message += chalk.cyan( this.opt.choices.getChoice(this.selected).name );
|
||||
} else {
|
||||
var choicesStr = listRender(this.opt.choices, this.selected );
|
||||
message += "\n" + this.paginator.paginate(choicesStr, this.selected);
|
||||
}
|
||||
|
||||
this.firstRender = false;
|
||||
|
||||
this.screen.render(message);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onSubmit = function() {
|
||||
var choice = this.opt.choices.getChoice( this.selected );
|
||||
this.status = "answered";
|
||||
|
||||
// Rerender prompt
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
cliCursor.show();
|
||||
this.done( choice.value );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
Prompt.prototype.onUpKey = function() {
|
||||
var len = this.opt.choices.realLength;
|
||||
this.selected = (this.selected > 0) ? this.selected - 1 : len - 1;
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.onDownKey = function() {
|
||||
var len = this.opt.choices.realLength;
|
||||
this.selected = (this.selected < len - 1) ? this.selected + 1 : 0;
|
||||
this.render();
|
||||
};
|
||||
|
||||
Prompt.prototype.onNumberKey = function( input ) {
|
||||
if ( input <= this.opt.choices.realLength ) {
|
||||
this.selected = input - 1;
|
||||
}
|
||||
this.render();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function for rendering list choices
|
||||
* @param {Number} pointer Position of the pointer
|
||||
* @return {String} Rendered content
|
||||
*/
|
||||
function listRender(choices, pointer) {
|
||||
var output = '';
|
||||
var separatorOffset = 0;
|
||||
|
||||
choices.forEach(function (choice, i) {
|
||||
if (choice.type === 'separator') {
|
||||
separatorOffset++;
|
||||
output += ' ' + choice + '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
var isSelected = (i - separatorOffset === pointer);
|
||||
var line = (isSelected ? figures.pointer + ' ' : ' ') + choice.name;
|
||||
if (isSelected) {
|
||||
line = chalk.cyan(line);
|
||||
}
|
||||
output += line + ' \n';
|
||||
});
|
||||
|
||||
return output.replace(/\n$/, '');
|
||||
}
|
||||
120
node_modules/inquirer/lib/prompts/password.js
generated
vendored
Normal file
120
node_modules/inquirer/lib/prompts/password.js
generated
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/**
|
||||
* `password` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var Base = require("./base");
|
||||
var observe = require("../utils/events");
|
||||
|
||||
function mask(input) {
|
||||
input = String(input);
|
||||
if (input.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return new Array(input.length + 1).join('*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
return Base.apply( this, arguments );
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
var events = observe(this.rl);
|
||||
|
||||
// Once user confirm (enter key)
|
||||
var submit = events.line.map( this.filterInput.bind(this) );
|
||||
|
||||
var validation = this.handleSubmitEvents( submit );
|
||||
validation.success.forEach( this.onEnd.bind(this) );
|
||||
validation.error.forEach( this.onError.bind(this) );
|
||||
|
||||
events.keypress.takeUntil( validation.success ).forEach( this.onKeypress.bind(this) );
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (error) {
|
||||
var cursor = 0;
|
||||
var message = this.getQuestion();
|
||||
|
||||
if (this.status === 'answered') {
|
||||
message += chalk.cyan(mask(this.answer));
|
||||
} else {
|
||||
message += mask(this.rl.line || '');
|
||||
}
|
||||
|
||||
if (error) {
|
||||
message += '\n' + chalk.red('>> ') + error;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
this.screen.render(message, { cursor: cursor });
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.filterInput = function( input ) {
|
||||
if ( !input ) {
|
||||
return this.opt.default != null ? this.opt.default : "";
|
||||
}
|
||||
return input;
|
||||
};
|
||||
|
||||
Prompt.prototype.onEnd = function( state ) {
|
||||
this.status = "answered";
|
||||
this.answer = state.value;
|
||||
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
this.done( state.value );
|
||||
};
|
||||
|
||||
Prompt.prototype.onError = function( state ) {
|
||||
this.render(state.isValid);
|
||||
this.rl.output.unmute();
|
||||
};
|
||||
|
||||
/**
|
||||
* When user type
|
||||
*/
|
||||
|
||||
Prompt.prototype.onKeypress = function() {
|
||||
this.render();
|
||||
};
|
||||
184
node_modules/inquirer/lib/prompts/rawlist.js
generated
vendored
Normal file
184
node_modules/inquirer/lib/prompts/rawlist.js
generated
vendored
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
/**
|
||||
* `rawlist` type prompt
|
||||
*/
|
||||
|
||||
var _ = require("lodash");
|
||||
var util = require("util");
|
||||
var chalk = require("chalk");
|
||||
var Base = require("./base");
|
||||
var Separator = require("../objects/separator");
|
||||
var observe = require("../utils/events");
|
||||
var Paginator = require("../utils/paginator");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt() {
|
||||
Base.apply( this, arguments );
|
||||
|
||||
if (!this.opt.choices) {
|
||||
this.throwParamError("choices");
|
||||
}
|
||||
|
||||
this.opt.validChoices = this.opt.choices.filter(Separator.exclude);
|
||||
|
||||
this.selected = 0;
|
||||
this.rawDefault = 0;
|
||||
|
||||
_.extend(this.opt, {
|
||||
validate: function( index ) {
|
||||
return this.opt.choices.getChoice( index ) != null;
|
||||
}.bind(this)
|
||||
});
|
||||
|
||||
var def = this.opt.default;
|
||||
if ( _.isNumber(def) && def >= 0 && def < this.opt.choices.realLength ) {
|
||||
this.selected = this.rawDefault = def;
|
||||
}
|
||||
|
||||
// Make sure no default is set (so it won't be printed)
|
||||
this.opt.default = null;
|
||||
|
||||
this.paginator = new Paginator();
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
Prompt.prototype._run = function( cb ) {
|
||||
this.done = cb;
|
||||
|
||||
// Once user confirm (enter key)
|
||||
var events = observe(this.rl);
|
||||
var submit = events.line.map( this.filterInput.bind(this) );
|
||||
|
||||
var validation = this.handleSubmitEvents( submit );
|
||||
validation.success.forEach( this.onEnd.bind(this) );
|
||||
validation.error.forEach( this.onError.bind(this) );
|
||||
|
||||
events.keypress.takeUntil( validation.success ).forEach( this.onKeypress.bind(this) );
|
||||
|
||||
// Init the prompt
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function (error) {
|
||||
// Render question
|
||||
var cursor = 0;
|
||||
var message = this.getQuestion();
|
||||
|
||||
if ( this.status === "answered" ) {
|
||||
message += chalk.cyan(this.opt.choices.getChoice(this.selected).name);
|
||||
} else {
|
||||
var choicesStr = renderChoices(this.opt.choices, this.selected);
|
||||
message += this.paginator.paginate(choicesStr, this.selected);
|
||||
message += "\n Answer: ";
|
||||
}
|
||||
|
||||
message += this.rl.line;
|
||||
|
||||
if (error) {
|
||||
message += '\n' + chalk.red('>> ') + error;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
this.screen.render(message, { cursor: cursor });
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
Prompt.prototype.filterInput = function( input ) {
|
||||
if ( input == null || input === "" ) {
|
||||
return this.rawDefault;
|
||||
} else {
|
||||
return input - 1;
|
||||
}
|
||||
};
|
||||
|
||||
Prompt.prototype.onEnd = function( state ) {
|
||||
this.status = "answered";
|
||||
this.selected = state.value;
|
||||
|
||||
var selectedChoice = this.opt.choices.getChoice( this.selected );
|
||||
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
this.done( selectedChoice.value );
|
||||
};
|
||||
|
||||
Prompt.prototype.onError = function() {
|
||||
this.render("Please enter a valid index");
|
||||
};
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
|
||||
Prompt.prototype.onKeypress = function() {
|
||||
var index = this.rl.line.length ? Number(this.rl.line) - 1 : 0;
|
||||
|
||||
if ( this.opt.choices.getChoice(index) ) {
|
||||
this.selected = index;
|
||||
} else {
|
||||
this.selected = undefined;
|
||||
}
|
||||
|
||||
this.render();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function for rendering list choices
|
||||
* @param {Number} pointer Position of the pointer
|
||||
* @return {String} Rendered content
|
||||
*/
|
||||
|
||||
function renderChoices(choices, pointer) {
|
||||
var output = '';
|
||||
var separatorOffset = 0;
|
||||
|
||||
choices.forEach(function (choice, i) {
|
||||
output += '\n ';
|
||||
|
||||
if (choice.type === 'separator') {
|
||||
separatorOffset++;
|
||||
output += ' ' + choice;
|
||||
return;
|
||||
}
|
||||
|
||||
var index = i - separatorOffset;
|
||||
var display = (index + 1) + ') ' + choice.name;
|
||||
if (index === pointer) {
|
||||
display = chalk.cyan( display );
|
||||
}
|
||||
output += display;
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
56
node_modules/inquirer/lib/ui/baseUI.js
generated
vendored
Normal file
56
node_modules/inquirer/lib/ui/baseUI.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
var readlineFacade = require('readline2');
|
||||
|
||||
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
|
||||
var UI = module.exports = function (opt) {
|
||||
// Instantiate the Readline interface
|
||||
// @Note: Don't reassign if already present (allow test to override the Stream)
|
||||
if (!this.rl) {
|
||||
this.rl = readlineFacade.createInterface(_.extend({
|
||||
terminal: true
|
||||
}, opt));
|
||||
}
|
||||
this.rl.resume();
|
||||
|
||||
this.onForceClose = this.onForceClose.bind(this);
|
||||
|
||||
// Make sure new prompt start on a newline when closing
|
||||
this.rl.on('SIGINT', this.onForceClose);
|
||||
process.on('exit', this.onForceClose);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle the ^C exit
|
||||
* @return {null}
|
||||
*/
|
||||
|
||||
UI.prototype.onForceClose = function () {
|
||||
this.close();
|
||||
console.log('\n'); // Line return
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Close the interface and cleanup listeners
|
||||
*/
|
||||
|
||||
UI.prototype.close = function () {
|
||||
// Remove events listeners
|
||||
this.rl.removeListener('SIGINT', this.onForceClose);
|
||||
process.removeListener('exit', this.onForceClose);
|
||||
|
||||
// Restore prompt functionnalities
|
||||
this.rl.output.unmute();
|
||||
|
||||
// Close the readline
|
||||
this.rl.output.end();
|
||||
this.rl.pause();
|
||||
this.rl.close();
|
||||
this.rl = null;
|
||||
};
|
||||
98
node_modules/inquirer/lib/ui/bottom-bar.js
generated
vendored
Normal file
98
node_modules/inquirer/lib/ui/bottom-bar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
* Sticky bottom bar user interface
|
||||
*/
|
||||
|
||||
var util = require("util");
|
||||
var through = require("through");
|
||||
var Base = require("./baseUI");
|
||||
var rlUtils = require("../utils/readline");
|
||||
var _ = require("lodash");
|
||||
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Prompt;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
function Prompt( opt ) {
|
||||
opt || (opt = {});
|
||||
|
||||
Base.apply( this, arguments );
|
||||
|
||||
this.log = through( this.writeLog.bind(this) );
|
||||
this.bottomBar = opt.bottomBar || "";
|
||||
this.render();
|
||||
}
|
||||
util.inherits( Prompt, Base );
|
||||
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.render = function() {
|
||||
this.write(this.bottomBar);
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Update the bottom bar content and rerender
|
||||
* @param {String} bottomBar Bottom bar content
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.updateBottomBar = function( bottomBar ) {
|
||||
this.bottomBar = bottomBar;
|
||||
rlUtils.clearLine(this.rl, 1);
|
||||
return this.render();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Rerender the prompt
|
||||
* @return {Prompt} self
|
||||
*/
|
||||
|
||||
Prompt.prototype.writeLog = function( data ) {
|
||||
rlUtils.clearLine(this.rl, 1);
|
||||
this.rl.output.write(this.enforceLF(data.toString()));
|
||||
return this.render();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Make sure line end on a line feed
|
||||
* @param {String} str Input string
|
||||
* @return {String} The input string with a final line feed
|
||||
*/
|
||||
|
||||
Prompt.prototype.enforceLF = function( str ) {
|
||||
return str.match(/[\r\n]$/) ? str : str + "\n";
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper for writing message in Prompt
|
||||
* @param {Prompt} prompt - The Prompt object that extends tty
|
||||
* @param {String} message - The message to be output
|
||||
*/
|
||||
Prompt.prototype.write = function (message) {
|
||||
var msgLines = message.split(/\n/);
|
||||
this.height = msgLines.length;
|
||||
|
||||
// Write message to screen and setPrompt to control backspace
|
||||
this.rl.setPrompt( _.last(msgLines) );
|
||||
|
||||
if ( this.rl.output.rows === 0 && this.rl.output.columns === 0 ) {
|
||||
/* When it's a tty through serial port there's no terminal info and the render will malfunction,
|
||||
so we need enforce the cursor to locate to the leftmost position for rendering. */
|
||||
rlUtils.left( this.rl, message.length + this.rl.line.length );
|
||||
}
|
||||
this.rl.output.write( message );
|
||||
};
|
||||
126
node_modules/inquirer/lib/ui/prompt.js
generated
vendored
Normal file
126
node_modules/inquirer/lib/ui/prompt.js
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
var rx = require('rx-lite');
|
||||
var util = require('util');
|
||||
var runAsync = require('run-async');
|
||||
var utils = require('../utils/utils');
|
||||
var Base = require('./baseUI');
|
||||
|
||||
|
||||
/**
|
||||
* Base interface class other can inherits from
|
||||
*/
|
||||
|
||||
var PromptUI = module.exports = function (prompts, opt) {
|
||||
Base.call(this, opt);
|
||||
this.prompts = prompts;
|
||||
};
|
||||
util.inherits(PromptUI, Base);
|
||||
|
||||
PromptUI.prototype.run = function (questions, allDone) {
|
||||
// Keep global reference to the answers
|
||||
this.answers = {};
|
||||
this.completed = allDone;
|
||||
|
||||
// Make sure questions is an array.
|
||||
if (_.isPlainObject(questions)) {
|
||||
questions = [questions];
|
||||
}
|
||||
|
||||
// Create an observable, unless we received one as parameter.
|
||||
// Note: As this is a public interface, we cannot do an instanceof check as we won't
|
||||
// be using the exact same object in memory.
|
||||
var obs = _.isArray(questions) ? rx.Observable.from(questions) : questions;
|
||||
|
||||
this.process = obs
|
||||
.concatMap(this.processQuestion.bind(this))
|
||||
.publish(); // `publish` creates a hot Observable. It prevents duplicating prompts.
|
||||
|
||||
this.process.subscribe(
|
||||
_.noop,
|
||||
function (err) { throw err; },
|
||||
this.onCompletion.bind(this)
|
||||
);
|
||||
|
||||
return this.process.connect();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Once all prompt are over
|
||||
*/
|
||||
|
||||
PromptUI.prototype.onCompletion = function () {
|
||||
this.close();
|
||||
|
||||
if (_.isFunction(this.completed)) {
|
||||
this.completed(this.answers);
|
||||
}
|
||||
};
|
||||
|
||||
PromptUI.prototype.processQuestion = function (question) {
|
||||
return rx.Observable.defer(function () {
|
||||
var obs = rx.Observable.create(function (obs) {
|
||||
obs.onNext(question);
|
||||
obs.onCompleted();
|
||||
});
|
||||
|
||||
return obs
|
||||
.concatMap(this.setDefaultType.bind(this))
|
||||
.concatMap(this.filterIfRunnable.bind(this))
|
||||
.concatMap(utils.fetchAsyncQuestionProperty.bind(null, question, 'message', this.answers))
|
||||
.concatMap(utils.fetchAsyncQuestionProperty.bind(null, question, 'default', this.answers))
|
||||
.concatMap(utils.fetchAsyncQuestionProperty.bind(null, question, 'choices', this.answers))
|
||||
.concatMap(this.fetchAnswer.bind(this));
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
PromptUI.prototype.fetchAnswer = function (question) {
|
||||
var Prompt = this.prompts[question.type];
|
||||
var prompt = new Prompt(question, this.rl, this.answers);
|
||||
var answers = this.answers;
|
||||
return utils.createObservableFromAsync(function () {
|
||||
var done = this.async();
|
||||
prompt.run(function (answer) {
|
||||
answers[question.name] = answer;
|
||||
done({ name: question.name, answer: answer });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
PromptUI.prototype.setDefaultType = function (question) {
|
||||
// Default type to input
|
||||
if (!this.prompts[question.type]) {
|
||||
question.type = 'input';
|
||||
}
|
||||
return rx.Observable.defer(function () {
|
||||
return rx.Observable.return(question);
|
||||
});
|
||||
};
|
||||
|
||||
PromptUI.prototype.filterIfRunnable = function (question) {
|
||||
if (question.when == null) {
|
||||
return rx.Observable.return(question);
|
||||
}
|
||||
|
||||
var handleResult = function (obs, shouldRun) {
|
||||
if (shouldRun) {
|
||||
obs.onNext(question);
|
||||
}
|
||||
obs.onCompleted();
|
||||
};
|
||||
|
||||
var answers = this.answers;
|
||||
return rx.Observable.defer(function () {
|
||||
return rx.Observable.create(function (obs) {
|
||||
if (_.isBoolean(question.when)) {
|
||||
handleResult(obs, question.when);
|
||||
return;
|
||||
}
|
||||
|
||||
runAsync(question.when, function (shouldRun) {
|
||||
handleResult(obs, shouldRun);
|
||||
}, answers);
|
||||
});
|
||||
});
|
||||
};
|
||||
37
node_modules/inquirer/lib/utils/events.js
generated
vendored
Normal file
37
node_modules/inquirer/lib/utils/events.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
var rx = require('rx-lite');
|
||||
|
||||
function normalizeKeypressEvents(value, key) {
|
||||
return { value: value, key: key || {} };
|
||||
}
|
||||
|
||||
module.exports = function (rl) {
|
||||
var keypress = rx.Observable.fromEvent(rl.input, 'keypress', normalizeKeypressEvents)
|
||||
.filter(function (e) {
|
||||
// Ignore `enter` key. On the readline, we only care about the `line` event.
|
||||
return e.key.name !== 'enter' && e.key.name !== 'return';
|
||||
});
|
||||
|
||||
return {
|
||||
line: rx.Observable.fromEvent(rl, 'line'),
|
||||
keypress: keypress,
|
||||
|
||||
normalizedUpKey: keypress.filter(function (e) {
|
||||
return e.key.name === 'up' || e.key.name === 'k';
|
||||
}).share(),
|
||||
|
||||
normalizedDownKey: keypress.filter(function (e) {
|
||||
return e.key.name === 'down' || e.key.name === 'j';
|
||||
}).share(),
|
||||
|
||||
numberKey: keypress.filter(function (e) {
|
||||
return e.value && '123456789'.indexOf(e.value) >= 0;
|
||||
}).map(function (e) {
|
||||
return Number(e.value);
|
||||
}).share(),
|
||||
|
||||
spaceKey: keypress.filter(function (e) {
|
||||
return e.key && e.key.name === 'space';
|
||||
}).share()
|
||||
};
|
||||
};
|
||||
38
node_modules/inquirer/lib/utils/paginator.js
generated
vendored
Normal file
38
node_modules/inquirer/lib/utils/paginator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var chalk = require('chalk');
|
||||
|
||||
|
||||
/**
|
||||
* The paginator keep trakcs of a pointer index in a list and return
|
||||
* a subset of the choices if the list is too long.
|
||||
*/
|
||||
|
||||
var Paginator = module.exports = function () {
|
||||
this.pointer = 0;
|
||||
this.lastIndex = 0;
|
||||
};
|
||||
|
||||
Paginator.prototype.paginate = function (output, active) {
|
||||
var pageSize = 7;
|
||||
var lines = output.split('\n');
|
||||
|
||||
// Make sure there's enough lines to paginate
|
||||
if (lines.length <= pageSize + 2) {
|
||||
return output;
|
||||
}
|
||||
|
||||
// Move the pointer only when the user go down and limit it to 3
|
||||
if (this.pointer < 3 && this.lastIndex < active && active - this.lastIndex < 9) {
|
||||
this.pointer = Math.min(3, this.pointer + active - this.lastIndex);
|
||||
}
|
||||
this.lastIndex = active;
|
||||
|
||||
// Duplicate the lines so it give an infinite list look
|
||||
var infinite = _.flatten([lines, lines, lines]);
|
||||
var topIndex = Math.max(0, active + lines.length - this.pointer);
|
||||
|
||||
var section = infinite.splice(topIndex, pageSize).join('\n');
|
||||
return section + '\n' + chalk.dim('(Move up and down to reveal more choices)');
|
||||
};
|
||||
51
node_modules/inquirer/lib/utils/readline.js
generated
vendored
Normal file
51
node_modules/inquirer/lib/utils/readline.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
var ansiEscapes = require('ansi-escapes');
|
||||
|
||||
/**
|
||||
* Move cursor left by `x`
|
||||
* @param {Readline} rl - Readline instance
|
||||
* @param {Number} x - How far to go left (default to 1)
|
||||
*/
|
||||
|
||||
exports.left = function(rl, x) {
|
||||
rl.output.write(ansiEscapes.cursorBackward(x));
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor right by `x`
|
||||
* @param {Readline} rl - Readline instance
|
||||
* @param {Number} x - How far to go left (default to 1)
|
||||
*/
|
||||
|
||||
exports.right = function(rl, x) {
|
||||
rl.output.write(ansiEscapes.cursorForward(x));
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor up by `x`
|
||||
* @param {Readline} rl - Readline instance
|
||||
* @param {Number} x - How far to go up (default to 1)
|
||||
*/
|
||||
|
||||
exports.up = function (rl, x) {
|
||||
rl.output.write(ansiEscapes.cursorUp(x));
|
||||
};
|
||||
|
||||
/**
|
||||
* Move cursor down by `x`
|
||||
* @param {Readline} rl - Readline instance
|
||||
* @param {Number} x - How far to go down (default to 1)
|
||||
*/
|
||||
|
||||
exports.down = function (rl, x) {
|
||||
rl.output.write(ansiEscapes.cursorDown(x));
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear current line
|
||||
* @param {Readline} rl - Readline instance
|
||||
* @param {Number} len - number of line to delete
|
||||
*/
|
||||
exports.clearLine = function (rl, len) {
|
||||
rl.output.write(ansiEscapes.eraseLines(len));
|
||||
};
|
||||
112
node_modules/inquirer/lib/utils/screen-manager.js
generated
vendored
Normal file
112
node_modules/inquirer/lib/utils/screen-manager.js
generated
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
var util = require('./readline');
|
||||
var readline = require('readline');
|
||||
var cliWidth = require('cli-width');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
|
||||
|
||||
var ScreenManager = module.exports = function (rl) {
|
||||
// These variables are keeping information to allow correct prompt re-rendering
|
||||
this.height = 0;
|
||||
this.extraLinesUnderPrompt = 0;
|
||||
|
||||
this.rl = rl;
|
||||
};
|
||||
|
||||
ScreenManager.prototype.render = function (content, opt) {
|
||||
opt = _.extend({ cursor: 0 }, opt || {});
|
||||
var cursorPos = this.rl._getCursorPos();
|
||||
|
||||
this.rl.output.unmute();
|
||||
this.clean(this.extraLinesUnderPrompt);
|
||||
|
||||
/**
|
||||
* Write message to screen and setPrompt to control backspace
|
||||
*/
|
||||
|
||||
var lines = content.split(/\n/);
|
||||
var promptLine = lines[lines.length - 1 - opt.cursor];
|
||||
var rawPromptLine = stripAnsi(promptLine);
|
||||
|
||||
// Remove the rl.line from our prompt. We can't rely on the content of
|
||||
// rl.line (mainly because of the password prompt), so just rely on it's
|
||||
// length.
|
||||
var prompt = promptLine;
|
||||
if (this.rl.line.length) {
|
||||
prompt = prompt.slice(0, -this.rl.line.length);
|
||||
}
|
||||
this.rl.setPrompt(prompt);
|
||||
var rawPrompt = stripAnsi(prompt);
|
||||
|
||||
// Manually insert an extra line if we're at the end of the line.
|
||||
// This prevent the cursor from appearing at the beginning of the
|
||||
// current line.
|
||||
if (rawPromptLine.length === cliWidth()) {
|
||||
lines.splice(lines.length, 0, ' ');
|
||||
}
|
||||
|
||||
this.rl.output.write(lines.join('\n'));
|
||||
|
||||
/**
|
||||
* Re-adjust the cursor at the correct position.
|
||||
*/
|
||||
|
||||
var breakedLines = breakLines(lines);
|
||||
var actualLines = _.flatten(breakedLines);
|
||||
|
||||
var promptLineUpDiff = Math.floor(rawPromptLine.length / cliWidth()) - cursorPos.rows;
|
||||
if (opt.cursor + promptLineUpDiff > 0) {
|
||||
util.up(this.rl, opt.cursor + promptLineUpDiff);
|
||||
}
|
||||
|
||||
// Reset cursor at the beginning of the line
|
||||
util.left(this.rl, stripAnsi(_.last(actualLines)).length);
|
||||
|
||||
var rightPos = cursorPos.cols;
|
||||
|
||||
if (cursorPos.rows === 0) {
|
||||
rightPos = Math.max(rightPos, rawPrompt.length);
|
||||
}
|
||||
|
||||
// rightPos should never be further than the total line content size.
|
||||
// If we changed the prompt and reset the rl.line, we want to reset our
|
||||
// cursor at the beginning of the prompt.
|
||||
if (rightPos > rawPromptLine.length && !this.rl.line) {
|
||||
rightPos = rawPrompt.length;
|
||||
}
|
||||
|
||||
util.right(this.rl, rightPos);
|
||||
|
||||
/**
|
||||
* Set up state for next re-rendering
|
||||
*/
|
||||
|
||||
var bottomSection = breakedLines.slice(breakedLines.length - opt.cursor - promptLineUpDiff);
|
||||
this.extraLinesUnderPrompt = _.flatten(bottomSection).length;
|
||||
this.height = actualLines.length;
|
||||
|
||||
this.rl.output.mute();
|
||||
};
|
||||
|
||||
ScreenManager.prototype.clean = function (extraLines) {
|
||||
if (extraLines > 0) {
|
||||
util.down(this.rl, extraLines);
|
||||
}
|
||||
util.clearLine(this.rl, this.height);
|
||||
};
|
||||
|
||||
ScreenManager.prototype.done = function () {
|
||||
this.rl.setPrompt('');
|
||||
this.rl.output.unmute();
|
||||
this.rl.output.write('\n');
|
||||
};
|
||||
|
||||
function breakLines(lines) {
|
||||
// Break lines who're longuer than the cli width so we can gracefully handle line
|
||||
// returns.
|
||||
var regex = new RegExp('.{1,' + cliWidth() + '}', 'g');
|
||||
return lines.map(function (line) {
|
||||
return stripAnsi(line).match(regex);
|
||||
});
|
||||
}
|
||||
47
node_modules/inquirer/lib/utils/utils.js
generated
vendored
Normal file
47
node_modules/inquirer/lib/utils/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
var rx = require('rx-lite');
|
||||
var runAsync = require('run-async');
|
||||
|
||||
|
||||
/**
|
||||
* Create an oversable returning the result of a function runned in sync or async mode.
|
||||
* @param {Function} func Function to run
|
||||
* @return {rx.Observable} Observable emitting when value is known
|
||||
*/
|
||||
|
||||
exports.createObservableFromAsync = function (func) {
|
||||
return rx.Observable.defer(function () {
|
||||
return rx.Observable.create(function (obs) {
|
||||
runAsync(func, function (value) {
|
||||
obs.onNext(value);
|
||||
obs.onCompleted();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Resolve a question property value if it is passed as a function.
|
||||
* This method will overwrite the property on the question object with the received value.
|
||||
* @param {Object} question - Question object
|
||||
* @param {String} prop - Property to fetch name
|
||||
* @param {Object} answers - Answers object
|
||||
* @...rest {Mixed} rest - Arguments to pass to `func`
|
||||
* @return {rx.Obsersable} - Observable emitting once value is known
|
||||
*/
|
||||
|
||||
exports.fetchAsyncQuestionProperty = function (question, prop, answers) {
|
||||
if (!_.isFunction(question[prop])) {
|
||||
return rx.Observable.return(question);
|
||||
}
|
||||
|
||||
return exports.createObservableFromAsync(function () {
|
||||
var done = this.async();
|
||||
runAsync(question[prop], function (value) {
|
||||
question[prop] = value;
|
||||
done(question);
|
||||
}, answers);
|
||||
});
|
||||
};
|
||||
22
node_modules/inquirer/node_modules/lodash/LICENSE
generated
vendored
Normal file
22
node_modules/inquirer/node_modules/lodash/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
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.
|
||||
121
node_modules/inquirer/node_modules/lodash/README.md
generated
vendored
Normal file
121
node_modules/inquirer/node_modules/lodash/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# lodash v3.10.1
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
$ lodash modularize modern exports=node -o ./
|
||||
$ lodash modern -d -o ./index.js
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
// load the modern build
|
||||
var _ = require('lodash');
|
||||
// or a method category
|
||||
var array = require('lodash/array');
|
||||
// or a method (great for smaller builds with browserify/webpack)
|
||||
var chunk = require('lodash/array/chunk');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.10.1-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
|
||||
Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default.
|
||||
|
||||
## Module formats
|
||||
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.10.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.10.1-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.10.1-es) build
|
||||
|
||||
## Further Reading
|
||||
|
||||
* [API Documentation](https://lodash.com/docs)
|
||||
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
|
||||
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
|
||||
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
|
||||
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
|
||||
|
||||
## Features
|
||||
|
||||
* ~100% [code coverage](https://coveralls.io/r/lodash)
|
||||
* Follows [semantic versioning](http://semver.org/) for releases
|
||||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining
|
||||
* [_(…)](https://lodash.com/docs#_) supports implicit chaining
|
||||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order
|
||||
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
|
||||
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch
|
||||
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after)
|
||||
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size
|
||||
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions
|
||||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control
|
||||
* [_.defaultsDeep](https://lodash.com/docs#defaultsDeep) for recursively assigning default properties
|
||||
* [_.fill](https://lodash.com/docs#fill) to fill arrays with values
|
||||
* [_.findKey](https://lodash.com/docs#findKey) for finding keys
|
||||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`)
|
||||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
|
||||
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
|
||||
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
|
||||
* [_.get](https://lodash.com/docs#get) & [_.set](https://lodash.com/docs#set) for deep property getting & setting
|
||||
* [_.gt](https://lodash.com/docs#gt), [_.gte](https://lodash.com/docs#gte), [_.lt](https://lodash.com/docs#lt), & [_.lte](https://lodash.com/docs#lte) relational methods
|
||||
* [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range
|
||||
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
|
||||
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
|
||||
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays
|
||||
* [_.mapKeys](https://lodash.com/docs#mapKeys) for mapping keys to an object
|
||||
* [_.matches](https://lodash.com/docs#matches) supports deep object comparisons
|
||||
* [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property)
|
||||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
|
||||
* [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods
|
||||
* [_.modArgs](https://lodash.com/docs#modArgs) for more advanced functional composition
|
||||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior
|
||||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays
|
||||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
|
||||
* [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions
|
||||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking
|
||||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values
|
||||
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders
|
||||
* [_.support](https://lodash.com/docs#support) for flagging environment features
|
||||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
|
||||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
|
||||
* [_.unzipWith](https://lodash.com/docs#unzipWith) & [_.zipWith](https://lodash.com/docs#zipWith) to specify how grouped values should be combined
|
||||
* [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties
|
||||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
|
||||
* [_.add](https://lodash.com/docs#add), [_.round](https://lodash.com/docs#round), [_.sum](https://lodash.com/docs#sum), &
|
||||
[more](https://lodash.com/docs "_.ceil & _.floor") math methods
|
||||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), &
|
||||
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders
|
||||
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), &
|
||||
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods
|
||||
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), &
|
||||
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept customizer callbacks
|
||||
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), &
|
||||
[more](https://lodash.com/docs "_.drop, _.dropRight, _.dropRightWhile, _.take, _.takeRight, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest)
|
||||
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), &
|
||||
[more](https://lodash.com/docs "_.curryRight, _.dropRight, _.dropRightWhile, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.padRight, partialRight, _.takeRight, _.trimRight, _.takeRightWhile") right-associative methods
|
||||
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), &
|
||||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.findWhere, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.sortByAll, _.sortByOrder, _.sum, _.where") accept strings
|
||||
* [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences
|
||||
* [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, io.js 2.5.0, Node.js 0.8.28, 0.10.40, & 0.12.7, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6.
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
|
||||
44
node_modules/inquirer/node_modules/lodash/array.js
generated
vendored
Normal file
44
node_modules/inquirer/node_modules/lodash/array.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
module.exports = {
|
||||
'chunk': require('./array/chunk'),
|
||||
'compact': require('./array/compact'),
|
||||
'difference': require('./array/difference'),
|
||||
'drop': require('./array/drop'),
|
||||
'dropRight': require('./array/dropRight'),
|
||||
'dropRightWhile': require('./array/dropRightWhile'),
|
||||
'dropWhile': require('./array/dropWhile'),
|
||||
'fill': require('./array/fill'),
|
||||
'findIndex': require('./array/findIndex'),
|
||||
'findLastIndex': require('./array/findLastIndex'),
|
||||
'first': require('./array/first'),
|
||||
'flatten': require('./array/flatten'),
|
||||
'flattenDeep': require('./array/flattenDeep'),
|
||||
'head': require('./array/head'),
|
||||
'indexOf': require('./array/indexOf'),
|
||||
'initial': require('./array/initial'),
|
||||
'intersection': require('./array/intersection'),
|
||||
'last': require('./array/last'),
|
||||
'lastIndexOf': require('./array/lastIndexOf'),
|
||||
'object': require('./array/object'),
|
||||
'pull': require('./array/pull'),
|
||||
'pullAt': require('./array/pullAt'),
|
||||
'remove': require('./array/remove'),
|
||||
'rest': require('./array/rest'),
|
||||
'slice': require('./array/slice'),
|
||||
'sortedIndex': require('./array/sortedIndex'),
|
||||
'sortedLastIndex': require('./array/sortedLastIndex'),
|
||||
'tail': require('./array/tail'),
|
||||
'take': require('./array/take'),
|
||||
'takeRight': require('./array/takeRight'),
|
||||
'takeRightWhile': require('./array/takeRightWhile'),
|
||||
'takeWhile': require('./array/takeWhile'),
|
||||
'union': require('./array/union'),
|
||||
'uniq': require('./array/uniq'),
|
||||
'unique': require('./array/unique'),
|
||||
'unzip': require('./array/unzip'),
|
||||
'unzipWith': require('./array/unzipWith'),
|
||||
'without': require('./array/without'),
|
||||
'xor': require('./array/xor'),
|
||||
'zip': require('./array/zip'),
|
||||
'zipObject': require('./array/zipObject'),
|
||||
'zipWith': require('./array/zipWith')
|
||||
};
|
||||
46
node_modules/inquirer/node_modules/lodash/array/chunk.js
generated
vendored
Normal file
46
node_modules/inquirer/node_modules/lodash/array/chunk.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil,
|
||||
nativeFloor = Math.floor,
|
||||
nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* Creates an array of elements split into groups the length of `size`.
|
||||
* If `collection` can't be split evenly, the final chunk will be the remaining
|
||||
* elements.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to process.
|
||||
* @param {number} [size=1] The length of each chunk.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the new array containing chunks.
|
||||
* @example
|
||||
*
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 2);
|
||||
* // => [['a', 'b'], ['c', 'd']]
|
||||
*
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 3);
|
||||
* // => [['a', 'b', 'c'], ['d']]
|
||||
*/
|
||||
function chunk(array, size, guard) {
|
||||
if (guard ? isIterateeCall(array, size, guard) : size == null) {
|
||||
size = 1;
|
||||
} else {
|
||||
size = nativeMax(nativeFloor(size) || 1, 1);
|
||||
}
|
||||
var index = 0,
|
||||
length = array ? array.length : 0,
|
||||
resIndex = -1,
|
||||
result = Array(nativeCeil(length / size));
|
||||
|
||||
while (index < length) {
|
||||
result[++resIndex] = baseSlice(array, index, (index += size));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = chunk;
|
||||
30
node_modules/inquirer/node_modules/lodash/array/compact.js
generated
vendored
Normal file
30
node_modules/inquirer/node_modules/lodash/array/compact.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Creates an array with all falsey values removed. The values `false`, `null`,
|
||||
* `0`, `""`, `undefined`, and `NaN` are falsey.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to compact.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* _.compact([0, 1, false, 2, '', 3]);
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function compact(array) {
|
||||
var index = -1,
|
||||
length = array ? array.length : 0,
|
||||
resIndex = -1,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (value) {
|
||||
result[++resIndex] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = compact;
|
||||
29
node_modules/inquirer/node_modules/lodash/array/difference.js
generated
vendored
Normal file
29
node_modules/inquirer/node_modules/lodash/array/difference.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
var baseDifference = require('../internal/baseDifference'),
|
||||
baseFlatten = require('../internal/baseFlatten'),
|
||||
isArrayLike = require('../internal/isArrayLike'),
|
||||
isObjectLike = require('../internal/isObjectLike'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of unique `array` values not included in the other
|
||||
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {...Array} [values] The arrays of values to exclude.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* _.difference([1, 2, 3], [4, 2]);
|
||||
* // => [1, 3]
|
||||
*/
|
||||
var difference = restParam(function(array, values) {
|
||||
return (isObjectLike(array) && isArrayLike(array))
|
||||
? baseDifference(array, baseFlatten(values, false, true))
|
||||
: [];
|
||||
});
|
||||
|
||||
module.exports = difference;
|
||||
39
node_modules/inquirer/node_modules/lodash/array/drop.js
generated
vendored
Normal file
39
node_modules/inquirer/node_modules/lodash/array/drop.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with `n` elements dropped from the beginning.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {number} [n=1] The number of elements to drop.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.drop([1, 2, 3]);
|
||||
* // => [2, 3]
|
||||
*
|
||||
* _.drop([1, 2, 3], 2);
|
||||
* // => [3]
|
||||
*
|
||||
* _.drop([1, 2, 3], 5);
|
||||
* // => []
|
||||
*
|
||||
* _.drop([1, 2, 3], 0);
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function drop(array, n, guard) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (guard ? isIterateeCall(array, n, guard) : n == null) {
|
||||
n = 1;
|
||||
}
|
||||
return baseSlice(array, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
module.exports = drop;
|
||||
40
node_modules/inquirer/node_modules/lodash/array/dropRight.js
generated
vendored
Normal file
40
node_modules/inquirer/node_modules/lodash/array/dropRight.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with `n` elements dropped from the end.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {number} [n=1] The number of elements to drop.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.dropRight([1, 2, 3]);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* _.dropRight([1, 2, 3], 2);
|
||||
* // => [1]
|
||||
*
|
||||
* _.dropRight([1, 2, 3], 5);
|
||||
* // => []
|
||||
*
|
||||
* _.dropRight([1, 2, 3], 0);
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function dropRight(array, n, guard) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (guard ? isIterateeCall(array, n, guard) : n == null) {
|
||||
n = 1;
|
||||
}
|
||||
n = length - (+n || 0);
|
||||
return baseSlice(array, 0, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
module.exports = dropRight;
|
||||
59
node_modules/inquirer/node_modules/lodash/array/dropRightWhile.js
generated
vendored
Normal file
59
node_modules/inquirer/node_modules/lodash/array/dropRightWhile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
baseWhile = require('../internal/baseWhile');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` excluding elements dropped from the end.
|
||||
* Elements are dropped until `predicate` returns falsey. The predicate is
|
||||
* bound to `thisArg` and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that match the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.dropRightWhile([1, 2, 3], function(n) {
|
||||
* return n > 1;
|
||||
* });
|
||||
* // => [1]
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': true },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': false }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
|
||||
* // => ['barney', 'fred']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.pluck(_.dropRightWhile(users, 'active', false), 'user');
|
||||
* // => ['barney']
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.pluck(_.dropRightWhile(users, 'active'), 'user');
|
||||
* // => ['barney', 'fred', 'pebbles']
|
||||
*/
|
||||
function dropRightWhile(array, predicate, thisArg) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseCallback(predicate, thisArg, 3), true, true)
|
||||
: [];
|
||||
}
|
||||
|
||||
module.exports = dropRightWhile;
|
||||
59
node_modules/inquirer/node_modules/lodash/array/dropWhile.js
generated
vendored
Normal file
59
node_modules/inquirer/node_modules/lodash/array/dropWhile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
baseWhile = require('../internal/baseWhile');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` excluding elements dropped from the beginning.
|
||||
* Elements are dropped until `predicate` returns falsey. The predicate is
|
||||
* bound to `thisArg` and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.dropWhile([1, 2, 3], function(n) {
|
||||
* return n < 3;
|
||||
* });
|
||||
* // => [3]
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': true }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
|
||||
* // => ['fred', 'pebbles']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.pluck(_.dropWhile(users, 'active', false), 'user');
|
||||
* // => ['pebbles']
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.pluck(_.dropWhile(users, 'active'), 'user');
|
||||
* // => ['barney', 'fred', 'pebbles']
|
||||
*/
|
||||
function dropWhile(array, predicate, thisArg) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseCallback(predicate, thisArg, 3), true)
|
||||
: [];
|
||||
}
|
||||
|
||||
module.exports = dropWhile;
|
||||
44
node_modules/inquirer/node_modules/lodash/array/fill.js
generated
vendored
Normal file
44
node_modules/inquirer/node_modules/lodash/array/fill.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
var baseFill = require('../internal/baseFill'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Fills elements of `array` with `value` from `start` up to, but not
|
||||
* including, `end`.
|
||||
*
|
||||
* **Note:** This method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to fill.
|
||||
* @param {*} value The value to fill `array` with.
|
||||
* @param {number} [start=0] The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3];
|
||||
*
|
||||
* _.fill(array, 'a');
|
||||
* console.log(array);
|
||||
* // => ['a', 'a', 'a']
|
||||
*
|
||||
* _.fill(Array(3), 2);
|
||||
* // => [2, 2, 2]
|
||||
*
|
||||
* _.fill([4, 6, 8], '*', 1, 2);
|
||||
* // => [4, '*', 8]
|
||||
*/
|
||||
function fill(array, value, start, end) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
|
||||
start = 0;
|
||||
end = length;
|
||||
}
|
||||
return baseFill(array, value, start, end);
|
||||
}
|
||||
|
||||
module.exports = fill;
|
||||
53
node_modules/inquirer/node_modules/lodash/array/findIndex.js
generated
vendored
Normal file
53
node_modules/inquirer/node_modules/lodash/array/findIndex.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
var createFindIndex = require('../internal/createFindIndex');
|
||||
|
||||
/**
|
||||
* This method is like `_.find` except that it returns the index of the first
|
||||
* element `predicate` returns truthy for instead of the element itself.
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': true }
|
||||
* ];
|
||||
*
|
||||
* _.findIndex(users, function(chr) {
|
||||
* return chr.user == 'barney';
|
||||
* });
|
||||
* // => 0
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
||||
* // => 1
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.findIndex(users, 'active', false);
|
||||
* // => 0
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.findIndex(users, 'active');
|
||||
* // => 2
|
||||
*/
|
||||
var findIndex = createFindIndex();
|
||||
|
||||
module.exports = findIndex;
|
||||
53
node_modules/inquirer/node_modules/lodash/array/findLastIndex.js
generated
vendored
Normal file
53
node_modules/inquirer/node_modules/lodash/array/findLastIndex.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
var createFindIndex = require('../internal/createFindIndex');
|
||||
|
||||
/**
|
||||
* This method is like `_.findIndex` except that it iterates over elements
|
||||
* of `collection` from right to left.
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': true },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': false }
|
||||
* ];
|
||||
*
|
||||
* _.findLastIndex(users, function(chr) {
|
||||
* return chr.user == 'pebbles';
|
||||
* });
|
||||
* // => 2
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
||||
* // => 0
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.findLastIndex(users, 'active', false);
|
||||
* // => 2
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.findLastIndex(users, 'active');
|
||||
* // => 0
|
||||
*/
|
||||
var findLastIndex = createFindIndex(true);
|
||||
|
||||
module.exports = findLastIndex;
|
||||
22
node_modules/inquirer/node_modules/lodash/array/first.js
generated
vendored
Normal file
22
node_modules/inquirer/node_modules/lodash/array/first.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Gets the first element of `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias head
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @returns {*} Returns the first element of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.first([1, 2, 3]);
|
||||
* // => 1
|
||||
*
|
||||
* _.first([]);
|
||||
* // => undefined
|
||||
*/
|
||||
function first(array) {
|
||||
return array ? array[0] : undefined;
|
||||
}
|
||||
|
||||
module.exports = first;
|
||||
32
node_modules/inquirer/node_modules/lodash/array/flatten.js
generated
vendored
Normal file
32
node_modules/inquirer/node_modules/lodash/array/flatten.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var baseFlatten = require('../internal/baseFlatten'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Flattens a nested array. If `isDeep` is `true` the array is recursively
|
||||
* flattened, otherwise it's only flattened a single level.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isDeep] Specify a deep flatten.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
* @example
|
||||
*
|
||||
* _.flatten([1, [2, 3, [4]]]);
|
||||
* // => [1, 2, 3, [4]]
|
||||
*
|
||||
* // using `isDeep`
|
||||
* _.flatten([1, [2, 3, [4]]], true);
|
||||
* // => [1, 2, 3, 4]
|
||||
*/
|
||||
function flatten(array, isDeep, guard) {
|
||||
var length = array ? array.length : 0;
|
||||
if (guard && isIterateeCall(array, isDeep, guard)) {
|
||||
isDeep = false;
|
||||
}
|
||||
return length ? baseFlatten(array, isDeep) : [];
|
||||
}
|
||||
|
||||
module.exports = flatten;
|
||||
21
node_modules/inquirer/node_modules/lodash/array/flattenDeep.js
generated
vendored
Normal file
21
node_modules/inquirer/node_modules/lodash/array/flattenDeep.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
var baseFlatten = require('../internal/baseFlatten');
|
||||
|
||||
/**
|
||||
* Recursively flattens a nested array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to recursively flatten.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
* @example
|
||||
*
|
||||
* _.flattenDeep([1, [2, 3, [4]]]);
|
||||
* // => [1, 2, 3, 4]
|
||||
*/
|
||||
function flattenDeep(array) {
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseFlatten(array, true) : [];
|
||||
}
|
||||
|
||||
module.exports = flattenDeep;
|
||||
1
node_modules/inquirer/node_modules/lodash/array/head.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/array/head.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./first');
|
||||
53
node_modules/inquirer/node_modules/lodash/array/indexOf.js
generated
vendored
Normal file
53
node_modules/inquirer/node_modules/lodash/array/indexOf.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
var baseIndexOf = require('../internal/baseIndexOf'),
|
||||
binaryIndex = require('../internal/binaryIndex');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `value` is found in `array`
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons. If `fromIndex` is negative, it's used as the offset
|
||||
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
|
||||
* performs a faster binary search.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {boolean|number} [fromIndex=0] The index to search from or `true`
|
||||
* to perform a binary search on a sorted array.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* _.indexOf([1, 2, 1, 2], 2);
|
||||
* // => 1
|
||||
*
|
||||
* // using `fromIndex`
|
||||
* _.indexOf([1, 2, 1, 2], 2, 2);
|
||||
* // => 3
|
||||
*
|
||||
* // performing a binary search
|
||||
* _.indexOf([1, 1, 2, 2], 2, true);
|
||||
* // => 2
|
||||
*/
|
||||
function indexOf(array, value, fromIndex) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return -1;
|
||||
}
|
||||
if (typeof fromIndex == 'number') {
|
||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
|
||||
} else if (fromIndex) {
|
||||
var index = binaryIndex(array, value);
|
||||
if (index < length &&
|
||||
(value === value ? (value === array[index]) : (array[index] !== array[index]))) {
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return baseIndexOf(array, value, fromIndex || 0);
|
||||
}
|
||||
|
||||
module.exports = indexOf;
|
||||
20
node_modules/inquirer/node_modules/lodash/array/initial.js
generated
vendored
Normal file
20
node_modules/inquirer/node_modules/lodash/array/initial.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
var dropRight = require('./dropRight');
|
||||
|
||||
/**
|
||||
* Gets all but the last element of `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.initial([1, 2, 3]);
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function initial(array) {
|
||||
return dropRight(array, 1);
|
||||
}
|
||||
|
||||
module.exports = initial;
|
||||
58
node_modules/inquirer/node_modules/lodash/array/intersection.js
generated
vendored
Normal file
58
node_modules/inquirer/node_modules/lodash/array/intersection.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
var baseIndexOf = require('../internal/baseIndexOf'),
|
||||
cacheIndexOf = require('../internal/cacheIndexOf'),
|
||||
createCache = require('../internal/createCache'),
|
||||
isArrayLike = require('../internal/isArrayLike'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that are included in all of the provided
|
||||
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to inspect.
|
||||
* @returns {Array} Returns the new array of shared values.
|
||||
* @example
|
||||
* _.intersection([1, 2], [4, 2], [2, 1]);
|
||||
* // => [2]
|
||||
*/
|
||||
var intersection = restParam(function(arrays) {
|
||||
var othLength = arrays.length,
|
||||
othIndex = othLength,
|
||||
caches = Array(length),
|
||||
indexOf = baseIndexOf,
|
||||
isCommon = true,
|
||||
result = [];
|
||||
|
||||
while (othIndex--) {
|
||||
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
|
||||
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
|
||||
}
|
||||
var array = arrays[0],
|
||||
index = -1,
|
||||
length = array ? array.length : 0,
|
||||
seen = caches[0];
|
||||
|
||||
outer:
|
||||
while (++index < length) {
|
||||
value = array[index];
|
||||
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
|
||||
var othIndex = othLength;
|
||||
while (--othIndex) {
|
||||
var cache = caches[othIndex];
|
||||
if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
if (seen) {
|
||||
seen.push(value);
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
module.exports = intersection;
|
||||
19
node_modules/inquirer/node_modules/lodash/array/last.js
generated
vendored
Normal file
19
node_modules/inquirer/node_modules/lodash/array/last.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Gets the last element of `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @returns {*} Returns the last element of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.last([1, 2, 3]);
|
||||
* // => 3
|
||||
*/
|
||||
function last(array) {
|
||||
var length = array ? array.length : 0;
|
||||
return length ? array[length - 1] : undefined;
|
||||
}
|
||||
|
||||
module.exports = last;
|
||||
60
node_modules/inquirer/node_modules/lodash/array/lastIndexOf.js
generated
vendored
Normal file
60
node_modules/inquirer/node_modules/lodash/array/lastIndexOf.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
var binaryIndex = require('../internal/binaryIndex'),
|
||||
indexOfNaN = require('../internal/indexOfNaN');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max,
|
||||
nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* This method is like `_.indexOf` except that it iterates over elements of
|
||||
* `array` from right to left.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to search.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {boolean|number} [fromIndex=array.length-1] The index to search from
|
||||
* or `true` to perform a binary search on a sorted array.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* _.lastIndexOf([1, 2, 1, 2], 2);
|
||||
* // => 3
|
||||
*
|
||||
* // using `fromIndex`
|
||||
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
|
||||
* // => 1
|
||||
*
|
||||
* // performing a binary search
|
||||
* _.lastIndexOf([1, 1, 2, 2], 2, true);
|
||||
* // => 3
|
||||
*/
|
||||
function lastIndexOf(array, value, fromIndex) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return -1;
|
||||
}
|
||||
var index = length;
|
||||
if (typeof fromIndex == 'number') {
|
||||
index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
|
||||
} else if (fromIndex) {
|
||||
index = binaryIndex(array, value, true) - 1;
|
||||
var other = array[index];
|
||||
if (value === value ? (value === other) : (other !== other)) {
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (value !== value) {
|
||||
return indexOfNaN(array, index, true);
|
||||
}
|
||||
while (index--) {
|
||||
if (array[index] === value) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
module.exports = lastIndexOf;
|
||||
1
node_modules/inquirer/node_modules/lodash/array/object.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/array/object.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./zipObject');
|
||||
52
node_modules/inquirer/node_modules/lodash/array/pull.js
generated
vendored
Normal file
52
node_modules/inquirer/node_modules/lodash/array/pull.js
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
var baseIndexOf = require('../internal/baseIndexOf');
|
||||
|
||||
/** Used for native method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
|
||||
/** Native method references. */
|
||||
var splice = arrayProto.splice;
|
||||
|
||||
/**
|
||||
* Removes all provided values from `array` using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.without`, this method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {...*} [values] The values to remove.
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3, 1, 2, 3];
|
||||
*
|
||||
* _.pull(array, 2, 3);
|
||||
* console.log(array);
|
||||
* // => [1, 1]
|
||||
*/
|
||||
function pull() {
|
||||
var args = arguments,
|
||||
array = args[0];
|
||||
|
||||
if (!(array && array.length)) {
|
||||
return array;
|
||||
}
|
||||
var index = 0,
|
||||
indexOf = baseIndexOf,
|
||||
length = args.length;
|
||||
|
||||
while (++index < length) {
|
||||
var fromIndex = 0,
|
||||
value = args[index];
|
||||
|
||||
while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
|
||||
splice.call(array, fromIndex, 1);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = pull;
|
||||
40
node_modules/inquirer/node_modules/lodash/array/pullAt.js
generated
vendored
Normal file
40
node_modules/inquirer/node_modules/lodash/array/pullAt.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
var baseAt = require('../internal/baseAt'),
|
||||
baseCompareAscending = require('../internal/baseCompareAscending'),
|
||||
baseFlatten = require('../internal/baseFlatten'),
|
||||
basePullAt = require('../internal/basePullAt'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Removes elements from `array` corresponding to the given indexes and returns
|
||||
* an array of the removed elements. Indexes may be specified as an array of
|
||||
* indexes or as individual arguments.
|
||||
*
|
||||
* **Note:** Unlike `_.at`, this method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {...(number|number[])} [indexes] The indexes of elements to remove,
|
||||
* specified as individual indexes or arrays of indexes.
|
||||
* @returns {Array} Returns the new array of removed elements.
|
||||
* @example
|
||||
*
|
||||
* var array = [5, 10, 15, 20];
|
||||
* var evens = _.pullAt(array, 1, 3);
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [5, 15]
|
||||
*
|
||||
* console.log(evens);
|
||||
* // => [10, 20]
|
||||
*/
|
||||
var pullAt = restParam(function(array, indexes) {
|
||||
indexes = baseFlatten(indexes);
|
||||
|
||||
var result = baseAt(array, indexes);
|
||||
basePullAt(array, indexes.sort(baseCompareAscending));
|
||||
return result;
|
||||
});
|
||||
|
||||
module.exports = pullAt;
|
||||
64
node_modules/inquirer/node_modules/lodash/array/remove.js
generated
vendored
Normal file
64
node_modules/inquirer/node_modules/lodash/array/remove.js
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
basePullAt = require('../internal/basePullAt');
|
||||
|
||||
/**
|
||||
* Removes all elements from `array` that `predicate` returns truthy for
|
||||
* and returns an array of the removed elements. The predicate is bound to
|
||||
* `thisArg` and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* **Note:** Unlike `_.filter`, this method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the new array of removed elements.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3, 4];
|
||||
* var evens = _.remove(array, function(n) {
|
||||
* return n % 2 == 0;
|
||||
* });
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1, 3]
|
||||
*
|
||||
* console.log(evens);
|
||||
* // => [2, 4]
|
||||
*/
|
||||
function remove(array, predicate, thisArg) {
|
||||
var result = [];
|
||||
if (!(array && array.length)) {
|
||||
return result;
|
||||
}
|
||||
var index = -1,
|
||||
indexes = [],
|
||||
length = array.length;
|
||||
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (predicate(value, index, array)) {
|
||||
result.push(value);
|
||||
indexes.push(index);
|
||||
}
|
||||
}
|
||||
basePullAt(array, indexes);
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = remove;
|
||||
21
node_modules/inquirer/node_modules/lodash/array/rest.js
generated
vendored
Normal file
21
node_modules/inquirer/node_modules/lodash/array/rest.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
var drop = require('./drop');
|
||||
|
||||
/**
|
||||
* Gets all but the first element of `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias tail
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.rest([1, 2, 3]);
|
||||
* // => [2, 3]
|
||||
*/
|
||||
function rest(array) {
|
||||
return drop(array, 1);
|
||||
}
|
||||
|
||||
module.exports = rest;
|
||||
30
node_modules/inquirer/node_modules/lodash/array/slice.js
generated
vendored
Normal file
30
node_modules/inquirer/node_modules/lodash/array/slice.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
||||
*
|
||||
* **Note:** This method is used instead of `Array#slice` to support node
|
||||
* lists in IE < 9 and to ensure dense arrays are returned.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to slice.
|
||||
* @param {number} [start=0] The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
*/
|
||||
function slice(array, start, end) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
||||
start = 0;
|
||||
end = length;
|
||||
}
|
||||
return baseSlice(array, start, end);
|
||||
}
|
||||
|
||||
module.exports = slice;
|
||||
53
node_modules/inquirer/node_modules/lodash/array/sortedIndex.js
generated
vendored
Normal file
53
node_modules/inquirer/node_modules/lodash/array/sortedIndex.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
var createSortedIndex = require('../internal/createSortedIndex');
|
||||
|
||||
/**
|
||||
* Uses a binary search to determine the lowest index at which `value` should
|
||||
* be inserted into `array` in order to maintain its sort order. If an iteratee
|
||||
* function is provided it's invoked for `value` and each element of `array`
|
||||
* to compute their sort ranking. The iteratee is bound to `thisArg` and
|
||||
* invoked with one argument; (value).
|
||||
*
|
||||
* If a property name is provided for `iteratee` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `iteratee` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The sorted array to inspect.
|
||||
* @param {*} value The value to evaluate.
|
||||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {number} Returns the index at which `value` should be inserted
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedIndex([30, 50], 40);
|
||||
* // => 1
|
||||
*
|
||||
* _.sortedIndex([4, 4, 5, 5], 5);
|
||||
* // => 2
|
||||
*
|
||||
* var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
|
||||
*
|
||||
* // using an iteratee function
|
||||
* _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
|
||||
* return this.data[word];
|
||||
* }, dict);
|
||||
* // => 1
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
* // => 1
|
||||
*/
|
||||
var sortedIndex = createSortedIndex();
|
||||
|
||||
module.exports = sortedIndex;
|
||||
25
node_modules/inquirer/node_modules/lodash/array/sortedLastIndex.js
generated
vendored
Normal file
25
node_modules/inquirer/node_modules/lodash/array/sortedLastIndex.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
var createSortedIndex = require('../internal/createSortedIndex');
|
||||
|
||||
/**
|
||||
* This method is like `_.sortedIndex` except that it returns the highest
|
||||
* index at which `value` should be inserted into `array` in order to
|
||||
* maintain its sort order.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The sorted array to inspect.
|
||||
* @param {*} value The value to evaluate.
|
||||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {number} Returns the index at which `value` should be inserted
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedLastIndex([4, 4, 5, 5], 5);
|
||||
* // => 4
|
||||
*/
|
||||
var sortedLastIndex = createSortedIndex(true);
|
||||
|
||||
module.exports = sortedLastIndex;
|
||||
1
node_modules/inquirer/node_modules/lodash/array/tail.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/array/tail.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./rest');
|
||||
39
node_modules/inquirer/node_modules/lodash/array/take.js
generated
vendored
Normal file
39
node_modules/inquirer/node_modules/lodash/array/take.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with `n` elements taken from the beginning.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {number} [n=1] The number of elements to take.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.take([1, 2, 3]);
|
||||
* // => [1]
|
||||
*
|
||||
* _.take([1, 2, 3], 2);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* _.take([1, 2, 3], 5);
|
||||
* // => [1, 2, 3]
|
||||
*
|
||||
* _.take([1, 2, 3], 0);
|
||||
* // => []
|
||||
*/
|
||||
function take(array, n, guard) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (guard ? isIterateeCall(array, n, guard) : n == null) {
|
||||
n = 1;
|
||||
}
|
||||
return baseSlice(array, 0, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
module.exports = take;
|
||||
40
node_modules/inquirer/node_modules/lodash/array/takeRight.js
generated
vendored
Normal file
40
node_modules/inquirer/node_modules/lodash/array/takeRight.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
var baseSlice = require('../internal/baseSlice'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with `n` elements taken from the end.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {number} [n=1] The number of elements to take.
|
||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.takeRight([1, 2, 3]);
|
||||
* // => [3]
|
||||
*
|
||||
* _.takeRight([1, 2, 3], 2);
|
||||
* // => [2, 3]
|
||||
*
|
||||
* _.takeRight([1, 2, 3], 5);
|
||||
* // => [1, 2, 3]
|
||||
*
|
||||
* _.takeRight([1, 2, 3], 0);
|
||||
* // => []
|
||||
*/
|
||||
function takeRight(array, n, guard) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (guard ? isIterateeCall(array, n, guard) : n == null) {
|
||||
n = 1;
|
||||
}
|
||||
n = length - (+n || 0);
|
||||
return baseSlice(array, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
module.exports = takeRight;
|
||||
59
node_modules/inquirer/node_modules/lodash/array/takeRightWhile.js
generated
vendored
Normal file
59
node_modules/inquirer/node_modules/lodash/array/takeRightWhile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
baseWhile = require('../internal/baseWhile');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with elements taken from the end. Elements are
|
||||
* taken until `predicate` returns falsey. The predicate is bound to `thisArg`
|
||||
* and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.takeRightWhile([1, 2, 3], function(n) {
|
||||
* return n > 1;
|
||||
* });
|
||||
* // => [2, 3]
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': true },
|
||||
* { 'user': 'fred', 'active': false },
|
||||
* { 'user': 'pebbles', 'active': false }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
|
||||
* // => ['pebbles']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.pluck(_.takeRightWhile(users, 'active', false), 'user');
|
||||
* // => ['fred', 'pebbles']
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.pluck(_.takeRightWhile(users, 'active'), 'user');
|
||||
* // => []
|
||||
*/
|
||||
function takeRightWhile(array, predicate, thisArg) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseCallback(predicate, thisArg, 3), false, true)
|
||||
: [];
|
||||
}
|
||||
|
||||
module.exports = takeRightWhile;
|
||||
59
node_modules/inquirer/node_modules/lodash/array/takeWhile.js
generated
vendored
Normal file
59
node_modules/inquirer/node_modules/lodash/array/takeWhile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
baseWhile = require('../internal/baseWhile');
|
||||
|
||||
/**
|
||||
* Creates a slice of `array` with elements taken from the beginning. Elements
|
||||
* are taken until `predicate` returns falsey. The predicate is bound to
|
||||
* `thisArg` and invoked with three arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to query.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the slice of `array`.
|
||||
* @example
|
||||
*
|
||||
* _.takeWhile([1, 2, 3], function(n) {
|
||||
* return n < 3;
|
||||
* });
|
||||
* // => [1, 2]
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false},
|
||||
* { 'user': 'pebbles', 'active': true }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
|
||||
* // => ['barney']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.pluck(_.takeWhile(users, 'active', false), 'user');
|
||||
* // => ['barney', 'fred']
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.pluck(_.takeWhile(users, 'active'), 'user');
|
||||
* // => []
|
||||
*/
|
||||
function takeWhile(array, predicate, thisArg) {
|
||||
return (array && array.length)
|
||||
? baseWhile(array, baseCallback(predicate, thisArg, 3))
|
||||
: [];
|
||||
}
|
||||
|
||||
module.exports = takeWhile;
|
||||
24
node_modules/inquirer/node_modules/lodash/array/union.js
generated
vendored
Normal file
24
node_modules/inquirer/node_modules/lodash/array/union.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
var baseFlatten = require('../internal/baseFlatten'),
|
||||
baseUniq = require('../internal/baseUniq'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, from all of the provided arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to inspect.
|
||||
* @returns {Array} Returns the new array of combined values.
|
||||
* @example
|
||||
*
|
||||
* _.union([1, 2], [4, 2], [2, 1]);
|
||||
* // => [1, 2, 4]
|
||||
*/
|
||||
var union = restParam(function(arrays) {
|
||||
return baseUniq(baseFlatten(arrays, false, true));
|
||||
});
|
||||
|
||||
module.exports = union;
|
||||
71
node_modules/inquirer/node_modules/lodash/array/uniq.js
generated
vendored
Normal file
71
node_modules/inquirer/node_modules/lodash/array/uniq.js
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
var baseCallback = require('../internal/baseCallback'),
|
||||
baseUniq = require('../internal/baseUniq'),
|
||||
isIterateeCall = require('../internal/isIterateeCall'),
|
||||
sortedUniq = require('../internal/sortedUniq');
|
||||
|
||||
/**
|
||||
* Creates a duplicate-free version of an array, using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons, in which only the first occurence of each element
|
||||
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
|
||||
* for sorted arrays. If an iteratee function is provided it's invoked for
|
||||
* each element in the array to generate the criterion by which uniqueness
|
||||
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
|
||||
* arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `iteratee` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `iteratee` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias unique
|
||||
* @category Array
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {boolean} [isSorted] Specify the array is sorted.
|
||||
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {Array} Returns the new duplicate-value-free array.
|
||||
* @example
|
||||
*
|
||||
* _.uniq([2, 1, 2]);
|
||||
* // => [2, 1]
|
||||
*
|
||||
* // using `isSorted`
|
||||
* _.uniq([1, 1, 2], true);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* // using an iteratee function
|
||||
* _.uniq([1, 2.5, 1.5, 2], function(n) {
|
||||
* return this.floor(n);
|
||||
* }, Math);
|
||||
* // => [1, 2.5]
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
||||
* // => [{ 'x': 1 }, { 'x': 2 }]
|
||||
*/
|
||||
function uniq(array, isSorted, iteratee, thisArg) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (isSorted != null && typeof isSorted != 'boolean') {
|
||||
thisArg = iteratee;
|
||||
iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
|
||||
isSorted = false;
|
||||
}
|
||||
iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3);
|
||||
return (isSorted)
|
||||
? sortedUniq(array, iteratee)
|
||||
: baseUniq(array, iteratee);
|
||||
}
|
||||
|
||||
module.exports = uniq;
|
||||
1
node_modules/inquirer/node_modules/lodash/array/unique.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/array/unique.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./uniq');
|
||||
47
node_modules/inquirer/node_modules/lodash/array/unzip.js
generated
vendored
Normal file
47
node_modules/inquirer/node_modules/lodash/array/unzip.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
var arrayFilter = require('../internal/arrayFilter'),
|
||||
arrayMap = require('../internal/arrayMap'),
|
||||
baseProperty = require('../internal/baseProperty'),
|
||||
isArrayLike = require('../internal/isArrayLike');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* This method is like `_.zip` except that it accepts an array of grouped
|
||||
* elements and creates an array regrouping the elements to their pre-zip
|
||||
* configuration.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array of grouped elements to process.
|
||||
* @returns {Array} Returns the new array of regrouped elements.
|
||||
* @example
|
||||
*
|
||||
* var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
|
||||
* // => [['fred', 30, true], ['barney', 40, false]]
|
||||
*
|
||||
* _.unzip(zipped);
|
||||
* // => [['fred', 'barney'], [30, 40], [true, false]]
|
||||
*/
|
||||
function unzip(array) {
|
||||
if (!(array && array.length)) {
|
||||
return [];
|
||||
}
|
||||
var index = -1,
|
||||
length = 0;
|
||||
|
||||
array = arrayFilter(array, function(group) {
|
||||
if (isArrayLike(group)) {
|
||||
length = nativeMax(group.length, length);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var result = Array(length);
|
||||
while (++index < length) {
|
||||
result[index] = arrayMap(array, baseProperty(index));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = unzip;
|
||||
41
node_modules/inquirer/node_modules/lodash/array/unzipWith.js
generated
vendored
Normal file
41
node_modules/inquirer/node_modules/lodash/array/unzipWith.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
var arrayMap = require('../internal/arrayMap'),
|
||||
arrayReduce = require('../internal/arrayReduce'),
|
||||
bindCallback = require('../internal/bindCallback'),
|
||||
unzip = require('./unzip');
|
||||
|
||||
/**
|
||||
* This method is like `_.unzip` except that it accepts an iteratee to specify
|
||||
* how regrouped values should be combined. The `iteratee` is bound to `thisArg`
|
||||
* and invoked with four arguments: (accumulator, value, index, group).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array of grouped elements to process.
|
||||
* @param {Function} [iteratee] The function to combine regrouped values.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {Array} Returns the new array of regrouped elements.
|
||||
* @example
|
||||
*
|
||||
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
|
||||
* // => [[1, 10, 100], [2, 20, 200]]
|
||||
*
|
||||
* _.unzipWith(zipped, _.add);
|
||||
* // => [3, 30, 300]
|
||||
*/
|
||||
function unzipWith(array, iteratee, thisArg) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
var result = unzip(array);
|
||||
if (iteratee == null) {
|
||||
return result;
|
||||
}
|
||||
iteratee = bindCallback(iteratee, thisArg, 4);
|
||||
return arrayMap(result, function(group) {
|
||||
return arrayReduce(group, iteratee, undefined, true);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = unzipWith;
|
||||
27
node_modules/inquirer/node_modules/lodash/array/without.js
generated
vendored
Normal file
27
node_modules/inquirer/node_modules/lodash/array/without.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
var baseDifference = require('../internal/baseDifference'),
|
||||
isArrayLike = require('../internal/isArrayLike'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array excluding all provided values using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array to filter.
|
||||
* @param {...*} [values] The values to exclude.
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* _.without([1, 2, 1, 3], 1, 2);
|
||||
* // => [3]
|
||||
*/
|
||||
var without = restParam(function(array, values) {
|
||||
return isArrayLike(array)
|
||||
? baseDifference(array, values)
|
||||
: [];
|
||||
});
|
||||
|
||||
module.exports = without;
|
||||
35
node_modules/inquirer/node_modules/lodash/array/xor.js
generated
vendored
Normal file
35
node_modules/inquirer/node_modules/lodash/array/xor.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
var arrayPush = require('../internal/arrayPush'),
|
||||
baseDifference = require('../internal/baseDifference'),
|
||||
baseUniq = require('../internal/baseUniq'),
|
||||
isArrayLike = require('../internal/isArrayLike');
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* of the provided arrays.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to inspect.
|
||||
* @returns {Array} Returns the new array of values.
|
||||
* @example
|
||||
*
|
||||
* _.xor([1, 2], [4, 2]);
|
||||
* // => [1, 4]
|
||||
*/
|
||||
function xor() {
|
||||
var index = -1,
|
||||
length = arguments.length;
|
||||
|
||||
while (++index < length) {
|
||||
var array = arguments[index];
|
||||
if (isArrayLike(array)) {
|
||||
var result = result
|
||||
? arrayPush(baseDifference(result, array), baseDifference(array, result))
|
||||
: array;
|
||||
}
|
||||
}
|
||||
return result ? baseUniq(result) : [];
|
||||
}
|
||||
|
||||
module.exports = xor;
|
||||
21
node_modules/inquirer/node_modules/lodash/array/zip.js
generated
vendored
Normal file
21
node_modules/inquirer/node_modules/lodash/array/zip.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
var restParam = require('../function/restParam'),
|
||||
unzip = require('./unzip');
|
||||
|
||||
/**
|
||||
* Creates an array of grouped elements, the first of which contains the first
|
||||
* elements of the given arrays, the second of which contains the second elements
|
||||
* of the given arrays, and so on.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to process.
|
||||
* @returns {Array} Returns the new array of grouped elements.
|
||||
* @example
|
||||
*
|
||||
* _.zip(['fred', 'barney'], [30, 40], [true, false]);
|
||||
* // => [['fred', 30, true], ['barney', 40, false]]
|
||||
*/
|
||||
var zip = restParam(unzip);
|
||||
|
||||
module.exports = zip;
|
||||
43
node_modules/inquirer/node_modules/lodash/array/zipObject.js
generated
vendored
Normal file
43
node_modules/inquirer/node_modules/lodash/array/zipObject.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
var isArray = require('../lang/isArray');
|
||||
|
||||
/**
|
||||
* The inverse of `_.pairs`; this method returns an object composed from arrays
|
||||
* of property names and values. Provide either a single two dimensional array,
|
||||
* e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
|
||||
* and one of corresponding values.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias object
|
||||
* @category Array
|
||||
* @param {Array} props The property names.
|
||||
* @param {Array} [values=[]] The property values.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* _.zipObject([['fred', 30], ['barney', 40]]);
|
||||
* // => { 'fred': 30, 'barney': 40 }
|
||||
*
|
||||
* _.zipObject(['fred', 'barney'], [30, 40]);
|
||||
* // => { 'fred': 30, 'barney': 40 }
|
||||
*/
|
||||
function zipObject(props, values) {
|
||||
var index = -1,
|
||||
length = props ? props.length : 0,
|
||||
result = {};
|
||||
|
||||
if (length && !values && !isArray(props[0])) {
|
||||
values = [];
|
||||
}
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
if (values) {
|
||||
result[key] = values[index];
|
||||
} else if (key) {
|
||||
result[key[0]] = key[1];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = zipObject;
|
||||
36
node_modules/inquirer/node_modules/lodash/array/zipWith.js
generated
vendored
Normal file
36
node_modules/inquirer/node_modules/lodash/array/zipWith.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
var restParam = require('../function/restParam'),
|
||||
unzipWith = require('./unzipWith');
|
||||
|
||||
/**
|
||||
* This method is like `_.zip` except that it accepts an iteratee to specify
|
||||
* how grouped values should be combined. The `iteratee` is bound to `thisArg`
|
||||
* and invoked with four arguments: (accumulator, value, index, group).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {...Array} [arrays] The arrays to process.
|
||||
* @param {Function} [iteratee] The function to combine grouped values.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {Array} Returns the new array of grouped elements.
|
||||
* @example
|
||||
*
|
||||
* _.zipWith([1, 2], [10, 20], [100, 200], _.add);
|
||||
* // => [111, 222]
|
||||
*/
|
||||
var zipWith = restParam(function(arrays) {
|
||||
var length = arrays.length,
|
||||
iteratee = length > 2 ? arrays[length - 2] : undefined,
|
||||
thisArg = length > 1 ? arrays[length - 1] : undefined;
|
||||
|
||||
if (length > 2 && typeof iteratee == 'function') {
|
||||
length -= 2;
|
||||
} else {
|
||||
iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
|
||||
thisArg = undefined;
|
||||
}
|
||||
arrays.length = length;
|
||||
return unzipWith(arrays, iteratee, thisArg);
|
||||
});
|
||||
|
||||
module.exports = zipWith;
|
||||
16
node_modules/inquirer/node_modules/lodash/chain.js
generated
vendored
Normal file
16
node_modules/inquirer/node_modules/lodash/chain.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
module.exports = {
|
||||
'chain': require('./chain/chain'),
|
||||
'commit': require('./chain/commit'),
|
||||
'concat': require('./chain/concat'),
|
||||
'lodash': require('./chain/lodash'),
|
||||
'plant': require('./chain/plant'),
|
||||
'reverse': require('./chain/reverse'),
|
||||
'run': require('./chain/run'),
|
||||
'tap': require('./chain/tap'),
|
||||
'thru': require('./chain/thru'),
|
||||
'toJSON': require('./chain/toJSON'),
|
||||
'toString': require('./chain/toString'),
|
||||
'value': require('./chain/value'),
|
||||
'valueOf': require('./chain/valueOf'),
|
||||
'wrapperChain': require('./chain/wrapperChain')
|
||||
};
|
||||
35
node_modules/inquirer/node_modules/lodash/chain/chain.js
generated
vendored
Normal file
35
node_modules/inquirer/node_modules/lodash/chain/chain.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
var lodash = require('./lodash');
|
||||
|
||||
/**
|
||||
* Creates a `lodash` object that wraps `value` with explicit method
|
||||
* chaining enabled.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @param {*} value The value to wrap.
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'age': 36 },
|
||||
* { 'user': 'fred', 'age': 40 },
|
||||
* { 'user': 'pebbles', 'age': 1 }
|
||||
* ];
|
||||
*
|
||||
* var youngest = _.chain(users)
|
||||
* .sortBy('age')
|
||||
* .map(function(chr) {
|
||||
* return chr.user + ' is ' + chr.age;
|
||||
* })
|
||||
* .first()
|
||||
* .value();
|
||||
* // => 'pebbles is 1'
|
||||
*/
|
||||
function chain(value) {
|
||||
var result = lodash(value);
|
||||
result.__chain__ = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = chain;
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/commit.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/commit.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperCommit');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/concat.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/concat.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperConcat');
|
||||
125
node_modules/inquirer/node_modules/lodash/chain/lodash.js
generated
vendored
Normal file
125
node_modules/inquirer/node_modules/lodash/chain/lodash.js
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
var LazyWrapper = require('../internal/LazyWrapper'),
|
||||
LodashWrapper = require('../internal/LodashWrapper'),
|
||||
baseLodash = require('../internal/baseLodash'),
|
||||
isArray = require('../lang/isArray'),
|
||||
isObjectLike = require('../internal/isObjectLike'),
|
||||
wrapperClone = require('../internal/wrapperClone');
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates a `lodash` object which wraps `value` to enable implicit chaining.
|
||||
* Methods that operate on and return arrays, collections, and functions can
|
||||
* be chained together. Methods that retrieve a single value or may return a
|
||||
* primitive value will automatically end the chain returning the unwrapped
|
||||
* value. Explicit chaining may be enabled using `_.chain`. The execution of
|
||||
* chained methods is lazy, that is, execution is deferred until `_#value`
|
||||
* is implicitly or explicitly called.
|
||||
*
|
||||
* Lazy evaluation allows several methods to support shortcut fusion. Shortcut
|
||||
* fusion is an optimization strategy which merge iteratee calls; this can help
|
||||
* to avoid the creation of intermediate data structures and greatly reduce the
|
||||
* number of iteratee executions.
|
||||
*
|
||||
* Chaining is supported in custom builds as long as the `_#value` method is
|
||||
* directly or indirectly included in the build.
|
||||
*
|
||||
* In addition to lodash methods, wrappers have `Array` and `String` methods.
|
||||
*
|
||||
* The wrapper `Array` methods are:
|
||||
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
|
||||
* `splice`, and `unshift`
|
||||
*
|
||||
* The wrapper `String` methods are:
|
||||
* `replace` and `split`
|
||||
*
|
||||
* The wrapper methods that support shortcut fusion are:
|
||||
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
|
||||
* `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
|
||||
* `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
|
||||
* and `where`
|
||||
*
|
||||
* The chainable wrapper methods are:
|
||||
* `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
|
||||
* `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
|
||||
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
|
||||
* `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
|
||||
* `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
|
||||
* `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
|
||||
* `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
|
||||
* `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
|
||||
* `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
|
||||
* `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
|
||||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
|
||||
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
|
||||
* `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
|
||||
* `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
|
||||
* `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
|
||||
* `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
|
||||
* `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
|
||||
*
|
||||
* The wrapper methods that are **not** chainable by default are:
|
||||
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
|
||||
* `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
|
||||
* `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
|
||||
* `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
|
||||
* `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
|
||||
* `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
|
||||
* `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
|
||||
* `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
|
||||
* `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
|
||||
* `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
|
||||
* `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
|
||||
* `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
|
||||
* `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
|
||||
* `unescape`, `uniqueId`, `value`, and `words`
|
||||
*
|
||||
* The wrapper method `sample` will return a wrapped value when `n` is provided,
|
||||
* otherwise an unwrapped value is returned.
|
||||
*
|
||||
* @name _
|
||||
* @constructor
|
||||
* @category Chain
|
||||
* @param {*} value The value to wrap in a `lodash` instance.
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var wrapped = _([1, 2, 3]);
|
||||
*
|
||||
* // returns an unwrapped value
|
||||
* wrapped.reduce(function(total, n) {
|
||||
* return total + n;
|
||||
* });
|
||||
* // => 6
|
||||
*
|
||||
* // returns a wrapped value
|
||||
* var squares = wrapped.map(function(n) {
|
||||
* return n * n;
|
||||
* });
|
||||
*
|
||||
* _.isArray(squares);
|
||||
* // => false
|
||||
*
|
||||
* _.isArray(squares.value());
|
||||
* // => true
|
||||
*/
|
||||
function lodash(value) {
|
||||
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
||||
if (value instanceof LodashWrapper) {
|
||||
return value;
|
||||
}
|
||||
if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
|
||||
return wrapperClone(value);
|
||||
}
|
||||
}
|
||||
return new LodashWrapper(value);
|
||||
}
|
||||
|
||||
// Ensure wrappers are instances of `baseLodash`.
|
||||
lodash.prototype = baseLodash.prototype;
|
||||
|
||||
module.exports = lodash;
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/plant.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/plant.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperPlant');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/reverse.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/reverse.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperReverse');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/run.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/run.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperValue');
|
||||
29
node_modules/inquirer/node_modules/lodash/chain/tap.js
generated
vendored
Normal file
29
node_modules/inquirer/node_modules/lodash/chain/tap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This method invokes `interceptor` and returns `value`. The interceptor is
|
||||
* bound to `thisArg` and invoked with one argument; (value). The purpose of
|
||||
* this method is to "tap into" a method chain in order to perform operations
|
||||
* on intermediate results within the chain.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @param {*} value The value to provide to `interceptor`.
|
||||
* @param {Function} interceptor The function to invoke.
|
||||
* @param {*} [thisArg] The `this` binding of `interceptor`.
|
||||
* @returns {*} Returns `value`.
|
||||
* @example
|
||||
*
|
||||
* _([1, 2, 3])
|
||||
* .tap(function(array) {
|
||||
* array.pop();
|
||||
* })
|
||||
* .reverse()
|
||||
* .value();
|
||||
* // => [2, 1]
|
||||
*/
|
||||
function tap(value, interceptor, thisArg) {
|
||||
interceptor.call(thisArg, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = tap;
|
||||
26
node_modules/inquirer/node_modules/lodash/chain/thru.js
generated
vendored
Normal file
26
node_modules/inquirer/node_modules/lodash/chain/thru.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* This method is like `_.tap` except that it returns the result of `interceptor`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @param {*} value The value to provide to `interceptor`.
|
||||
* @param {Function} interceptor The function to invoke.
|
||||
* @param {*} [thisArg] The `this` binding of `interceptor`.
|
||||
* @returns {*} Returns the result of `interceptor`.
|
||||
* @example
|
||||
*
|
||||
* _(' abc ')
|
||||
* .chain()
|
||||
* .trim()
|
||||
* .thru(function(value) {
|
||||
* return [value];
|
||||
* })
|
||||
* .value();
|
||||
* // => ['abc']
|
||||
*/
|
||||
function thru(value, interceptor, thisArg) {
|
||||
return interceptor.call(thisArg, value);
|
||||
}
|
||||
|
||||
module.exports = thru;
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/toJSON.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/toJSON.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperValue');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/toString.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/toString.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperToString');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/value.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/value.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperValue');
|
||||
1
node_modules/inquirer/node_modules/lodash/chain/valueOf.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/chain/valueOf.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./wrapperValue');
|
||||
32
node_modules/inquirer/node_modules/lodash/chain/wrapperChain.js
generated
vendored
Normal file
32
node_modules/inquirer/node_modules/lodash/chain/wrapperChain.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var chain = require('./chain');
|
||||
|
||||
/**
|
||||
* Enables explicit method chaining on the wrapper object.
|
||||
*
|
||||
* @name chain
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'age': 36 },
|
||||
* { 'user': 'fred', 'age': 40 }
|
||||
* ];
|
||||
*
|
||||
* // without explicit chaining
|
||||
* _(users).first();
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*
|
||||
* // with explicit chaining
|
||||
* _(users).chain()
|
||||
* .first()
|
||||
* .pick('user')
|
||||
* .value();
|
||||
* // => { 'user': 'barney' }
|
||||
*/
|
||||
function wrapperChain() {
|
||||
return chain(this);
|
||||
}
|
||||
|
||||
module.exports = wrapperChain;
|
||||
32
node_modules/inquirer/node_modules/lodash/chain/wrapperCommit.js
generated
vendored
Normal file
32
node_modules/inquirer/node_modules/lodash/chain/wrapperCommit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var LodashWrapper = require('../internal/LodashWrapper');
|
||||
|
||||
/**
|
||||
* Executes the chained sequence and returns the wrapped result.
|
||||
*
|
||||
* @name commit
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2];
|
||||
* var wrapped = _(array).push(3);
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* wrapped = wrapped.commit();
|
||||
* console.log(array);
|
||||
* // => [1, 2, 3]
|
||||
*
|
||||
* wrapped.last();
|
||||
* // => 3
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function wrapperCommit() {
|
||||
return new LodashWrapper(this.value(), this.__chain__);
|
||||
}
|
||||
|
||||
module.exports = wrapperCommit;
|
||||
34
node_modules/inquirer/node_modules/lodash/chain/wrapperConcat.js
generated
vendored
Normal file
34
node_modules/inquirer/node_modules/lodash/chain/wrapperConcat.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
var arrayConcat = require('../internal/arrayConcat'),
|
||||
baseFlatten = require('../internal/baseFlatten'),
|
||||
isArray = require('../lang/isArray'),
|
||||
restParam = require('../function/restParam'),
|
||||
toObject = require('../internal/toObject');
|
||||
|
||||
/**
|
||||
* Creates a new array joining a wrapped array with any additional arrays
|
||||
* and/or values.
|
||||
*
|
||||
* @name concat
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @param {...*} [values] The values to concatenate.
|
||||
* @returns {Array} Returns the new concatenated array.
|
||||
* @example
|
||||
*
|
||||
* var array = [1];
|
||||
* var wrapped = _(array).concat(2, [3], [[4]]);
|
||||
*
|
||||
* console.log(wrapped.value());
|
||||
* // => [1, 2, 3, [4]]
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [1]
|
||||
*/
|
||||
var wrapperConcat = restParam(function(values) {
|
||||
values = baseFlatten(values);
|
||||
return this.thru(function(array) {
|
||||
return arrayConcat(isArray(array) ? array : [toObject(array)], values);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = wrapperConcat;
|
||||
45
node_modules/inquirer/node_modules/lodash/chain/wrapperPlant.js
generated
vendored
Normal file
45
node_modules/inquirer/node_modules/lodash/chain/wrapperPlant.js
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
var baseLodash = require('../internal/baseLodash'),
|
||||
wrapperClone = require('../internal/wrapperClone');
|
||||
|
||||
/**
|
||||
* Creates a clone of the chained sequence planting `value` as the wrapped value.
|
||||
*
|
||||
* @name plant
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2];
|
||||
* var wrapped = _(array).map(function(value) {
|
||||
* return Math.pow(value, 2);
|
||||
* });
|
||||
*
|
||||
* var other = [3, 4];
|
||||
* var otherWrapped = wrapped.plant(other);
|
||||
*
|
||||
* otherWrapped.value();
|
||||
* // => [9, 16]
|
||||
*
|
||||
* wrapped.value();
|
||||
* // => [1, 4]
|
||||
*/
|
||||
function wrapperPlant(value) {
|
||||
var result,
|
||||
parent = this;
|
||||
|
||||
while (parent instanceof baseLodash) {
|
||||
var clone = wrapperClone(parent);
|
||||
if (result) {
|
||||
previous.__wrapped__ = clone;
|
||||
} else {
|
||||
result = clone;
|
||||
}
|
||||
var previous = clone;
|
||||
parent = parent.__wrapped__;
|
||||
}
|
||||
previous.__wrapped__ = value;
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = wrapperPlant;
|
||||
43
node_modules/inquirer/node_modules/lodash/chain/wrapperReverse.js
generated
vendored
Normal file
43
node_modules/inquirer/node_modules/lodash/chain/wrapperReverse.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
var LazyWrapper = require('../internal/LazyWrapper'),
|
||||
LodashWrapper = require('../internal/LodashWrapper'),
|
||||
thru = require('./thru');
|
||||
|
||||
/**
|
||||
* Reverses the wrapped array so the first element becomes the last, the
|
||||
* second element becomes the second to last, and so on.
|
||||
*
|
||||
* **Note:** This method mutates the wrapped array.
|
||||
*
|
||||
* @name reverse
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @returns {Object} Returns the new reversed `lodash` wrapper instance.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3];
|
||||
*
|
||||
* _(array).reverse().value()
|
||||
* // => [3, 2, 1]
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [3, 2, 1]
|
||||
*/
|
||||
function wrapperReverse() {
|
||||
var value = this.__wrapped__;
|
||||
|
||||
var interceptor = function(value) {
|
||||
return value.reverse();
|
||||
};
|
||||
if (value instanceof LazyWrapper) {
|
||||
var wrapped = value;
|
||||
if (this.__actions__.length) {
|
||||
wrapped = new LazyWrapper(this);
|
||||
}
|
||||
wrapped = wrapped.reverse();
|
||||
wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
|
||||
return new LodashWrapper(wrapped, this.__chain__);
|
||||
}
|
||||
return this.thru(interceptor);
|
||||
}
|
||||
|
||||
module.exports = wrapperReverse;
|
||||
17
node_modules/inquirer/node_modules/lodash/chain/wrapperToString.js
generated
vendored
Normal file
17
node_modules/inquirer/node_modules/lodash/chain/wrapperToString.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Produces the result of coercing the unwrapped value to a string.
|
||||
*
|
||||
* @name toString
|
||||
* @memberOf _
|
||||
* @category Chain
|
||||
* @returns {string} Returns the coerced string value.
|
||||
* @example
|
||||
*
|
||||
* _([1, 2, 3]).toString();
|
||||
* // => '1,2,3'
|
||||
*/
|
||||
function wrapperToString() {
|
||||
return (this.value() + '');
|
||||
}
|
||||
|
||||
module.exports = wrapperToString;
|
||||
20
node_modules/inquirer/node_modules/lodash/chain/wrapperValue.js
generated
vendored
Normal file
20
node_modules/inquirer/node_modules/lodash/chain/wrapperValue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
var baseWrapperValue = require('../internal/baseWrapperValue');
|
||||
|
||||
/**
|
||||
* Executes the chained sequence to extract the unwrapped value.
|
||||
*
|
||||
* @name value
|
||||
* @memberOf _
|
||||
* @alias run, toJSON, valueOf
|
||||
* @category Chain
|
||||
* @returns {*} Returns the resolved unwrapped value.
|
||||
* @example
|
||||
*
|
||||
* _([1, 2, 3]).value();
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function wrapperValue() {
|
||||
return baseWrapperValue(this.__wrapped__, this.__actions__);
|
||||
}
|
||||
|
||||
module.exports = wrapperValue;
|
||||
44
node_modules/inquirer/node_modules/lodash/collection.js
generated
vendored
Normal file
44
node_modules/inquirer/node_modules/lodash/collection.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
module.exports = {
|
||||
'all': require('./collection/all'),
|
||||
'any': require('./collection/any'),
|
||||
'at': require('./collection/at'),
|
||||
'collect': require('./collection/collect'),
|
||||
'contains': require('./collection/contains'),
|
||||
'countBy': require('./collection/countBy'),
|
||||
'detect': require('./collection/detect'),
|
||||
'each': require('./collection/each'),
|
||||
'eachRight': require('./collection/eachRight'),
|
||||
'every': require('./collection/every'),
|
||||
'filter': require('./collection/filter'),
|
||||
'find': require('./collection/find'),
|
||||
'findLast': require('./collection/findLast'),
|
||||
'findWhere': require('./collection/findWhere'),
|
||||
'foldl': require('./collection/foldl'),
|
||||
'foldr': require('./collection/foldr'),
|
||||
'forEach': require('./collection/forEach'),
|
||||
'forEachRight': require('./collection/forEachRight'),
|
||||
'groupBy': require('./collection/groupBy'),
|
||||
'include': require('./collection/include'),
|
||||
'includes': require('./collection/includes'),
|
||||
'indexBy': require('./collection/indexBy'),
|
||||
'inject': require('./collection/inject'),
|
||||
'invoke': require('./collection/invoke'),
|
||||
'map': require('./collection/map'),
|
||||
'max': require('./math/max'),
|
||||
'min': require('./math/min'),
|
||||
'partition': require('./collection/partition'),
|
||||
'pluck': require('./collection/pluck'),
|
||||
'reduce': require('./collection/reduce'),
|
||||
'reduceRight': require('./collection/reduceRight'),
|
||||
'reject': require('./collection/reject'),
|
||||
'sample': require('./collection/sample'),
|
||||
'select': require('./collection/select'),
|
||||
'shuffle': require('./collection/shuffle'),
|
||||
'size': require('./collection/size'),
|
||||
'some': require('./collection/some'),
|
||||
'sortBy': require('./collection/sortBy'),
|
||||
'sortByAll': require('./collection/sortByAll'),
|
||||
'sortByOrder': require('./collection/sortByOrder'),
|
||||
'sum': require('./math/sum'),
|
||||
'where': require('./collection/where')
|
||||
};
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/all.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/all.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./every');
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/any.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/any.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./some');
|
||||
29
node_modules/inquirer/node_modules/lodash/collection/at.js
generated
vendored
Normal file
29
node_modules/inquirer/node_modules/lodash/collection/at.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
var baseAt = require('../internal/baseAt'),
|
||||
baseFlatten = require('../internal/baseFlatten'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of elements corresponding to the given keys, or indexes,
|
||||
* of `collection`. Keys may be specified as individual arguments or as arrays
|
||||
* of keys.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {...(number|number[]|string|string[])} [props] The property names
|
||||
* or indexes of elements to pick, specified individually or in arrays.
|
||||
* @returns {Array} Returns the new array of picked elements.
|
||||
* @example
|
||||
*
|
||||
* _.at(['a', 'b', 'c'], [0, 2]);
|
||||
* // => ['a', 'c']
|
||||
*
|
||||
* _.at(['barney', 'fred', 'pebbles'], 0, 2);
|
||||
* // => ['barney', 'pebbles']
|
||||
*/
|
||||
var at = restParam(function(collection, props) {
|
||||
return baseAt(collection, baseFlatten(props));
|
||||
});
|
||||
|
||||
module.exports = at;
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/collect.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/collect.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./map');
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/contains.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/contains.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./includes');
|
||||
54
node_modules/inquirer/node_modules/lodash/collection/countBy.js
generated
vendored
Normal file
54
node_modules/inquirer/node_modules/lodash/collection/countBy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
var createAggregator = require('../internal/createAggregator');
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
* each element of `collection` through `iteratee`. The corresponding value
|
||||
* of each key is the number of times the key was returned by `iteratee`.
|
||||
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, index|key, collection).
|
||||
*
|
||||
* If a property name is provided for `iteratee` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `iteratee` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
||||
* @returns {Object} Returns the composed aggregate object.
|
||||
* @example
|
||||
*
|
||||
* _.countBy([4.3, 6.1, 6.4], function(n) {
|
||||
* return Math.floor(n);
|
||||
* });
|
||||
* // => { '4': 1, '6': 2 }
|
||||
*
|
||||
* _.countBy([4.3, 6.1, 6.4], function(n) {
|
||||
* return this.floor(n);
|
||||
* }, Math);
|
||||
* // => { '4': 1, '6': 2 }
|
||||
*
|
||||
* _.countBy(['one', 'two', 'three'], 'length');
|
||||
* // => { '3': 2, '5': 1 }
|
||||
*/
|
||||
var countBy = createAggregator(function(result, value, key) {
|
||||
hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
|
||||
});
|
||||
|
||||
module.exports = countBy;
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/detect.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/detect.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./find');
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/each.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/each.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./forEach');
|
||||
1
node_modules/inquirer/node_modules/lodash/collection/eachRight.js
generated
vendored
Normal file
1
node_modules/inquirer/node_modules/lodash/collection/eachRight.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('./forEachRight');
|
||||
66
node_modules/inquirer/node_modules/lodash/collection/every.js
generated
vendored
Normal file
66
node_modules/inquirer/node_modules/lodash/collection/every.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
var arrayEvery = require('../internal/arrayEvery'),
|
||||
baseCallback = require('../internal/baseCallback'),
|
||||
baseEvery = require('../internal/baseEvery'),
|
||||
isArray = require('../lang/isArray'),
|
||||
isIterateeCall = require('../internal/isIterateeCall');
|
||||
|
||||
/**
|
||||
* Checks if `predicate` returns truthy for **all** elements of `collection`.
|
||||
* The predicate is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, index|key, collection).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias all
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.every([true, 1, null, 'yes'], Boolean);
|
||||
* // => false
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'active': false },
|
||||
* { 'user': 'fred', 'active': false }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.every(users, { 'user': 'barney', 'active': false });
|
||||
* // => false
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.every(users, 'active', false);
|
||||
* // => true
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.every(users, 'active');
|
||||
* // => false
|
||||
*/
|
||||
function every(collection, predicate, thisArg) {
|
||||
var func = isArray(collection) ? arrayEvery : baseEvery;
|
||||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
|
||||
predicate = undefined;
|
||||
}
|
||||
if (typeof predicate != 'function' || thisArg !== undefined) {
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
}
|
||||
return func(collection, predicate);
|
||||
}
|
||||
|
||||
module.exports = every;
|
||||
61
node_modules/inquirer/node_modules/lodash/collection/filter.js
generated
vendored
Normal file
61
node_modules/inquirer/node_modules/lodash/collection/filter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
var arrayFilter = require('../internal/arrayFilter'),
|
||||
baseCallback = require('../internal/baseCallback'),
|
||||
baseFilter = require('../internal/baseFilter'),
|
||||
isArray = require('../lang/isArray');
|
||||
|
||||
/**
|
||||
* Iterates over elements of `collection`, returning an array of all elements
|
||||
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
|
||||
* invoked with three arguments: (value, index|key, collection).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias select
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to iterate over.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {Array} Returns the new filtered array.
|
||||
* @example
|
||||
*
|
||||
* _.filter([4, 5, 6], function(n) {
|
||||
* return n % 2 == 0;
|
||||
* });
|
||||
* // => [4, 6]
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'age': 36, 'active': true },
|
||||
* { 'user': 'fred', 'age': 40, 'active': false }
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
|
||||
* // => ['barney']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.pluck(_.filter(users, 'active', false), 'user');
|
||||
* // => ['fred']
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.pluck(_.filter(users, 'active'), 'user');
|
||||
* // => ['barney']
|
||||
*/
|
||||
function filter(collection, predicate, thisArg) {
|
||||
var func = isArray(collection) ? arrayFilter : baseFilter;
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return func(collection, predicate);
|
||||
}
|
||||
|
||||
module.exports = filter;
|
||||
56
node_modules/inquirer/node_modules/lodash/collection/find.js
generated
vendored
Normal file
56
node_modules/inquirer/node_modules/lodash/collection/find.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
var baseEach = require('../internal/baseEach'),
|
||||
createFind = require('../internal/createFind');
|
||||
|
||||
/**
|
||||
* Iterates over elements of `collection`, returning the first element
|
||||
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
|
||||
* invoked with three arguments: (value, index|key, collection).
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
*
|
||||
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
||||
* style callback returns `true` for elements that have a matching property
|
||||
* value, else `false`.
|
||||
*
|
||||
* If an object is provided for `predicate` the created `_.matches` style
|
||||
* callback returns `true` for elements that have the properties of the given
|
||||
* object, else `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias detect
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to search.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked
|
||||
* per iteration.
|
||||
* @param {*} [thisArg] The `this` binding of `predicate`.
|
||||
* @returns {*} Returns the matched element, else `undefined`.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney', 'age': 36, 'active': true },
|
||||
* { 'user': 'fred', 'age': 40, 'active': false },
|
||||
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
||||
* ];
|
||||
*
|
||||
* _.result(_.find(users, function(chr) {
|
||||
* return chr.age < 40;
|
||||
* }), 'user');
|
||||
* // => 'barney'
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
|
||||
* // => 'pebbles'
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.result(_.find(users, 'active', false), 'user');
|
||||
* // => 'fred'
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.result(_.find(users, 'active'), 'user');
|
||||
* // => 'barney'
|
||||
*/
|
||||
var find = createFind(baseEach);
|
||||
|
||||
module.exports = find;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue