-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(randomcounty, randomconstituency): Added Constituencies to the p…
…roject, link to eact respective closes #2
- Loading branch information
Showing
5 changed files
with
3,568 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
var counties = require('./json/counties.json'); | ||
var constituencies = require('./json/constituencies.json'); | ||
var uniqueRandomArray = require('unique-random-array'); | ||
|
||
module.exports = { | ||
counties: counties, | ||
randomcounty: uniqueRandomArray(counties), | ||
randomcounty: randomcounty, | ||
constituencies: constituencies, | ||
randomconstituency: randomconstituency, | ||
}; | ||
|
||
function randomcounty(number) { | ||
var arr = uniqueRandomArray(counties); | ||
if (number === undefined) { | ||
return arr(); | ||
} else { | ||
var randomitems = []; | ||
for (var i = 0; i < number; i++) { | ||
randomitems.push(arr()); | ||
} | ||
return randomitems; | ||
} | ||
} | ||
|
||
function randomconstituency(number) { | ||
var arr = uniqueRandomArray(constituencies); | ||
if (number === undefined) { | ||
return arr(); | ||
} else { | ||
var randomitems = []; | ||
for (var i = 0; i < number; i++) { | ||
randomitems.push(arr()); | ||
} | ||
return randomitems; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.