Skip to content

Commit

Permalink
Replace lodash.get() with a native solution (#1818)
Browse files Browse the repository at this point in the history
Co-authored-by: fisker Cheung <lionkay@gmail.com>
  • Loading branch information
XhmikosR and fisker committed May 24, 2022
1 parent 7a2e1ab commit 6ef957a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rules/no-array-reduce.js
@@ -1,5 +1,4 @@
'use strict';
const {get} = require('lodash');
const {methodCallSelector} = require('./selectors/index.js');
const {arrayPrototypeMethodSelector, notFunctionSelector, matches} = require('./selectors/index.js');

Expand Down Expand Up @@ -54,7 +53,7 @@ const create = context => {

return {
[selector](node) {
const callback = get(node, 'parent.parent.arguments[0]', {});
const callback = node.parent.parent?.arguments?.[0] ?? {};
const problem = {
node,
messageId: MESSAGE_ID,
Expand Down

0 comments on commit 6ef957a

Please sign in to comment.