All pages
Powered by GitBook
1 of 4

Classes

All the classes available for the current version.

Available Classes

  • Random - The random class includes all random things from advice to topic.

  • Util - The pacakge basic info and testing.

Go to

RandomUtil

Generation

The class for generating secure IDs, formatting time and much more...

Please make sure you do not instantiate this class. You can access it throughconst somethingRandom = require('some-random-cat').Generation

Methods </ >

.formatTime(time) STATIC </ >

Generation method to format time to 00:00

PARAMETER

TYPE

OPTIONAL

DEFAULT

DESCRIPTION

time

Number

❌

none

The time to format.

Returns: Promise<String>

.generateId(options) STATIC </ >

Generation method to secure a well secure UUID.

PARAMETER

TYPE

OPTIONAL

DEFAULT

DESCRIPTION

options

Object

✅

none

The options for the ID.

options.putDash

Boolean

✅

true

Whether or not to put a -

Returns: Promise<String>

.getAcronym(name) STATIC </ >

Generation method to get acronym for a string.

PARAMETER

TYPE

OPTIONAL

DEFAULT

DESCRIPTION

name

String

❌

none

The string to get acronym for.

Returns: Promise<String>

.shorten(text, length) STATIC </ >

Generation method to shorten a string by length.

PARAMETER

TYPE

OPTIONAL

DEFAULT

DESCRIPTION

text

String

❌

none

The string to shorten.

length

Number

❌

none

The length to shorten.

Returns: Promise<String>

Random

The class for generating random things such as cat images, dog images, jokes and much more!

Please make sure you do not instantiate this class. You can access it though const something = require('some-random-cat').Random

Methods </ >

.getAdvice() STATIC </ >

Random method to generate an advice.

Type

Description

any

The string with the advice.

Returns: Promise<Pending>

.getCat() STATIC </ >

Random method to generate a random cat image.

Type

Description

any

URL for the image.

Returns: Promise<Pending>

.getDog() STATIC </ >

Random method to generate a random dog image.

Type

Description

any

URL for the image.

Returns: Promise<Pending>

.getFact() STATIC </ >

Random method to generate a random fact.

Type

Description

any

The string for the fact.

Returns: Promise<Pending>

.getJoke() STATIC </ >

Random method to generate a random joke.

Type

Description

any

An object with the title, description and URL

Returns: Promise<Pending>

.getMeme(sub) STATIC </ >

Random method to generate a meme.

Parameters

Type

Optional

Description

sub

String

❌

The subreddit to get the meme from.

Returns: Promise<Pending>

.getString(number) STATIC </ >

Gets a random string of a length.

Parameters

Type

Optional

Description

number

Number

❌

The length of the string.

Returns: Promise<Pending>

.getTopic() STATIC </ >

Random method to generate a topic.

Type

Description

any

The string with the topic.

Returns:Promise<Pending>

Util

The class for getting information on the package or testing it.

Please make sure you do not instantiate this class. You can access it though const something = require('some-random-cat').Util

Properties

.info STATIC

The general information for the package.

PARAMETER

TYPE

DESCRIPTION

author

String

The author(s) of the package.

description

String

The description of the package.

repo

Object

Current repository(s) of the package.

version

String

The version of the package.

Type: ?Object

Methods

.test() STATIC

Random method to generate an advice.

Type

Description

any

Tests the package and retrieves an error(if any).

Returns: Promise<Pending>

Examples:

const somethingRandom = require('some-random-cat').Util
somethingRandom.test()