-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore(lodash): [RO-26515] Removes unneeded lodash deps with native replacements #105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
const _bindAll = require('lodash.bindall'); | ||
|
||
module.exports = function (path, Promise, fsPromise, FixtureCache, Logger) { | ||
class FixtureUtil { | ||
|
||
constructor(fixturesPath) { | ||
_bindAll(this, ['get', 'readAndProcessFile', 'startFileRead']); | ||
this.fixturesPath = fixturesPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not called within an async method, so removing. |
||
this.cache = FixtureCache; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
const _compact = require('lodash.compact'); | ||
const _map = require('lodash.map'); | ||
const _invokeMap = require('lodash.invokemap'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the return self._pluginInstances.map(plugin => plugin.end()); Not sure if this is the only usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe so but it's not low-hanging fruit. I will take a look at it in the next set of PRs. Coverage is not great to catch is so I don't want to commit to writing additional tests and delaying the main need of the project right now. |
||
const _uniq = require('lodash.uniq'); | ||
const _union = require('lodash.union'); | ||
const _some = require('lodash.some'); | ||
|
||
module.exports = function (superagent, Promise, FormData, HTTPResponseProcessing) { | ||
const Request = superagent.Request; | ||
|
@@ -41,7 +39,7 @@ module.exports = function (superagent, Promise, FormData, HTTPResponseProcessing | |
if (self.tags == null) { self.tags = {}; } | ||
|
||
this._plugins = (this._plugins || []).concat(superagent.globalPlugins); | ||
this._pluginInstances = _compact(_map(this._plugins, (p) => p.start(self))); | ||
this._pluginInstances = _compact(this._plugins.map((p) => p.start(self))); | ||
|
||
return new Promise((resolve, reject) => { | ||
Request.prototype.end.call(self, (err, res) => { | ||
|
@@ -115,7 +113,7 @@ module.exports = function (superagent, Promise, FormData, HTTPResponseProcessing | |
|
||
superagent.addGlobalPlugin = function (plugin) { | ||
const checkPluginExists = (pluginOpt) => pluginOpt === plugin; | ||
if (!_some(superagent.globalPlugins, checkPluginExists)) { | ||
if (!superagent.globalPlugins.some(checkPluginExists)) { | ||
superagent.globalPlugins.push(plugin); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
const _bindAll = require('lodash.bindall'); | ||
const _assignIn = require('lodash.assignin'); | ||
|
||
module.exports = function (Promise, fsPromise, JSON) { | ||
class Utils { | ||
|
||
constructor() { | ||
_bindAll(this, ['readFile', 'readJsonFile']); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not called within an async method, so removing. |
||
|
||
prop(prop) { return (ob) => ob[prop]; } | ||
|
||
extendWith(ob1) { return (ob2) => _assignIn(ob2, ob1); } | ||
extendWith(ob1) { return (ob2) => Object.assign(ob2, ob1); } | ||
|
||
capitalize(str) { | ||
if (!str) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOrPromise is not called in an async method in the class, so context is not needed