aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndres Silva <[email protected]>2017-01-26 10:18:57 -0500
committerAndres Silva <[email protected]>2017-01-26 10:18:57 -0500
commit484e63a791fd6874af6d7d7e6c1806cb5d325d30 (patch)
tree132c064722e6718d6ba06e49560b6c946e08575e /lib
parent7e96b93869b422af5a63c115e04ff0206bf7b228 (diff)
downloadfaker-484e63a791fd6874af6d7d7e6c1806cb5d325d30.tar.xz
faker-484e63a791fd6874af6d7d7e6c1806cb5d325d30.zip
Add max, min for latitude and longitude
Diffstat (limited to 'lib')
-rw-r--r--lib/address.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/address.js b/lib/address.js
index cf37d2e8..a6d47187 100644
--- a/lib/address.js
+++ b/lib/address.js
@@ -205,18 +205,22 @@ function Address (faker) {
* latitude
*
* @method faker.address.latitude
+ * @param {Double} max default is 90
+ * @param {Double} min default is -90
*/
- this.latitude = function () {
- return (faker.random.number(180 * 10000) / 10000.0 - 90.0).toFixed(4);
+ this.latitude = function (max = 90, min = -90) {
+ return faker.random.number({max: max, min:min, precision:0.0001}).toFixed(4);
}
/**
* longitude
*
* @method faker.address.longitude
+ * @param {Double} max default is 180
+ * @param {Double} min default is -180
*/
- this.longitude = function () {
- return (faker.random.number(360 * 10000) / 10000.0 - 180.0).toFixed(4);
+ this.longitude = function (max = 180, min = -180) {
+ return faker.random.number({max: max, min:min, precision:0.0001}).toFixed(4);
}
return this;