Skip to content
Snippets Groups Projects
Verified Commit 14152bb2 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: commit save point

parent 8d723997
Branches
Tags
No related merge requests found
Showing
with 44 additions and 131 deletions
import {Comparator} from '@schukai/monster/source/util/comparator.mjs';
console.log(new Comparator().lessThanOrEqual(2, 5))
// ↦ true
console.log(new Comparator().greaterThan(4, 2))
// ↦ true
console.log(new Comparator().equal(4, 4))
// ↦ true
console.log(new Comparator().equal(4, 5))
// ↦ false
import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
const deadmansswitch = new DeadMansSwitch(100, () => {
console.log('yeah!')
// ↦ "yeah!"
})
deadmansswitch.touch(); // from here wait again 100 ms
deadmansswitch.touch(200); // from here wait 200 ms
import {Processing} from '@schukai/monster/source/util/processing.mjs';
let startTime = +new Date();
new Processing((url) => {
return fetch(url)
}, (response) => {
// do something with the response
console.log(response.status, +new Date() - startTime)
}, 200, () => {
// this function is called 200 seconds after fetch is received.
console.log('finished', +new Date() - startTime)
return 'done'
}).run('https://monsterjs.org/assets/world.json').then(r => {
console.log(r)
// ↦ "done"
})
/**
* Property-Keys
* @author schukai GmbH
......@@ -10,7 +8,6 @@ export {
internalStateSymbol
}
/**
* @private
* @type {symbol}
......
/**
* Namespace for math.
*
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,8 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {getGlobal} from '../types/global.mjs';
export {random}
......@@ -16,14 +12,6 @@ export {random}
/**
* this function uses crypt and returns a random number.
*
* ```
* <script type="module">
* import {random} from '@schukai/monster/source/math/random.mjs';
* random(1,10)
* // ↦ 5
* </script>
* ```
*
* @param {number} min starting value of the definition set (default is 0)
* @param {number} max end value of the definition set (default is 1000000000)
* @returns {number}
......@@ -59,7 +47,6 @@ export {random}
*/
var MAX = 1000000000;
Math.log2 = Math.log2 || function (n) {
return Math.log(n) / Math.log(2);
};
......
/**
* @license
* Copyright 2021 schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
* SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL
* @author schukai GmbH
*/
/**
* Main namespace for Monster.
*
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../constants.mjs";
import {extend} from "../data/extend.mjs";
import {Pipe} from "../data/pipe.mjs";
......@@ -55,13 +52,6 @@ const workingDataSymbol = Symbol('workingData');
*
* Look at the example below. The placeholders use the logic of Pipe.
*
* ```
* <script type="module">
* import {Formatter} from '@schukai/monster/source/text/formatter.mjs';
* new Formatter()
* </script>
* ```
*
* ## Marker in marker
*
* Markers can be nested. Here, the inner marker is resolved first `${subkey} ↦ 1 = ${mykey2}` and then the outer marker `${mykey2}`.
......
/**
* Namespace for texts.
*
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,8 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {getGlobal} from '../types/global.mjs';
import {isArray, isFunction, isObject, isPrimitive} from '../types/is.mjs';
import {typeOf} from "../types/typeof.mjs";
......@@ -25,13 +21,6 @@ export {clone}
*
* If an object has a method `getClone()`, this method is used to create the clone.
*
* ```
* <script type="module">
* import {clone} from '@schukai/monster/source/util/clone.mjs';
* clone({})
* </script>
* ```
*
* @param {*} obj object to be cloned
* @returns {*}
* @license AGPLv3
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {Base} from '../types/base.mjs';
import {isFunction} from '../types/is.mjs';
......@@ -16,13 +13,6 @@ export {Comparator}
/**
* The comparator allows a comparison function to be abstracted.
*
* ```
* <script type="module">
* import {Comparator} from '@schukai/monster/source/util/comparator.mjs';
* console.log(new Comparator())
* </script>
* ```
*
* The following are some examples of the application of the class.
*
* ```
......@@ -41,19 +31,7 @@ export {Comparator}
* }).equal({v: 2}, {v: 2}); // ↦ true
* ```
*
* @example
*
* import {Comparator} from '@schukai/monster/source/util/comparator.mjs';
*
* console.log(new Comparator().lessThanOrEqual(2, 5))
* // ↦ true
* console.log(new Comparator().greaterThan(4, 2))
* // ↦ true
* console.log(new Comparator().equal(4, 4))
* // ↦ true
* console.log(new Comparator().equal(4, 5))
* // ↦ false
*
* @externalExample ../../example/util/comparator.mjs
* @license AGPLv3
* @since 1.3.0
* @memberOf Monster.Util
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../constants.mjs";
import {Base} from "../types/base.mjs";
......@@ -19,24 +16,7 @@ export {DeadMansSwitch}
/**
* The dead man's switch allows to set a timer which can be reset again and again within a defined period of time.
*
* ```
* <script type="module">
* import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
* new DeadMansSwitch();
* </script>
* ```
*
* @example
* import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
*
* const deadmansswitch = new DeadMansSwitch(100, ()=>{
* console.log('yeah!')
* // ↦ "yeah!"
* })
*
* deadmansswitch.touch(); // from here wait again 100 ms
* deadmansswitch.touch(200); // from here wait 200 ms
*
* @externalExample ../../example/util/deadmansswitch.mjs
* @copyright schukai GmbH
* @license AGPLv3
* @since 1.29.0
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {validateObject} from '../types/validate.mjs';
export {deepFreeze}
......@@ -15,13 +12,6 @@ export {deepFreeze}
/**
* Deep freeze a object
*
* ```
* <script type="module">
* import {deepFreeze} from '@schukai/monster/source/util/freeze.mjs';
* deepFreeze({})
* </script>
* ```
*
* @param {object} object object to be freeze
* @license AGPLv3
* @since 1.0.0
......
/**
* Namespace for utilities.
*
......
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
......@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../constants.mjs";
import {Base} from "../types/base.mjs";
import {getGlobalFunction} from "../types/global.mjs";
......@@ -76,32 +73,7 @@ class Callback {
*
* The result of `run()` is a promise.
*
* ```
* <script type="module">
* import {Processing} from '@schukai/monster/source/util/processing.mjs';
* new Processing();
* </script>
* ```
*
* @example
* import {Processing} from '@schukai/monster/source/util/processing.mjs';
*
* let startTime = +new Date();
*
* new Processing((url)=>{
* return fetch(url)
* },(response)=>{
* // do something with the response
* console.log(response.status, +new Date()-startTime)
* },200,()=>{
* // this function is called 200 seconds after fetch is received.
* console.log('finished', +new Date()-startTime)
* return 'done'
* }).run('https://monsterjs.org/assets/world.json').then(r=>{
* console.log(r)
* // ↦ "done"
* })
*
* @externalExample ../../example/util/processing.mjs
* @copyright schukai GmbH
* @license AGPLv3
* @since 1.21.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment