Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functions to generate latitude and longitude coordinates, as we… #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Returns a random word.
}

*Optional params:*

- `fields`: Decide what fields will be included in the result object. Possible values:
- name
- surname
Expand Down Expand Up @@ -131,6 +131,28 @@ Selects a random element from provided array.
fake.fromArray(['banana', 'apple', 'strawberry', 'raspberry', 'pear']);
// 'pear'

 

 

### `Fake.lat()`

Returns a random latitude coordinate.

*Example:*

Fake.lat()
// -71.6667067

 

 

### `Fake.long()`

Returns a random longitude coordinate.

*Example:*

Fake.long()
// 113.8461997
13 changes: 8 additions & 5 deletions fake.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var attachUserField = {
username: function(u, o) {
o.username = (u.name + '@' + u.domain).toLowerCase();
},

'emails.address': function(u, o) {
o.emails = [
{address: (u.name + '@' + u.domain).toLowerCase(), validated: false}
Expand Down Expand Up @@ -244,7 +244,7 @@ Fake.paragraph = function(length) {



Fake.fromArray = function(array) {
Fake.fromArray = function(array) {
return randomElement(array);
};

Expand All @@ -253,7 +253,10 @@ Fake.color = function() {
};


Fake.lat = function(){
return Math.round((Math.random()*(0,180)-90)*10000000)/10000000;
}




Fake.long = function(){
return Math.round((Math.random()*(0,360)-180)*10000000)/10000000;
}