aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarak <[email protected]>2017-09-08 16:12:13 -0400
committerGitHub <[email protected]>2017-09-08 16:12:13 -0400
commit2ea9730a4a36af6db2333c8655ab9d4dcc6bc2d4 (patch)
treedb71067844bc0dcc1c25972afd53aaa9c33ad4a3 /lib
parentb61947dccad28a85252575d2bd90078c181e13b8 (diff)
parent2b59931cc71ca460c3221dc1a188078e72465446 (diff)
downloadfaker-2ea9730a4a36af6db2333c8655ab9d4dcc6bc2d4.tar.xz
faker-2ea9730a4a36af6db2333c8655ab9d4dcc6bc2d4.zip
Merge pull request #455 from andresilvagomez/max-min-latlong
[api] Add max, min for latitude and longitude
Diffstat (limited to 'lib')
-rw-r--r--lib/address.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/address.js b/lib/address.js
index cf37d2e8..0a6f0c5b 100644
--- a/lib/address.js
+++ b/lib/address.js
@@ -205,18 +205,26 @@ 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, min) {
+ max = max || 90
+ min = 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, min) {
+ max = max || 180
+ min = min || -180
+ return faker.random.number({max: max, min:min, precision:0.0001}).toFixed(4);
}
return this;