Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only import used lodash methods #923

Merged
merged 2 commits into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const _ = require('lodash');
const _ = {
isFunction: require('lodash/isFunction'),
noop: require('lodash/noop')
};
const readline = require('readline');
const chalk = require('chalk');
const MuteStream = require('mute-stream');
Expand Down
4 changes: 3 additions & 1 deletion packages/core/lib/Paginator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

const _ = require('lodash');
const _ = {
flatten: require('lodash/flatten')
};
const chalk = require('chalk');
const cliWidth = require('cli-width');
const { breakLines } = require('./utils');
Expand Down
4 changes: 3 additions & 1 deletion packages/core/lib/screen-manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const _ = require('lodash');
const _ = {
last: require('lodash/last')
};
const cliWidth = require('cli-width');
const stripAnsi = require('strip-ansi');
const stringWidth = require('string-width');
Expand Down
4 changes: 3 additions & 1 deletion packages/core/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const _ = require('lodash');
const _ = {
flatten: require('lodash/flatten')
};

/**
* Force line returns at specific width. This function is ANSI code friendly and it'll
Expand Down
7 changes: 6 additions & 1 deletion packages/inquirer/lib/objects/choice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';
var _ = require('lodash');
var _ = {
isString: require('lodash/isString'),
isNumber: require('lodash/isNumber'),
extend: require('lodash/extend'),
isFunction: require('lodash/isFunction')
};

/**
* Choice object
Expand Down
7 changes: 6 additions & 1 deletion packages/inquirer/lib/objects/choices.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';
var assert = require('assert');
var _ = require('lodash');
var _ = {
isNumber: require('lodash/isNumber'),
filter: require('lodash/filter'),
map: require('lodash/map'),
find: require('lodash/find')
};
var Separator = require('./separator');
var Choice = require('./choice');

Expand Down
7 changes: 5 additions & 2 deletions packages/inquirer/lib/prompts/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
* Base prompt implementation
* Should be extended by prompt types.
*/

var _ = require('lodash');
var _ = {
assign: require('lodash/assign'),
defaults: require('lodash/defaults'),
clone: require('lodash/clone')
};
var chalk = require('chalk');
var runAsync = require('run-async');
var { filter, flatMap, share, take, takeUntil } = require('rxjs/operators');
Expand Down
6 changes: 5 additions & 1 deletion packages/inquirer/lib/prompts/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* `list` type prompt
*/

var _ = require('lodash');
var _ = {
isArray: require('lodash/isArray'),
map: require('lodash/map'),
isString: require('lodash/isString')
};
var chalk = require('chalk');
var cliCursor = require('cli-cursor');
var figures = require('figures');
Expand Down
5 changes: 4 additions & 1 deletion packages/inquirer/lib/prompts/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
* `confirm` type prompt
*/

var _ = require('lodash');
var _ = {
extend: require('lodash/extend'),
isBoolean: require('lodash/isBoolean')
};
var chalk = require('chalk');
var { take, takeUntil } = require('rxjs/operators');
var Base = require('./base');
Expand Down
7 changes: 6 additions & 1 deletion packages/inquirer/lib/prompts/expand.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
* `rawlist` type prompt
*/

var _ = require('lodash');
var _ = {
uniq: require('lodash/uniq'),
isString: require('lodash/isString'),
isNumber: require('lodash/isNumber'),
findIndex: require('lodash/findIndex')
};
var chalk = require('chalk');
var { map, takeUntil } = require('rxjs/operators');
var Base = require('./base');
Expand Down
6 changes: 5 additions & 1 deletion packages/inquirer/lib/prompts/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* `list` type prompt
*/

var _ = require('lodash');
var _ = {
isNumber: require('lodash/isNumber'),
findIndex: require('lodash/findIndex'),
isString: require('lodash/isString')
};
var chalk = require('chalk');
var figures = require('figures');
var cliCursor = require('cli-cursor');
Expand Down
6 changes: 5 additions & 1 deletion packages/inquirer/lib/prompts/rawlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* `rawlist` type prompt
*/

var _ = require('lodash');
var _ = {
extend: require('lodash/extend'),
isNumber: require('lodash/isNumber'),
findIndex: require('lodash/findIndex')
};
var chalk = require('chalk');
var { map, takeUntil } = require('rxjs/operators');
var Base = require('./base');
Expand Down
5 changes: 4 additions & 1 deletion packages/inquirer/lib/ui/baseUI.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict';
var _ = require('lodash');
var _ = {
extend: require('lodash/extend'),
omit: require('lodash/omit')
};
var MuteStream = require('mute-stream');
var readline = require('readline');

Expand Down
4 changes: 3 additions & 1 deletion packages/inquirer/lib/ui/bottom-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
var through = require('through');
var Base = require('./baseUI');
var rlUtils = require('../utils/readline');
var _ = require('lodash');
var _ = {
last: require('lodash/last')
};

class BottomBar extends Base {
constructor(opt) {
Expand Down
8 changes: 7 additions & 1 deletion packages/inquirer/lib/ui/prompt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
'use strict';
var _ = require('lodash');
var _ = {
isPlainObject: require('lodash/isPlainObject'),
clone: require('lodash/clone'),
isArray: require('lodash/isArray'),
set: require('lodash/set'),
isFunction: require('lodash/isFunction')
};
var { defer, empty, from, of } = require('rxjs');
var { concatMap, filter, publish, reduce } = require('rxjs/operators');
var runAsync = require('run-async');
Expand Down
5 changes: 4 additions & 1 deletion packages/inquirer/lib/utils/paginator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

var _ = require('lodash');
var _ = {
sum: require('lodash/sum'),
flatten: require('lodash/flatten')
};
var chalk = require('chalk');

/**
Expand Down
5 changes: 4 additions & 1 deletion packages/inquirer/lib/utils/screen-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict';
var _ = require('lodash');
var _ = {
last: require('lodash/last'),
flatten: require('lodash/flatten')
};
var util = require('./readline');
var cliWidth = require('cli-width');
var stripAnsi = require('strip-ansi');
Expand Down
4 changes: 3 additions & 1 deletion packages/inquirer/lib/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';
var _ = require('lodash');
var _ = {
isFunction: require('lodash/isFunction')
};
var { from, of } = require('rxjs');
var runAsync = require('run-async');

Expand Down