Generate fake data image/text/video allowing to test UI components
$ npm install -s @wbe/fake
Import Fake
:
import Fake from "@wbe/fake";
Get an array of random IFakeImage objects.
responsiveImageData(pRatio, pBreakpoints);
pRatio (number)
: Image ratio - default:4 / 3
pBreakpoints (number[])
: Breakpoints list - default:[640, 1024, 1440, 1920]
(Array) IFakeImage[]
: Array of IFakeImage data object
// will returned an array of IFakeImage object with 16/9 ratio
const responsiveImageData = Fake.responsiveImageData(16 / 9);
Get a random video URL.
videoUrl(pFakeVideoType, pYoutubeId, pVimeoId);
pFakeVideoType (EVideoType<YOUTUBE|VIMEO|NATIVE>)
: Type of videopYoutubeId (string)
: Specify youtube ID to use - default: random IDpVimeoId (string)
: Specify vimeo ID to use - default: random ID
(string)
: video URL
// will returned a random youtube url
const youtubeUrl = Fake.videoUrl(EVideoType.YOUTUBE);
Get a random video ID.
videoId(pFakeVideoType);
pFakeVideoType (EVideoType<YOUTUBE|VIMEO>)
: Type of video
(string)
: video ID
// will returned a random vimeo id
const vimeoUrl = Fake.videoId(EVideoType.VIMEO);
Get a random title.
title(pWords);
pWords (number)
: Number of words - default:1
(string)
: title
// will returned two random words
const title = Fake.title(2);
Get random text.
text(pSentencies);
pSentencies (number)
: Number of sentencies - default:1
(string)
: text
// will returned four random sentencies
const text = Fake.text(4);