Types

Monster. Types

Namespace for types.

Author:
  • schukai GmbH

Classes

Base
BaseWithOptions
DataUrl
ID
MediaType
Observer
ObserverList
ProxyObserver
Queue

A Queue (Fifo)

RandomID

class to generate random numbers

Stack
TokenList
UniqueQueue

A queue for unique values

Version

The version object contains a sematic version number

Methods

# (static) fromBinary(binary) → {String}

You can call the function via the monster namespace Monster.Types.fromBinary().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/binary.js';
Monster.Types.fromBinary()
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {fromBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/binary.js';
fromBinary()
</script>
Parameters:
Name Type Description
binary String
Since:
  • 1.18.0
Throws:

value is not a string

Type
TypeError
Returns:
Type
String

# (static) getGlobal() → {objec}

Return globalThis

If globalThis is not available, it will be polyfilled

Since:
  • 1.6.0
Returns:

globalThis

Type
objec

# (static) getGlobalFunction(name) → {objec}

Return global function or throw Error

You can call the method via the monster namespace Monster.Types.getGlobalFunction().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/global.js';
console.log(Monster.Types.getGlobalFunction('parseInt')) // ↦ f parseInt() { }
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/global.js';
console.log(getGlobalFunction('parseInt')) // ↦ f parseInt() { }
</script>
Parameters:
Name Type Description
name string
Since:
  • 1.6.0
Throws:
  • value is not a function

    Type
    TypeError
  • the function is not defined

    Type
    Error
  • value is not a string

    Type
    TypeError
Returns:
Type
objec

# (static) getGlobalObject(name) → {objec}

Return global object or throw Error

You can call the method via the monster namespace Monster.Types.getGlobalObject().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/global.js';
console.log(Monster.Types.getGlobalObject('document')) // ↦ { }
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/global.js';
console.log(getGlobalObject('document')) // ↦ { }
</script>
Parameters:
Name Type Description
name string
Since:
  • 1.6.0
Throws:
  • the object is not defined

    Type
    Error
  • value is not a object

    Type
    TypeError
  • value is not a string

    Type
    TypeError
Returns:
Type
objec

# (static) isArray(value) → {boolean}

checks whether the value passed is a array

you can call the method via the monster namespace Monster.Types.isArray().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isArray('2')) // ↦ false
console.log(Monster.Types.isArray([])) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isArray('2'))  // ↦ false
console.log(isArray([]))  // ↦ true
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isBoolean(value) → {boolean}

Checks whether the value passed is a boolean

You can call the method via the monster namespace Monster.Types.isBoolean().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isBoolean('2')) // ↦ false
console.log(Monster.Types.isBoolean([])) // ↦ false
console.log(Monster.Types.isBoolean(true)) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isBoolean('2'))  // ↦ false
console.log(isBoolean([]))  // ↦ false
console.log(isBoolean(2>4))  // ↦ true
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isFunction(value) → {boolean}

checks whether the value passed is a function

you can call the method via the monster namespace Monster.Types.isFunction().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isFunction(()=>{})) // ↦ true
console.log(Monster.Types.isFunction('2')) // ↦ false
console.log(Monster.Types.isFunction([])) // ↦ false
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isFunction(()=>{})) // ↦ true
console.log(isFunction('2'))  // ↦ false
console.log(isFunction([]))  // ↦ false
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isInstance(value, instance) → {boolean}

checks whether the value passed is a object and instance of instance

you can call the method via the monster namespace Monster.Types.isInstance().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isInstance('2')) // ↦ false
console.log(Monster.Types.isInstance([])) // ↦ false
console.log(Monster.Types.isInstance({})) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isInstance('2'))  // ↦ false
console.log(isInstance([]))  // ↦ false
</script>
Parameters:
Name Type Description
value *
instance *
Since:
  • 1.5.0
Returns:
Type
boolean

# (static) isInteger(value) → {boolean}

checks whether the value passed is an integer

you can call the method via the monster namespace Monster.Types.isFunction().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isInteger(()=>{})) // ↦ true
console.log(Monster.Types.isInteger('2')) // ↦ false
console.log(Monster.Types.isInteger(2)) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isInteger(()=>{})) // ↦ true
console.log(isInteger('2'))  // ↦ false
console.log(isInteger(2))  // ↦ true
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.4.0
Returns:
Type
boolean

# (static) isIterable(value) → {boolean}

With this function you can check if a value is iterable

You can call the method via the monster namespace Monster.Types.isPrimitive().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isIterable(null)) // ↦ false
console.log(Monster.Types.isIterable('hello')) // ↦ true
console.log(Monster.Types.isIterable([])) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isIterable(null))  // ↦ false
console.log(isIterable('hello'))  // ↦ true
console.log(isIterable([]))  // ↦ true
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.2.0
Returns:
Type
boolean

# (static) isObject(value) → {boolean}

checks whether the value passed is a object

you can call the method via the monster namespace Monster.Types.isObject().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isObject('2')) // ↦ false
console.log(Monster.Types.isObject([])) // ↦ false
console.log(Monster.Types.isObject({})) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isObject('2'))  // ↦ false
console.log(isObject([]))  // ↦ false
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isPrimitive(value) → {boolean}

Checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol)

You can call the method via the monster namespace Monster.Types.isPrimitive().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isPrimitive('2')) // ↦ false
console.log(Monster.Types.isPrimitive([])) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isPrimitive('2'))  // ↦ true
console.log(isPrimitive([]))  // ↦ false
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isString(value) → {boolean}

checks whether the value passed is a string

you can call the method via the monster namespace Monster.Types.isString().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isString('2')) // ↦ true
console.log(Monster.Types.isString([])) // ↦ false
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isString('2'))  // ↦ true
console.log(isString([]))  // ↦ false
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Returns:
Type
boolean

# (static) isSymbol(value) → {boolean}

Checks whether the value passed is a symbol

You can call the method via the monster namespace Monster.Types.isSymbol().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(Monster.Types.isSymbol('2')) // ↦ false
console.log(Monster.Types.isSymbol(Symbol('test')) // ↦ true
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/is.js';
console.log(isSymbol(Symbol('a')))  // ↦ true
console.log(isSymbol([])  // ↦ false
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.9.0
Returns:
Type
boolean

# (static) parseDataURL(dataurl) → {Monster.Types.DataUrl}

You can call the function via the monster namespace Monster.Types.parseDataURL().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/dataurl.js';
console.log(Monster.Types.parseDataURL())
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/dataurl.js';
console.log(parseDataURL())
</script>

Specification:

dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype  := [ type "/" subtype ] *( ";" parameter )
data       := *urlchar
parameter  := attribute "=" value
Parameters:
Name Type Description
dataurl String
Throws:
  • incorrect or missing data protocol

    Type
    TypeError
  • malformed data url

    Type
    TypeError
Returns:
Type
Monster.Types.DataUrl

# (static) parseMediaType(mediatype) → {Monster.Types.MediaType}

You can call the function via the monster namespace Monster.Types.parseMediaType().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/dataurl.js';
console.log(Monster.Types.parseMediaType())
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/dataurl.js';
console.log(parseMediaType())
</script>

Specification:

dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype  := [ type "/" subtype ] *( ";" parameter )
data       := *urlchar
parameter  := attribute "=" value
Parameters:
Name Type Description
mediatype String
Throws:
  • the mimetype can not be parsed

    Type
    TypeError
  • blank value is not allowed

    Type
    TypeError
  • malformed data url

    Type
    TypeError
Returns:
Type
Monster.Types.MediaType

# (static) toBinary(binary) → {String}

You can call the function via the monster namespace Monster.Types.toBinary().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/binary.js';
Monster.Types.toBinary()
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {toBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/binary.js';
toBinary()
</script>
Parameters:
Name Type Description
binary String
Since:
  • 1.18.0
Throws:

value is not a string

Type
TypeError
Returns:
Type
String

# (static) typeOf(value) → {string}

The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result.

You can call the method via the monster namespace Monster.Types.typeOf().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/typeof.js';
console.log(Monster.Types.typeOf())
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/typeof.js';
console.log(typeOf())
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.7.0
Throws:

value is not a primitive

Type
TypeError
Returns:
Type
string
Example
import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/typeof.js';

console.log(typeOf(undefined)); // ↦ undefined
console.log(typeOf("")); // ↦ string
console.log(typeOf(5)); // ↦ number
console.log(typeOf({})); // ↦ object
console.log(typeOf([])); // ↦ array
console.log(typeOf(new Map)); // ↦ map
console.log(typeOf(true)); // ↦ boolean

# (static) validateArray(value) → {*}

This method checks if the type matches the array type. this function is identical to isArray() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateArray().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateArray('2')) // ↦ TypeError
console.log(Monster.Types.validateArray([])) // ↦ value
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateArray('2'))  // ↦ TypeError
console.log(validateArray([]))  // ↦ value
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Throws:

value is not an array

Type
TypeError
Returns:
Type
*

# (static) validateBoolean(value) → {*}

This method checks if the type matches the boolean type. this function is identical to isBoolean() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateBoolean().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateBoolean(true)) // ↦ value
console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError
console.log(Monster.Types.validateBoolean([])) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateBoolean(false))  // ↦ value
console.log(validateBoolean('2'))  // ↦ TypeError
console.log(validateBoolean([]))  // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Throws:

value is not primitive

Type
TypeError
Returns:
Type
*

# (static) validateFunction(value) → {*}

This method checks if the type matches the function type. this function is identical to isFunction() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateFunction().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateFunction(()=>{})) // ↦ value
console.log(Monster.Types.validateFunction('2')) // ↦ TypeError
console.log(Monster.Types.validateFunction([])) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateFunction(()=>{})) // ↦ value
console.log(validateFunction('2'))  // ↦ TypeError
console.log(validateFunction([]))  // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Throws:

value is not a function

Type
TypeError
Returns:
Type
*

# (static) validateInstance(value) → {*}

This method checks if the type matches the object instance.

You can call the method via the monster namespace Monster.Types.validateInstance().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateInstance({}, Object)) // ↦ value
console.log(Monster.Types.validateInstance('2', Object)) // ↦ TypeError
console.log(Monster.Types.validateInstance([], Object)) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateInstance({}, Object)) // ↦ value
console.log(validateInstance('2', Object)) // ↦ TypeError
console.log(validateInstance([], Object)) // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.5.0
Throws:

value is not an instance of

Type
TypeError
Returns:
Type
*

# (static) validateInteger(value) → {*}

This method checks if the type is an integer. this function is identical to isInteger() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateInteger().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateInteger(true)) // ↦ TypeError
console.log(Monster.Types.validateInteger('2')) // ↦ TypeError
console.log(Monster.Types.validateInteger(2)) // ↦ value
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateInteger(true)) // ↦ TypeError
console.log(validateInteger('2'))  // ↦ TypeError
console.log(validateInteger(2))  // ↦ value
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.4.0
Throws:

value is not an integer

Type
TypeError
Returns:
Type
*

# (static) validateIterable(value) → {*}

This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validatePrimitive().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateIterable('2')) // ↦ TypeError
console.log(Monster.Types.validateIterable([])) // ↦ value
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateIterable('2'))  // ↦ TypeError
console.log(validateIterable([]))  // ↦ value
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.2.0
See:
Throws:

value is not a primitive

Type
TypeError
Returns:
Type
*

# (static) validateObject(value) → {*}

This method checks if the type matches the object type. this function is identical to isObject() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateObject().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateObject({})) // ↦ value
console.log(Monster.Types.validateObject('2')) // ↦ TypeError
console.log(Monster.Types.validateObject([])) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateObject({}))  // ↦ value
console.log(validateObject('2'))  // ↦ TypeError
console.log(validateObject([]))  // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Throws:

value is not a object

Type
TypeError
Returns:
Type
*

# (static) validatePrimitive(value) → {*}

This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validatePrimitive().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validatePrimitive('2')) // ↦ value
console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validatePrimitive('2'))  // ↦ value
console.log(validatePrimitive([]))  // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
See:
Throws:

value is not a primitive

Type
TypeError
Returns:
Type
*

# (static) validateString(value) → {*}

This method checks if the type matches the string type. this function is identical to isString() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateString().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateString('2')) // ↦ value
console.log(Monster.Types.validateString([])) // ↦ TypeError
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateString('2'))  // ↦ value
console.log(validateString([]))  // ↦ TypeError
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.0.0
Throws:

value is not a string

Type
TypeError
Returns:
Type
*

# (static) validateSymbol(value) → {*}

This method checks if the type matches the symbol type. this function is identical to isSymbol() except that a TypeError is thrown.

You can call the method via the monster namespace Monster.Types.validateSymbol().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(Monster.Types.validateSymbol('2')) // ↦ TypeError
console.log(Monster.Types.validateSymbol([])) // ↦ value
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/types/validate.js';
console.log(validateSymbol('2'))  // ↦ TypeError
console.log(validateSymbol())  // ↦ value
</script>
Parameters:
Name Type Description
value *
Since:
  • 1.9.0
Throws:

value is not an symbol

Type
TypeError
Returns:
Type
*

Type Definitions

# Parameter

Type:
  • Object
Properties
Name Type Description
key string
value string