Skip to content

Commit

Permalink
Avoid using Array#reduce (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Sep 24, 2020
1 parent 004c4e1 commit 8adfbdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 2 additions & 7 deletions index.js
@@ -1,15 +1,10 @@
'use strict';
const uniqueRandomArray = require('unique-random-array');
const {flatZip} = require('flat-zip');
const femaleDogNames = require('./female-dog-names.json');
const maleDogNames = require('./male-dog-names.json');

const allDogNames = femaleDogNames.reduce(
(allDogNames, femaleDogName, index) => {
allDogNames.push(femaleDogName, maleDogNames[index]);
return allDogNames;
},
[]
);
const allDogNames = flatZip([femaleDogNames, maleDogNames]);

exports.female = femaleDogNames;
exports.male = maleDogNames;
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -43,6 +43,7 @@
"male"
],
"dependencies": {
"flat-zip": "^1.0.1",
"meow": "^5.0.0",
"unique-random-array": "^2.0.0"
},
Expand Down

0 comments on commit 8adfbdf

Please sign in to comment.