JSPM

@wbe/fake

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q17850F
  • License MIT

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

Package Exports

  • @wbe/fake

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wbe/fake) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@wbe/fake

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

Installation

$ npm install -s @wbe/fake

How to use

Import Fake:

import Fake from "@wbe/fake";

API

responsiveImageData

Get an array of random IFakeImage objects.

responsiveImageData(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 = Fake.responsiveImageData(16 / 9);

videoUrl

Get a random video URL.

videoUrl(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 = Fake.videoUrl(EVideoType.YOUTUBE);

videoId

Get a random video ID.

videoId(pFakeVideoType);

Parameters

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

Returns

(string): video ID

Example

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

title

Get a random title.

title(pWords);

Parameters

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

Returns

(string): title

Example

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

text

Get random text.

text(pSentencies);

Parameters

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

Returns

(string): text

Example

// will returned four random sentencies
const text = Fake.text(4);