Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed May 30, 2016
1 parent 7b39591 commit 4b79d86
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![Dependency Status](https://david-dm.org/icebob/fakerator.svg)](https://david-dm.org/icebob/fakerator)
[![devDependency Status](https://david-dm.org/icebob/fakerator/dev-status.svg)](https://david-dm.org/icebob/fakerator#info=devDependencies)
[![Downloads](https://img.shields.io/github/downloads/icebob/fakerator/total.svg)](https://www.npmjs.com/package/fakerator)
[![Downloads](https://img.shields.io/npm/dt/fakerator.svg?maxAge=2592000)](https://www.npmjs.com/package/fakerator)

## Demo
[JSFiddle test page](https://jsfiddle.net/icebob/wngcbpkq/)
Expand Down Expand Up @@ -52,7 +52,7 @@ var name = fakerator.names.name();
```

## Seeding
The library uses the [Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) random number generator, so you can set seed for random.
The library uses the [Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) random number generator, so you can set seed value.
```js
fakerator.seed(5567832);
```
Expand All @@ -62,7 +62,7 @@ fakerator.seed(new Date().valueOf());
```

## Random
Generate random values
Generate random values or select a random element from array.

Function | Description | Sample result
-----------------------------------| --------------------------- | -----------------------
Expand All @@ -73,18 +73,18 @@ Function | Description | Sample result
`fakerator.random.digit()` | Generate a digit (0..9) | 5
`fakerator.random.letter()` | Generate a letter (a..z) | "h"
`fakerator.random.arrayElement(array)` | Give a random element from the array |
`fakerator.random.objectElement(array)` | Give a random `{ key: value }` from the object
`fakerator.random.masked()` | Generate a masked string | "aaa-AAA_999:***+***"" ->"aqa-RPG_932:606+vv1"
`fakerator.random.objectElement(obj)` | Give a random `{ key: value }` from the object
`fakerator.random.masked(mask)` | Generate a masked string ( a - lowercase letter, A - uppercase letter, 9 - digit, * - letter or digit | "aaa-AAA_999:*" -> "aqa-RPG_932:6"
`fakerator.random.hex(length)` | Generate a hexadecimal number | "7950a0b9"
`fakerator.random.string(length)` | Generate a random string | "dulgecbhrsa"


## Localization
The library supports localizations. You can set the locale code in contructor.
The library supports localizations. You can set the locale code in constructor.

### Usage
```js
// Use default
// Use default (English) localization
var fakerator = new Fakerator();
console.log(fakerator.names.name());
// Floyd Corkery
Expand All @@ -105,8 +105,8 @@ The library supports localizations. You can set the locale code in contructor.
```

### Available localizations:
Code | Language/Country | Usage | Creator/Source
--------- | --------------------- | ----------------------- | --------------
Code | Language/Country | Usage | Creator/Source
--------- | --------------------- | ------------------------- | --------------
default | English (default) | `new Fakerator();` | [faker.js](https://github.com/Marak/faker.js)
de-DE | German | `new Fakerator("de-DE");` | [faker.js](https://github.com/Marak/faker.js)
es-ES | Spanish | `new Fakerator("es-ES");` | [faker.js](https://github.com/Marak/faker.js)
Expand All @@ -133,7 +133,7 @@ Function | Description | Sample res
`fakerator.names.lastNameF()` | Generate a female last name (*) | "Moore"
`fakerator.names.prefix()` | Generate a name prefix name | "Mr."
`fakerator.names.suffix()` | Generate a name suffix | "MD"
(*) - if localization supported
(*) - if localization support

### Address
Function | Description | Sample result
Expand Down Expand Up @@ -183,10 +183,10 @@ Function | Description | Sample resul
Function | Description | Sample result
----------------------------------- | --------------------------- | -----------------------
`fakerator.lorem.word()` | Give a lorem word | "dolores"
`fakerator.lorem.sentence()` | Generate a sentence | "Libero similique quam voluptas soluta."
`fakerator.lorem.paragraph()` | Give a lorem word | "Ut velit enim vel. Unde aut sint possimus velit commodi numquam. Autem expedita dignissimos est qui consequatur et delectus. Et qui necessitatibus voluptas quam. Dicta temporibus animi optio tempora aperiam repudiandae beatae. Placeat quo voluptatibus neque repellendus dolorem."
`fakerator.lorem.sentence()` | Generate a lorem sentence | "Libero similique quam voluptas soluta."
`fakerator.lorem.paragraph()` | Give a lorem paragraph | "Ut velit enim vel. Unde aut sint possimus velit commodi numquam. Autem expedita dignissimos est qui consequatur et delectus. Et qui necessitatibus voluptas quam. Dicta temporibus animi optio tempora aperiam repudiandae beatae. Placeat quo voluptatibus neque repellendus dolorem."

### date
### Date & time
Function | Description | Sample result
----------------------------------- | --------------------------- | -----------------------
`fakerator.date.timezone()` | Give a timezone | "Asia/Bangkok"
Expand All @@ -195,17 +195,17 @@ Function | Description | Sample resul
`fakerator.date.between(from, to)` | Generate a date between two dates | Date
`fakerator.date.recent(days)` | Generate a date in recent few days | Date
`fakerator.date.age(min, max)` | Generate an age number | 26
`fakerator.date.months()` | Give a month name | "September"
`fakerator.date.weekdays()` | Give a weekday name | "Sunday"
`fakerator.date.weekdaysShort()` | Give a short weekday name | "Fri"
`fakerator.date.weekdaysMin()` | Give a min weekday name | "Su"
`fakerator.date.month()` | Give a month name | "September"
`fakerator.date.weekday()` | Give a weekday name | "Sunday"
`fakerator.date.weekdayShort()` | Give a short weekday name | "Fri"
`fakerator.date.weekdayMin()` | Give a min weekday name | "Su"

### misc
### Miscellaneous
Function | Description | Sample result
----------------------------------- | --------------------------- | -----------------------
`fakerator.misc.uuid()` | Generate an [UUID](https://github.com/defunctzombie/node-uuid) | "e26717ad-1513-43c5-b7de-2849521fa195"

### entity
### Entities
You can generate complex entities

#### User
Expand Down Expand Up @@ -315,19 +315,19 @@ Result:
## Times
You can generate array of items with `times` and `utimes` (unique) functions.
First parameter is the generator function. Second is the length of array.
> You can pass further parameters, it will pass to the generator function.
> You can pass further parameters, they will be passed to the generator function.
### Usage
```js
// Generate 3 names
fakerator.times(fakerator.names.name, 3);
// [ "Ross Hansen", "Thomas Pfeffer", "Alexis Hauck I" ]

// Generator 5 username with populate where first name is 'John'
// Generate 5 username with populate where first name must be 'John'
fakerator.times(fakerator.populate, 5, "#{internet.userName}", "John");
// [ 'john.langosh8341', 'john12', 'john.howe5075', 'john_jerde', 'john.grant9923' ]

// Generator 5 number from 1 to 10
// Generate 5 number from 1 to 10
fakerator.times(fakerator.random.number, 5, 1, 10);
// [ 10, 8, 1, 8, 5 ]
// Note: 8 is twice!
Expand Down

0 comments on commit 4b79d86

Please sign in to comment.