2.3.0 • Published 3 years ago

@wbe/fake-data-utils v2.3.0

Weekly downloads
268
License
MIT
Repository
github
Last release
3 years ago

@wbe/fake-data-utils

Generate fake data image/text/video allowing to test UI components

npm.io npm.io npm.io npm.io npm.io

Installation

$ npm install -s @wbe/fake-data-utils

How to use

Import fakeDataUtils:

import { fakeDataUtils } from "@wbe/fake-data-utils";

API

getResponsiveImageData

Get an array of random IFakeImage objects.

getResponsiveImageData(pRatio, pBreakpoints);

Parameters

  • pRatio (number): Image ratio - default: 4 / 3
  • pBreakpoints (number[]): Breakpoints list - default: [640, 1024, 1440, 1920]

Returns

(Array) IFakeImage[]: Array of IFakeImage data object

Example

// will returned an array of IFakeImage object with 16/9 ratio
const responsiveImageData = FakeDataUtils.getResponsiveImageData(16 / 9);

getVideoUrl

Get a random video URL.

getVideoUrl(pFakeVideoType, pYoutubeId, pVimeoId);

Parameters

  • pFakeVideoType (EVideoType<YOUTUBE|VIMEO|NATIVE>): Type of video
  • pYoutubeId (string): Specify youtube ID to use - default: random ID
  • pVimeoId (string): Specify vimeo ID to use - default: random ID

Returns

(string): video URL

Example

// will returned a random youtube url
const youtubeUrl = FakeDataUtils.getVideoUrl(EVideoType.YOUTUBE);

getVideoId

Get a random video ID.

getVideoId(pFakeVideoType);

Parameters

  • pFakeVideoType (EVideoType<YOUTUBE|VIMEO>): Type of video

Returns

(string): video ID

Example

// will returned a random vimeo id
const vimeoUrl = FakeDataUtils.getVideoId(EVideoType.VIMEO);

getTitle

Get a random title.

getTitle(pWords);

Parameters

  • pWords (number): Number of words - default: 1

Returns

(string): title

Example

// will returned two random words
const title = FakeDataUtils.getTitle(2);

getText

Get random text.

getText(pSentencies);

Parameters

  • pSentencies (number): Number of sentencies - default: 1

Returns

(string): text

Example

// will returned four random sentencies
const text = FakeDataUtils.getText(4);
2.3.0

3 years ago

2.2.0-alpha.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

2.0.0-alpha.11

3 years ago

2.0.0-alpha.10

3 years ago

2.0.0-alpha.7

3 years ago

2.0.0-alpha.6

3 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.0

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.2

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.2

4 years ago

1.4.2-alpha.0

4 years ago

1.4.1

4 years ago

1.4.0-alpha.0

4 years ago

1.4.0-alpha.1

4 years ago

1.4.0

4 years ago

1.3.1-alpha.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1-alpha.0

4 years ago

1.1.0-alpha.0

4 years ago

1.0.0-alpha.0

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago