Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 22, 2015
1 parent adc8261 commit 5c784ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
20 changes: 4 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var uniqueRandom = require('unique-random');
var uniqueRandomArray = require('unique-random-array');
var femaleDogNames = require('./female-dog-names.json');
var maleDogNames = require('./male-dog-names.json');

Expand All @@ -9,22 +9,10 @@ femaleDogNames.forEach(function (el, i) {
allDogNames.push(el, maleDogNames[i]);
});

var femaleRandom = uniqueRandom(0, femaleDogNames.length - 1);
var maleRandom = uniqueRandom(0, femaleDogNames.length - 1);
var allRandom = uniqueRandom(0, allDogNames.length - 1);

exports.female = femaleDogNames;
exports.male = maleDogNames;
exports.all = allDogNames;

exports.femaleRandom = function () {
return femaleDogNames[femaleRandom()];
};

exports.maleRandom = function () {
return maleDogNames[maleRandom()];
};

exports.allRandom = function () {
return allDogNames[allRandom()];
};
exports.femaleRandom = uniqueRandomArray(femaleDogNames);
exports.maleRandom = uniqueRandomArray(maleDogNames);
exports.allRandom = uniqueRandomArray(allDogNames);
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
Expand Down Expand Up @@ -47,7 +47,7 @@
],
"dependencies": {
"meow": "^2.1.0",
"unique-random": "^1.0.0"
"unique-random-array": "^1.0.0"
},
"devDependencies": {
"ava": "0.0.4"
Expand Down

0 comments on commit 5c784ef

Please sign in to comment.