Namespace for utilities.
Classes
- Comparator
create new comparator
.- DeadMansSwitch
Class to be able to execute function chains
- Processing
Class to be able to execute function chains
Members
(static, constant) ENV_AWS_LAMBDA :string
- string
(static, constant) ENV_BROWSER :string
- string
(static, constant) ENV_DENO :string
- string
(static, constant) ENV_ELECTRON :string
- string
(static, constant) ENV_GOOGLE_FUNCTIONS :string
- string
(static, constant) ENV_NODE :string
- string
(static, constant) ENV_UNKNOWN :string
- string
(static, constant) ENV_WEB_WORKER :string
- string
Methods
(static) clone(obj) → {*}
With this function, objects can be cloned. The entire object tree is run through.
Proxy, Element, HTMLDocument and DocumentFragment instances are not cloned. Global objects such as windows are also not cloned,
If an object has a method getClone()
, this method is used to create the clone.
Name | Type | Description |
---|---|---|
obj | * | object to be cloned |
- Since
- 1.0.0
- Copyright
- schukai GmbH
- License
- AGPLv3
unable to clone obj! its type isn't supported.
- Type
- Error
- Type:
- *
(static) deepFreeze(object) → {object}
Deep freeze a object
.Deep freeze a object
Name | Type | Description |
---|---|---|
object | object | object to be freeze |
- Since
- 1.0.0
- Copyright
- schukai GmbH
- License
- AGPLv3
value is not a object
- Type
- TypeError
- Type:
- object
(static) detectRuntimeEnvironment() → {string}
Detects and returns the current runtime environment.
- 'aws-lambda': AWS Lambda environment
- 'google-functions': Google Cloud Functions environment
- 'electron': Electron environment
- 'node': Node.js environment
- 'browser': Browser environment
- 'web-worker': Web Worker environment
- 'deno': Deno environment
- 'react-native': React Native environment
- 'unknown': Unknown environment
- Since
- 3.34.0
The detected runtime environment. Possible values are:
- Type:
- string
(static) trimSpaces(value) → {string}
This special trim function allows to trim spaces that have been protected by a special escape character.
<script type="module">
import {trimSpaces} from '@schukai/monster/source/util/trimspaces.mjs';
trimSpaces(' hello \\ ')
</script>
Hint: One stroke is escaped by the javascript interpreter, the second stroke escapes the stroke.
a\ b ↦ a b
a\\ b ↦ a\ b
Name | Type | Description |
---|---|---|
value | string |
- Since
- 1.24.0
- Copyright
- schukai GmbH
- License
- AGPLv3
value is not a string
- Type
- TypeError
- Type:
- string
Type Definitions
exampleCallback(a, b) → {integer}
This is the description for the callback function used by the operator
new Comparator(function (a, b) {
if (a.v === b.v) return 0;
return a.v < b.v ? -1 : 1;
}).equal({v: 2}, {v: 2}); // ↦ true
.This is the description for the callback function used by the operator
new Comparator(function (a, b) {
if (a.v === b.v) return 0;
return a.v < b.v ? -1 : 1;
}).equal({v: 2}, {v: 2}); // ↦ true
Name | Type | Description |
---|---|---|
a | * | |
b | * |
-1, 0 or 1
- Type:
- integer