From 3c00345b26b36a8737622f3d3e0f8cf1fb919058 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 11 Jan 2022 06:45:45 +0200 Subject: [PATCH] Replace `_.uniq` with native (#1687) --- rules/utils/get-references.js | 6 +++--- rules/utils/get-variable-identifiers.js | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rules/utils/get-references.js b/rules/utils/get-references.js index 9f6c74588f..4effcfb1e6 100644 --- a/rules/utils/get-references.js +++ b/rules/utils/get-references.js @@ -1,9 +1,9 @@ 'use strict'; -const {uniq} = require('lodash'); + const getScopes = require('./get-scopes.js'); -const getReferences = scope => uniq( +const getReferences = scope => [...new Set( getScopes(scope).flatMap(({references}) => references), -); +)]; module.exports = getReferences; diff --git a/rules/utils/get-variable-identifiers.js b/rules/utils/get-variable-identifiers.js index 8335497f81..5a2617655d 100644 --- a/rules/utils/get-variable-identifiers.js +++ b/rules/utils/get-variable-identifiers.js @@ -1,8 +1,7 @@ 'use strict'; -const {uniq} = require('lodash'); // Get identifiers of given variable -module.exports = ({identifiers, references}) => uniq([ +module.exports = ({identifiers, references}) => [...new Set([ ...identifiers, ...references.map(({identifier}) => identifier), -]); +])];