How to use the coordinates function from chance
Find comprehensive JavaScript chance.coordinates code examples handpicked from public code repositorys.
5 6 7 8 9 10 11 12 13 14 15
/** * $coordinates operator, returns a 2-element array of [longitude, latitude] * coordinates. * * Note: this operator overwrites the chance.coordinates() operator, as it * returns a string in "latitude, longitude" format, which is not compatible * to MongoDBs geolocation indexes. * * @example Creates random coordinate pairs
21
117
0
10 11 12 13 14 15 16 17 18 19
spec.label = 'coords'; // usually plural spec.list = []; for( var i = 0; i < count; i++ ) { let coord = chance.coordinates().split(",") spec.list.push( { type: spec.label, latitude: parseFloat(coord[0]),
0
1
0
12 13 14 15 16 17 18 19 20 21 22 23
let _getCountry = function() { return Chance.country({ full: true }); } let _getCoordinates = function () { return Chance.coordinates(); } let _getZipCode = function () { return Chance.zip();
0
0
0
chance.word is the most popular function in chance (344 examples)