eslint-plugin-you-dont-need-lodash-underscore
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -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()'] | ||
}] | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40987
123
909
+ Addedcamelcase@^3.0.0
+ Addedcamelcase@3.0.0(transitive)
- Removedkebab-case@^1.0.0
- Removedkebab-case@1.0.2(transitive)