šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

eslint-plugin-you-dont-need-lodash-underscore

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-you-dont-need-lodash-underscore

Check methods you can use natively without lodash/underscore

6.14.0
latest
Source
npm
Version published
Weekly downloads
202K
-8.61%
Maintainers
3
Weekly downloads
Ā 
Created

What is eslint-plugin-you-dont-need-lodash-underscore?

The eslint-plugin-you-dont-need-lodash-underscore package is an ESLint plugin that helps developers identify and replace Lodash/Underscore functions with native JavaScript alternatives. This can help reduce bundle size and improve performance by eliminating unnecessary dependencies.

What are eslint-plugin-you-dont-need-lodash-underscore's main functionalities?

Array Methods

This rule suggests using native JavaScript array methods instead of Lodash/Underscore methods. In this example, it replaces `_.concat` with the native `Array.prototype.concat` method.

/* eslint you-dont-need-lodash-underscore/concat: 'error' */

// Lodash
const result = _.concat([1], 2, [3], [[4]]);

// Native
const result = [1].concat(2, [3], [[4]]);

Object Methods

This rule suggests using native JavaScript object methods instead of Lodash/Underscore methods. In this example, it replaces `_.assign` with the native `Object.assign` method.

/* eslint you-dont-need-lodash-underscore/assign: 'error' */

// Lodash
const result = _.assign({ 'a': 1 }, { 'b': 2 }, { 'c': 3 });

// Native
const result = Object.assign({ 'a': 1 }, { 'b': 2 }, { 'c': 3 });

String Methods

This rule suggests using native JavaScript string methods instead of Lodash/Underscore methods. In this example, it replaces `_.startsWith` with the native `String.prototype.startsWith` method.

/* eslint you-dont-need-lodash-underscore/startsWith: 'error' */

// Lodash
const result = _.startsWith('abc', 'a');

// Native
const result = 'abc'.startsWith('a');

Other packages similar to eslint-plugin-you-dont-need-lodash-underscore

Keywords

underscore

FAQs

Package last updated on 03 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts