Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Marak/faker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fariborzemami committed Aug 28, 2020
2 parents 7c9b29c + 2fd8a31 commit f7c1324
Show file tree
Hide file tree
Showing 322 changed files with 203,189 additions and 1,595,427 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ REVISION
.project
.tasks-cache
.svn
.nyc_output/
*DONOTVERSION*
/nbproject
/.idea
Expand All @@ -19,4 +20,4 @@ reports/

# meteor specific
.build*
versions.json
versions.json
28 changes: 2 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,5 @@
sudo: false
language: node_js
node_js:
- "10"
- "9"
- "8"
- "7"
- "6"
- "6.1"
- "5"
- "5.1"
- "4"
- "4.2"
- "4.1"
- "4.0"
- "0.12"
- "0.11"
- "0.10"
- "iojs"

before_install:
# Install meteor and spacejam, a meteor command line package tester
- 'if [ "$(node -v)" = "v0.10.36" ]; then curl https://install.meteor.com | /bin/sh; fi'
- 'if [ "$(node -v)" = "v0.10.36" ]; then npm install -g spacejam; fi'
- 'if [ "$(node -v)" = "v0.10.36" ]; then export PATH="$HOME/.meteor:$PATH"; fi'

script:
- "npm test"
- 'if [ "$(node -v)" = "v0.10.36" ]; then spacejam test-packages --mongo-url=dummy ./; fi'
- "node"
- "lts/*"
4 changes: 2 additions & 2 deletions MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
faker.js - Copyright (c) 2010-2015
Matthew Bergman & Marak Squires
faker.js - Copyright (c) 2020
Marak Squires
http://github.com/marak/faker.js/

faker.js was inspired by and has used data definitions from:
Expand Down
140 changes: 74 additions & 66 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,26 @@

[https://rawgit.com/Marak/faker.js/master/examples/browser/index.html](https://rawgit.com/Marak/faker.js/master/examples/browser/index.html)

## Hosted API Microservice

[http://faker.hook.io](http://faker.hook.io/)
- Supports all Faker API Methods
- Full-Featured Microservice
- Hosted by [hook.io](http://hook.io)

```bash
curl http://faker.hook.io?property=name.findName&locale=de
```

## Usage

### Browser

```html
<script src = "faker.js" type = "text/javascript"></script>
<script>
var randomName = faker.name.findName(); // Caitlyn Kerluke
var randomEmail = faker.internet.email(); // [email protected]
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
</script>

```
### Node.js

```js
var faker = require('faker');

var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // [email protected]
var randomCard = faker.helpers.createCard(); // random contact card containing many properties

## API


### Faker.fake()

faker.js contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format.

**Example:**

``` js
console.log(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
// outputs: "Marks, Dean Sr."
```

This will interpolate the format string with the value of methods `name.lastName()`, `name.firstName()`, and `name.suffix()`
## API

### JSDoc API Browser

Expand All @@ -67,6 +42,7 @@ This will interpolate the format string with the value of methods `name.lastName

* address
* zipCode
* zipCodeByState
* city
* cityPrefix
* citySuffix
Expand All @@ -82,6 +58,11 @@ This will interpolate the format string with the value of methods `name.lastName
* stateAbbr
* latitude
* longitude
* direction
* cardinalDirection
* ordinalDirection
* nearbyGPSCoordinate
* timeZone
* commerce
* color
* department
Expand Down Expand Up @@ -120,16 +101,27 @@ This will interpolate the format string with the value of methods `name.lastName
* finance
* account
* accountName
* routingNumber
* mask
* amount
* transactionType
* currencyCode
* currencyName
* currencySymbol
* bitcoinAddress
* litecoinAddress
* creditCardNumber
* creditCardCVV
* ethereumAddress
* iban
* bic
* transactionDescription
* git
* branch
* commitEntry
* commitMessage
* commitSha
* shortSha
* hacker
* abbreviation
* adjective
Expand All @@ -142,6 +134,9 @@ This will interpolate the format string with the value of methods `name.lastName
* slugify
* replaceSymbolWithNumber
* replaceSymbols
* replaceCreditCardSymbols
* repeatString
* regexpStyleStringParse
* shuffle
* mustache
* createCard
Expand All @@ -166,6 +161,9 @@ This will interpolate the format string with the value of methods `name.lastName
* technics
* transport
* dataUri
* lorempixel
* unsplash
* lorempicsum
* internet
* avatar
* email
Expand Down Expand Up @@ -197,6 +195,7 @@ This will interpolate the format string with the value of methods `name.lastName
* lastName
* findName
* jobTitle
* gender
* prefix
* suffix
* title
Expand All @@ -211,13 +210,15 @@ This will interpolate the format string with the value of methods `name.lastName
* number
* float
* arrayElement
* arrayElements
* objectElement
* uuid
* boolean
* word
* words
* image
* locale
* alpha
* alphaNumeric
* hexaDecimal
* system
Expand All @@ -231,8 +232,32 @@ This will interpolate the format string with the value of methods `name.lastName
* directoryPath
* filePath
* semver
* time
* recent
* unique
* vehicle
* vehicle
* manufacturer
* model
* type
* fuel
* vin
* color


### Faker.fake()

faker.js contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format.

**Example:**

``` js
console.log(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
// outputs: "Marks, Dean Sr."
```

This will interpolate the format string with the value of methods `name.lastName()`, `name.firstName()`, and `name.suffix()`

## Localization

As of version `v2.0.0` faker.js has support for multiple localities.
Expand All @@ -243,32 +268,32 @@ Setting a new locale is simple:

```js
// sets locale to de
faker.setLocale("de");
// or
faker.locale = "de";
```

* az
* ar
* cz
* de
* de_AT
* de_CH
* en
* en_AU
* en_AU_ocker
* en_BORK
* en_CA
* en_GB
* en_IE
* en_IND
* en_NG
* en_US
* en_ZA
* en_au_ocker
* es
* es_MX
* fa
* fi
* fr
* fr_CA
* fr_CH
* ge
* id_ID
* it
Expand All @@ -277,9 +302,11 @@ faker.locale = "de";
* nb_NO
* nep
* nl
* nl_BE
* pl
* pt_BR
* pt_PT
* ro
* ru
* sk
* sv
Expand All @@ -292,7 +319,7 @@ faker.locale = "de";

### Individual Localization Packages

As of vesion `v3.0.0` faker.js supports incremental loading of locales.
faker.js supports incremental loading of locales.

By default, requiring `faker` will include *all* locale data.

Expand Down Expand Up @@ -327,48 +354,30 @@ console.log(firstRandom === secondRandom);

You can view a code coverage report generated in coverage/lcov-report/index.html.

## Projects Built with faker.js

### Fake JSON Schema

Use faker generators to populate JSON Schema samples.
See: https://github.com/pateketrueke/json-schema-faker/

### CLI

Run faker generators from Command Line.
See: https://github.com/lestoni/faker-cli

**Want to see your project added here? Let us know!**
## Building faker.js

### Meteor
faker uses [gulp](http://gulpjs.com/) to automate it's build process. Each build operation is a separate task which can be run independently.

#### Meteor Installation
### Browser Bundle

```
meteor add practicalmeteor:faker
npm run browser
```

#### Meteor Usage, both client and server
### Building JSDocs

```js
var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // [email protected]
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
```

## Building faker.js

faker uses [gulp](http://gulpjs.com/) to automate its build process. Running the following build command will generate new browser builds, documentation, and code examples for the project.
[JSDOC](https://jsdoc.app/) v3 HTML API documentation

```
npm run-script build
npm run jsdoc
```

## Building JSDocs
### Building ReadMe

The `ReadMe.md` file for `faker.js` is automatically generated and should not be modified directly. All updateds to `ReadMe.md` should be perfomed in `./build/src/docs.md` and then the build script should be run.

```
npm run-script doc
npm run readme
```

## Version Release Schedule
Expand All @@ -381,8 +390,9 @@ If you require the absolute latest version of `faker.js` the `master` branch @ h

#### Marak Squires

faker.js - Copyright (c) 2017
faker.js - Copyright (c) 2020
Marak Squires
www.marak.com
http://github.com/marak/faker.js/

faker.js was inspired by and has used data definitions from:
Expand All @@ -409,8 +419,6 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



## Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/fakerjs#backer)]
Expand Down
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"main": "./build/build/faker.js",
"homepage": "https://github.com/Marak/faker.js",
"authors": [
"Marak Squires <[email protected]>",
"Matthew Bergman <[email protected]>"
"Marak Squires <[email protected]>"
],
"description": "Generate massive amounts of fake contextual data",
"keywords": [
Expand Down
Loading

0 comments on commit f7c1324

Please sign in to comment.