Skip to content

Commit

Permalink
build(package): Update development dependencies
Browse files Browse the repository at this point in the history
Add JSDoc parameter and return descriptions
  • Loading branch information
VovanR committed Jun 6, 2018
1 parent e38cdce commit 4bf25c8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ Returns an `Array` without `value` if `arr` is includes this `value`
*Required*<br>
Type: `Array`

Array with values needs to toggle

#### value
*Required*<br>
Type: `Array`

Value to toggle in `arr`

#### predicate
Type: `Function`<br>
Default: `(a, b) => a === b` *Strict equality comparison*

Function that compare each `arr` item to equal `value`

## License
MIT © [Vladimir Rodkin](https://github.com/VovanR)

Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Add or remove item from array
*
* @param {Array} arr
* @param {*} value
* @param {Function} [predicate]
* @return {Array}
* @param {Array} arr Array with values needs to toggle
* @param {*} value Value to toggle in `arr`
* @param {Function} [predicate] Function that compare each `arr` item to equal `value`. Strict equality comparison by default
* @return {Array} New array with or without `value`
*
* @example
* toggleInArray([1, 2, 3], 2)
Expand Down Expand Up @@ -48,9 +48,9 @@ function toggleInArray(arr, value, predicate) {
/**
* Strict equality comparison
*
* @param {*} a
* @param {*} b
* @return {boolean}
* @param {*} a Item of array
* @param {*} b Value to toggle
* @return {boolean} `true` if `a` and `b` are strict equals
*/
function defaultPredicate(a, b) {
return a === b;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
],
"dependencies": {},
"devDependencies": {
"ava": "^0.24.0",
"conventional-changelog-cli": "^1.3.5",
"coveralls": "^3.0.0",
"ava": "^0.25.0",
"conventional-changelog-cli": "^2.0.0",
"coveralls": "^3.0.1",
"cz-conventional-changelog": "^2.1.0",
"husky": "^0.14.3",
"mversion": "^1.10.1",
"nyc": "^11.4.1",
"xo": "^0.18.2"
"nyc": "^12.0.2",
"xo": "^0.21.1"
},
"bugs": {
"url": "https://github.com/VovanR/toggle-in-array/issues"
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import fn from './';
import fn from '.';

test('is function', t => {
t.is(typeof fn, 'function');
Expand Down

0 comments on commit 4bf25c8

Please sign in to comment.