SB-6.1-PRE

This commit is contained in:
ItzEmerald committed 2021-02-02 13:50:53 +00:00
1 parent 690169a409
commit 358a25f522
3760 files changed
+300059 -36

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
# address
```js
// usage
chance.address()
chance.address({short_suffix: true})
```
Generate a random street address
```js
chance.address();
=> '5447 Bazpe Lane'
```
Optionally mandate that it return a short suffix
```js
chance.address({short_suffix: true});
=> '536 Baner Rd'
```
+29
View File
@@ -0,0 +1,29 @@
# altitude
```js
// usage
chance.altitude()
chance.altitude({ fixed: 7 })
chance.altitude({ max: 1000 })
```
Generate a random altitude, in meters.
```js
chance.altitude()
=> 1863.21417
```
By default, includes 5 digits of accuracy after the decimal. Can override with the `fixed` option.
```js
chance.altitude({ fixed: 7 })
=> 6897.8978386
```
By default, max of 8848m (height of Mount Everest), but this can be overridden with the `max` option.
```js
chance.altitude({ max: 1000 })
=> 890.20665
```
+16
View File
@@ -0,0 +1,16 @@
# areacode
```js
// usage
chance.areacode()
```
Generate a random area code
```js
chance.areacode()
=> '(526)'
```
*Note, this is a US area code, we have little support for internationalization
at this time. Hope to fix that in the future!*
+13
View File
@@ -0,0 +1,13 @@
# city
```js
// usage
chance.city()
```
Generate a random city name
```js
chance.city();
=> 'Cowotba'
```
+34
View File
@@ -0,0 +1,34 @@
# coordinates
```js
// usage
chance.coordinates()
chance.coordinates({fixed: 2})
chance.coordinates({format: 'dms'})
```
Generate random coordinates, which are latitude and longitude, comma separated.
```js
chance.coordinates();
=> "-29.52974, 24.52815"
```
By default includes 5 fixed digits after decimal, can specify otherwise.
```js
chance.coordinates({fixed: 2});
=> "-49.16, 68.81"
```
By default cooridnates' format is dd, can specify otherwise.
```js
chance.coordinates({format: 'ddm'});
=> "41°44.9592, 25°56.2622"
```
```js
chance.coordinates({format: 'dms'});
=> "56°2’9.8187”, 79°55’40.6812”"
```
+23
View File
@@ -0,0 +1,23 @@
# country
```js
// usage
chance.country()
chance.country({ full: true })
```
Return a random country.
```js
chance.country();
=> 'LT'
```
By default, returns only the 2 letter ISO 3166-1 code for the country.
Optionally specify that it ought to return a full country name.
```js
chance.country({ full: true });
=> 'Venezuela'
```
+29
View File
@@ -0,0 +1,29 @@
# depth
```js
// usage
chance.depth()
chance.depth({ fixed: 2 })
chance.depth({ min: -1000 })
```
Generate a random depth, in meters. Depths are always negative
```js
chance.depth()
=> -2126.95039
```
By default, includes 5 digits of accuracy after the decimal. Can override with the `fixed` option.
```js
chance.depth({ fixed: 2 })
=> -1542.11
```
By default, maximum (or minimum depending on your frame of reference) depth of -2550 (depth of the Mariana Trench), but this can be overridden with the `min` option.
```js
chance.depth({ min: -1000 })
=> -718.41976
```
+21
View File
@@ -0,0 +1,21 @@
# geohash
```js
// usage
chance.geohash()
chance.geohash({ length: 5 })
```
Generate a random geohash. [More details on what a geohash is](http://en.wikipedia.org/wiki/Geohash).
```js
chance.geohash()
=> 'h9xhn7y'
```
By default, includes 7 characters of accuracy. Can override with the `length` option.
```js
chance.geohash({ length: 5 })
=> 'dr0kr'
```
+43
View File
@@ -0,0 +1,43 @@
# latitude
```js
// usage
chance.latitude()
chance.latitude({fixed: 7})
chance.latitude({format: 'dms'})
```
Generate a random latitude.
```js
chance.latitude();
=> 57.99514
```
_range: -90 to 90_
By default includes 5 fixed digits after decimal, can specify otherwise.
```js
chance.latitude({fixed: 7});
=> -29.6443133
```
By default includes entire range of allowed latitudes, can specify a min and/or max to bound it
```js
chance.latitude({min: 38.7, max: 38.9});
=> 38.82358
```
By default latitudes' format is dd, can specify otherwise.
```js
chance.latitude({format: 'ddm'});
=> "41°44.9592"
```
```js
chance.latitude({format: 'dms'});
=> "56°2’9.8187”"
```
+25
View File
@@ -0,0 +1,25 @@
# locale
```js
// usage
chance.locale()
chance.locale({region: true})
```
Generate a random ISO-639-1 language code
```js
chance.locale();
=> 'ca'
```
Generate a random IETF region code
```js
chance.locale({region: true});
=> 'es-EA'
```
_Note, the language codes comes from the [ISO-639-1 spec](http://www.loc.gov/standards/iso639-2/php/code_list.php)
and the region codes come from [IETF standard](http://data.okfn.org/data/core/language-codes#resource-language-codes-full)_
+43
View File
@@ -0,0 +1,43 @@
# longitude
```js
// usage
chance.longitude()
chance.longitude({fixed: 7})
chance.longitude({format: 'dms'})
```
Generate a random longitude.
```js
chance.longitude();
=> 149.41549
```
_range: -180 to 180_
By default includes 5 fixed digits after decimal, can specify otherwise.
```js
chance.longitude({fixed: 7});
=> 51.4549925
```
By default includes entire range of allowed longitudes, can specify a min and/or max to bound it
```js
chance.longitude({min: -78, max: -77});
=> -77.22644
```
By default longitude' format is dd, can specify otherwise.
```js
chance.longitude({format: 'ddm'});
=> "41°44.9592"
```
```js
chance.longitude({format: 'dms'});
=> "56°2’9.8187”"
```
+41
View File
@@ -0,0 +1,41 @@
# phone
```js
// usage
chance.phone()
chance.phone({ formatted: false })
chance.phone({ country: "fr" })
chance.phone({ country: "fr", mobile: true })
```
Generate a random phone
```js
chance.phone();
=> '(494) 927-2152'
```
By default conforms to [NANP](http://en.wikipedia.org/wiki/North_American_Numbering_Plan) for a proper US phone number.
Optionally disable formatting.
```js
chance.phone({ formatted: false });
=> '2617613391'
```
Optionally specify a country.
```js
chance.phone({ country: 'fr' });
=> '01 60 44 92 67'
```
Note, at current we only have support for `'us'`, `'uk'`, or `'fr'` for countries.
For `uk` and `fr`, optionally specify a mobile phone.
```js
chance.phone({ country: 'uk', mobile: true });
=> '07624 321221'
```
+13
View File
@@ -0,0 +1,13 @@
# postal
```js
// usage
chance.postal()
```
Return a Canadian Postal code. Returned postal code is valid with respect to the Postal District (first character) and format only.
```js
chance.postal();
=> 'R1S 3F4'
```
+13
View File
@@ -0,0 +1,13 @@
# postcode
```js
// usage
chance.postcode()
```
Generate a random (U.K.) postcode. Returned postcode is valid with respect to the Postcode Area (first characters) and format only.
```js
chance.postcode();
=> 'W6 9PF'
```
+33
View File
@@ -0,0 +1,33 @@
# province
```js
// usage
chance.province()
chance.province({full: true})
chance.province({full: true})
```
Return a random province.
```js
chance.province();
=> 'ON'
```
By default, returns only the 2 letter abbreviation for province.
Optionally specify that it ought to return a full province name.
```js
chance.province({full: true});
=> 'Nova Scotia'
```
Optionally specify the country from which it should return the province name.
```js
chance.province({country: 'it', full: true});
=> 'Vicenza'
```
Note, currently support for country is limited to: `'ca', 'it'`.
+62
View File
@@ -0,0 +1,62 @@
# state
```js
// usage
chance.state()
chance.state({ full: true })
chance.state({ territories: true })
chance.state({ armed_forces: true })
chance.state({ us_states_and_dc: false })
chance.state({ country: 'us' })
```
Return a random state.
```js
chance.state();
=> 'AK'
```
By default, returns only the 2 letter abbreviation for state.
Optionally specify that it ought to return a full state name.
```js
chance.state({ full: true });
=> 'Florida'
```
Optionally add U.S. Territories ('American Samoa', 'Federated States of Micronesia', 'Guam', 'Marshall Islands', 'Northern Mariana Islands', 'Puerto Rico', 'Virgin Islands, U.S.') to the mix of randomly selected items:
```js
chance.state({ territories: true, full: true })
=> 'Guam'
```
Optionally add Armed Forces to the list as well:
```js
chance.state({ armed_forces: true, full: true })
=> 'Armed Forces Pacific'
```
For all U.S. states, territories, and armed forces, specify all of them:
```js
chance.state({ armed_forces: true, territories: true })
=> 'NY'
```
For just territories or armed forces, specify that it ought not return U.S. states:
```js
chance.state({ territories: true, us_states_and_dc: false })
=> 'PR'
```
Optionally specify a country (US specific options are ignored if country is specified and different from `'us'`):
```js
chance.state({ country: 'it', full: true })
=> 'Toscana'
```
+37
View File
@@ -0,0 +1,37 @@
# street
```js
// usage
chance.street()
chance.street({country:it})
```
Generate a random street
```js
chance.street();
=> 'Tesca Circle'
```
Optionally mandate that it returns a short suffix
```js
chance.street({short_suffix: true});
=> 'Jiled St'
```
Optionally specify the number of syllables used to generate the street name
```js
chance.street({syllables: 8});
=> 'Teniefitinusewjircor Junction'
```
Optionally specify a country to localize street prefixes
```js
chance.street({country: 'it'});
=> 'Via Nefba'
```
Note, currently support for country is limited to: `'us', 'it'`.
+23
View File
@@ -0,0 +1,23 @@
# zip
```js
// usage
chance.zip()
chance.zip({plusfour: true})
```
Generate a random (U.S.) zip code.
```js
chance.zip();
=> '90210'
```
Can optionally specify that it ought to return a [Zip+4][zip+4]:
```js
chance.zip({plusfour: true});
=> '01035-1838'
```
[zip+4]: http://vq.io/19rzsve