From 54aeb1ac731f4cba68c0d9dd1abb5cc90a5b616f Mon Sep 17 00:00:00 2001 From: Matheus Fidelis Date: Sat, 10 Feb 2018 15:10:13 -0200 Subject: [PATCH 1/2] change randItem to randomItem (#11) --- lib/raj.js | 2 +- lib/src/arrays.js | 2 +- package-lock.json | 4 ++-- test/arrays.test.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/raj.js b/lib/raj.js index 793af39..a595757 100644 --- a/lib/raj.js +++ b/lib/raj.js @@ -11,7 +11,7 @@ module.exports = { diffBase: arrayHelpers.diffBase, common: arrayHelpers.common, sumArray: arrayHelpers.sumArray, - randItem: arrayHelpers.randItem, + randomItem: arrayHelpers.randomItem, split: arrayHelpers.split, plop: arrayHelpers.plop, diff --git a/lib/src/arrays.js b/lib/src/arrays.js index d0b2fdb..0286d60 100644 --- a/lib/src/arrays.js +++ b/lib/src/arrays.js @@ -5,7 +5,7 @@ module.exports = { diffBase: (base, comparator) => base.filter(x => comparator.indexOf(x) == -1), common: (array1, array2) => array1.filter((x) => array2.includes(x)), sumArray: array => array.reduce((total, current) => total + current, 0), - randItem: array => array[Math.floor(Math.random() * array.length)], + randomItem: array => array[Math.floor(Math.random() * array.length)], split: (array, counter) => array.map((e, i) => i % counter === 0 ? array.slice(i, i+counter) : null).filter((e) => e), plop: (array, name, ref = {}) => { array.map(item => { if (!ref[item[name]]) { ref[item[name]] = []; } ref[item[name]].push(item);}); return ref;} }; diff --git a/package-lock.json b/package-lock.json index 3d0de1e..249a3d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "raj", - "version": "1.0.0", + "name": "raj-tools", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/arrays.test.js b/test/arrays.test.js index e798ef2..be433d4 100644 --- a/test/arrays.test.js +++ b/test/arrays.test.js @@ -51,10 +51,10 @@ describe("#Arrays Test", () => { }); - it("#raj.randItem() - random item in array value", () => { + it("#raj.randomItem() - random item in array value", () => { let array = [5, 5, 10, 30]; - let rand = raj.randItem(array); + let rand = raj.randomItem(array); expect(array).to.be.an('array').that.contains(rand); }); From b5b231000417b178d3e15176d2a1f7612ac1ac3d Mon Sep 17 00:00:00 2001 From: Matheus Fidelis Date: Sat, 10 Feb 2018 15:10:48 -0200 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf28087..377d8a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "raj-tools", - "version": "1.0.1", + "version": "1.0.2", "description": "My toolset", "main": "lib/raj.js", "scripts": {