diff --git a/README.md b/README.md index ee01707..68617f7 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,20 @@ Returns an `Array` without `value` if `arr` is includes this `value` *Required*
Type: `Array` +Array with values needs to toggle + #### value *Required*
Type: `Array` +Value to toggle in `arr` + #### predicate Type: `Function`
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) diff --git a/index.js b/index.js index e058927..09c97fa 100644 --- a/index.js +++ b/index.js @@ -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) @@ -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; diff --git a/package.json b/package.json index 1c25d5b..4db2d38 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test.js b/test.js index 8de5231..7afe21c 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,5 @@ import test from 'ava'; -import fn from './'; +import fn from '.'; test('is function', t => { t.is(typeof fn, 'function');