validators

Methods

(static) hasAudioExtension(path) → {boolean}

Test whether a file path has a valid video file extension

Parameters:
Name Type Description
path string

The image path to test

Returns:

Is the path valid?

Type
boolean

(static) hasImageExtension(path) → {boolean}

Test whether a file path has a valid image file extension or is base64 PNG data

Parameters:
Name Type Description
path String

The image path to test

Returns:

Is the path valid?

Type
boolean

(static) hasVideoExtension(path) → {boolean}

Test whether a file path has a valid audio file extension

Parameters:
Name Type Description
path string

The image path to test

Returns:

Is the path valid?

Type
boolean

(static) isBase64Image(data) → {boolean}

Test whether a data blob represents a base64 image

Parameters:
Name Type Description
data string

A base64 data string

Returns:

Is it a base64 image?

Type
boolean

(static) isColorString(color) → {boolean}

Test whether an input represents a valid 6-character color string

Parameters:
Name Type Description
color string

The input string to test

Returns:

Is the string a valid color?

Type
boolean

(static) isJSON(val) → {boolean}

Assert that the given value parses as a valid JSON string

Parameters:
Name Type Description
val string

The value to test

Returns:

Is the String valid JSON?

Type
boolean

(static) isValidId(id) → {boolean}

Test whether a string is a valid 16 character UID

Parameters:
Name Type Description
id string
Returns:
Type
boolean

(static) valueInArray(val, array) → {boolean}

Assert that the given value is in an array of allowed options

Parameters:
Name Type Description
val any

The value to test

array Array.<any>

The set of allowed options

Returns:

Is the valid included?

Type
boolean