Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
2
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 - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

4

lib/rules/all.js

@@ -11,3 +11,3 @@ /**

const kebabCase = require('kebab-case');
const camelCase = require('camelcase');
const rules = require('./rules');

@@ -17,3 +17,3 @@

const errorMessage = rules[rule];
module.exports[kebabCase(rule)] = {
module.exports[camelCase(rule)] = {
create (context) {

@@ -20,0 +20,0 @@ return {

{
"name": "eslint-plugin-you-dont-need-lodash-underscore",
"version": "5.0.2",
"version": "5.0.3",
"description": "Check methods you can use natively without lodash/underscore",

@@ -29,3 +29,3 @@ "repository": {

"dependencies": {
"kebab-case": "^1.0.0"
"camelcase": "^3.0.0"
},

@@ -32,0 +32,0 @@ "devDependencies": {

@@ -101,2 +101,3 @@ ## You don't (may not) need Lodash/Underscore [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cht8687/You-Dont-Need-Lodash-Underscore)

1. [_.map](#_map)
1. [_.pluck](#_pluck)
1. [_.reduce](#_reduce)

@@ -520,2 +521,22 @@ 1. [_.reduceRight](#_reduceright)

```
### _.pluck
`array.map` can also be used to replace `_.pluck`
```js
// Underscore/Lodash
var array1 = [{name: "Alice"}, {name: "Bob"}, {name: "Jeremy"}]
var names = _.pluck(array1, "name")
console.log(names)
// output: ["Alice", "Bob", "Jeremy"]
// Native
var array1 = [{name: "Alice"}, {name: "Bob"}, {name: "Jeremy"}]
var names = array1.map(function(x){
return x.name
})
console.log(names)
// output: ["Alice", "Bob", "Jeremy"]
```
### Browser Support

@@ -522,0 +543,0 @@

@@ -38,3 +38,3 @@ /**

ruleTester.run('underscore.forEach', rules['for-each'], {
ruleTester.run('underscore.forEach', rules.forEach, {
valid: [

@@ -56,1 +56,11 @@ '[0, 1].forEach()'

});
ruleTester.run('_.findIndex', rules.findIndex, {
valid: [
'[{user: fred, age: 20, active: false}, {user: rick, age: 43, active: false}].findIndex(function (o) { return o.age >= 40; })'
],
invalid: [{
code: '_.findIndex([{user: fred, age: 20, active: false}, {user: rick, age: 43, active: false}], function (o) { return o.age >= 40; });',
errors: ['Consider using the native ES6 Array.prototype.findIndex()']
}]
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc