Skip to content

Commit

Permalink
Add support for _.drop (#185)
Browse files Browse the repository at this point in the history
* Add isNull and isUndefined.

* Fix rule count.

* Add lodash drop.

* Add documentation for drop.

* Fix broken merge.
  • Loading branch information
ovidiubute authored and cht8687 committed May 5, 2019
1 parent f351692 commit 21b6230
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ For more information, see [Configuring the ESLint Plugin](configuring.md)
1. [_.compact](#_compact)
1. [_.concat](#_concat)
1. [_.difference](#_difference)
1. [_.drop](#_drop)
1. [_.fill](#_fill)
1. [_.find](#_find)
1. [_.findIndex](#_findindex)
Expand Down Expand Up @@ -291,6 +292,34 @@ Similar to [without](#_without), but returns the values from array that are not

**[⬆ back to top](#quick-links)**

### _.drop

Creates a slice of array with n elements dropped from the beginning.

```js
// Underscore/Lodash
_.drop([1, 2, 3]);
// => [2, 3]

_.drop([1, 2, 3], 2);
// => [3]

// Native
[1, 2, 3].slice(1);
// => [2, 3]

[1, 2, 3].slice(2);
// => [3]
```

#### Browser Support for `Array.prototype.slice()`

![Chrome][chrome-image] | ![Edge][edge-image] | ![Firefox][firefox-image] | ![IE][ie-image] | ![Opera][opera-image] | ![Safari][safari-image]
:-: | :-: | :-: | :-: | :-: | :-: |
1.0 ✔ | ✔ | 1.0 ✔ | ✔ | ✔ | ✔ |

**[⬆ back to top](#quick-links)**

### _.fill

Fills elements of array with value from start up to, but not including, end.
Expand Down
4 changes: 4 additions & 0 deletions lib/rules/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"compatible": true,
"alternative": "Array.prototype.concat()"
},
"drop": {
"compatible": true,
"alternative": "Array.prototype.slice()"
},
"indexOf": {
"compatible": true,
"alternative": "Array.prototype.indexOf()"
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const rules = require('../../../lib/rules/all');
const allRules = require('../../../lib/rules/rules');

assert.equal(Object.keys(allRules).length, 52, 'Don\'t miss a rule 😄');
assert.equal(Object.keys(allRules).length, 53, 'Don\'t miss a rule 😄');

const ruleTester = new RuleTester({
parserOptions: { ecmaVersion: 2018, sourceType: "module" }
Expand Down

0 comments on commit 21b6230

Please sign in to comment.