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

feat: examples generator #288

Open
wants to merge 5 commits into
base: main
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
3,078 changes: 1,355 additions & 1,723 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
"generate-examples": "./node_modules/.bin/ts-node ./scripts/example-generator.js ./packages/falso/src/lib/ @automaticallyGeneratedExamples",
"build:docs": "npm run build && node ./docs-generator.js",
"start:docs": "npm run build:docs && npm run start --prefix docs",
"build": "nx build falso && npm run i18n && node ./post-build.js",
Expand All @@ -21,6 +22,7 @@
"docs"
],
"dependencies": {
"ts-node": "10.8.1",
"tslib": "2.3.1"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/falso/src/lib/abbreviation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import { data } from './abbreviation.json';
*
* randAbbreviation({ length: 10 })
*
* @automaticallyGeneratedExamples
* @example
* 'SCSI'
* 'SMTP'
* 'ADP'
*/

export function randAbbreviation<O extends FakeOptions = never>(options?: O) {
return fake(data, options);
}
7 changes: 7 additions & 0 deletions packages/falso/src/lib/accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './accessory.json';
*
* randAccessory({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Sunglasses'
* 'Apron'
* 'Necklace'
*/

export function randAccessory<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
6 changes: 6 additions & 0 deletions packages/falso/src/lib/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export interface AccountOptions extends FakeOptions {
*
* randAccount({ length: 10 })
*
* @automaticallyGeneratedExamples
* @example
* 316396831
* 336461842
* 864320942
*/

export function randAccount<Options extends AccountOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export interface Address {
*
* randAddress({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randAddress<Options extends AddressOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/airline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './airline.json';
*
* randAirline({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Aeroflot'
* 'Air Canada'
* 'Air Europa'
*/

export function randAirline<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/airport-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import { rand } from './rand';
*
* randAirportCode({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randAirportCode<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/airport-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import { rand } from './rand';
*
* randAirportName({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randAirportName<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
22 changes: 22 additions & 0 deletions packages/falso/src/lib/airport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,29 @@ export interface Airport {
*
* randAirport({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* {
name: 'Hartsfield–Jackson Atlanta International Airport',
code: 'ATL',
city: 'Atlanta',
country: 'United States'
}
* {
name: 'Los Angeles International Airport',
code: 'LAX',
city: 'Los Angeles',
country: 'United States'
}
* {
name: "O'Hare International Airport",
code: 'ORD',
city: 'Chicago',
country: 'United States'
}
*/

export function randAirport<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/alpha-numeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import { randNumber } from './number';
*
* randAlphaNumeric({ length: 3 })
*
*
* @automaticallyGeneratedExamples
* @example
* o
* e
* 9
*/

export function randAlphaNumeric<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/alpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { alphaChars } from './sequence';
*
* randAlpha({ length: 3 })
*
*
* @automaticallyGeneratedExamples
* @example
* g
* g
* l
*/

export function randAlpha<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/american-football-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './american-football-team.json';
*
* randAmericanFootballTeam({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Arizona Cardinals'
* 'Atlanta Falcons'
* 'Baltimore Ravens'
*/

export function randAmericanFootballTeam<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ export interface RandomAmountOptions extends RandomInRangeOptions, FakeOptions {
* @example
*
* randAmount({ length: 10 })
*
* @automaticallyGeneratedExamples
* @example
* 8672.63
* 3284.82
* 9879.79
*/

export function randAmount<
Options extends markRequired<RandomAmountOptions, 'symbol'>
>(options: Options): Return<string, Options>;
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/animal-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './animal-type.json';
*
* randAnimalType({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'bird'
* 'cetacean'
* 'rabbit'
*/

export function randAnimalType<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/arn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const serviceArn: Record<string, () => string> = {
*
* randArn({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randArn<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ interface AvatarOptions extends FakeOptions {
*
* randAvatar({ size: 200 }) // default is 100
*
*
* @automaticallyGeneratedExamples
* @example
* https://i.pravatar.cc/100
* https://i.pravatar.cc/100
* https://i.pravatar.cc/100
*/

export function randAvatar<Options extends AvatarOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/aws-region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './aws-region.json';
*
* randAwsRegion({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'us-east-2'
* 'us-east-1'
* 'us-west-1'
*/

export function randAwsRegion<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/aws-request-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { fake, FakeOptions } from './core/core';
*
* randAwsRequestId({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 788k7v21-fa9h-0y1h-x6l8-rs8dpe1efc4y
* 5s3mlim3-737x-8ol6-d282-mg88umn271x5
* nm1dvo6p-uuj3-1l62-e131-lu249e634825
*/

export function randAwsRequestId<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/aws-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './aws-service.json';
*
* randAwsService({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'EC2'
* 'RDS'
* 'S3'
*/

export function randAwsService<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/baseball-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './baseball-team.json';
*
* randBaseballTeam({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Arizona Diamondbacks'
* 'Atlanta Braves'
* 'Baltimore Orioles'
*/

export function randBaseballTeam<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/basketball-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './basketball-team.json';
*
* randBasketballTeam({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Atlanta Hawks'
* 'Boston Celtics'
* 'Brooklyn Nets'
*/

export function randBasketballTeam<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/bear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { data } from './bear.json';
*
* randBear({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 'Spectacled bear'
* 'Brown bear'
* 'Asian black bear'
*/

export function randBear<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/between-date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ interface BetweenOptions extends FakeOptions {
*
* randBetweenDate({ from: new Date('10/07/2020'), to: new Date(), length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randBetweenDate<Options extends BetweenOptions = never>(
options: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/bic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import { randSwift, SwiftOptions } from './swift';
*
* randBic({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randBic<Options extends SwiftOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ import { FakeOptions, fake, getRandomInRange } from './core/core';
*
* randBinary({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* 10010000100010100000011001101101000111010010001000100
* 1011010110110110110010000110110101111111101111011100
* 1000000100101111001100101001010111000001000000101010
*/

export function randBinary<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/falso/src/lib/bird.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { data } from './bird.i18n.json';
*
* randBird({ length: 10 })
*
*
* @automaticallyGeneratedExamples
*/

export function randBird<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
7 changes: 7 additions & 0 deletions packages/falso/src/lib/bitcoin-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import { randSequence } from './sequence';
*
* randBitcoinAddress({ length: 10 })
*
*
* @automaticallyGeneratedExamples
* @example
* BiBwVceNYUIzZiIM3iT5Pfa11H9eXIeBN
* 4LWPPHhYOB0OIJg8gMamYBCkVWCe96TBn
* RDdJ4ZMgtiT6KnSmAAncSlpgr2DlOMV8V
*/

export function randBitcoinAddress<Options extends FakeOptions = never>(
options?: Options
) {
Expand Down
Loading