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
No related branches found
No related tags found
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 * Property-Keys
* @author schukai GmbH * @author schukai GmbH
...@@ -10,7 +8,6 @@ export { ...@@ -10,7 +8,6 @@ export {
internalStateSymbol internalStateSymbol
} }
/** /**
* @private * @private
* @type {symbol} * @type {symbol}
......
/** /**
* Namespace for math. * Namespace for math.
* *
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,8 +5,6 @@ ...@@ -7,8 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {getGlobal} from '../types/global.mjs'; import {getGlobal} from '../types/global.mjs';
export {random} export {random}
...@@ -16,14 +12,6 @@ export {random} ...@@ -16,14 +12,6 @@ export {random}
/** /**
* this function uses crypt and returns a random number. * 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} min starting value of the definition set (default is 0)
* @param {number} max end value of the definition set (default is 1000000000) * @param {number} max end value of the definition set (default is 1000000000)
* @returns {number} * @returns {number}
...@@ -59,7 +47,6 @@ export {random} ...@@ -59,7 +47,6 @@ export {random}
*/ */
var MAX = 1000000000; var MAX = 1000000000;
Math.log2 = Math.log2 || function (n) { Math.log2 = Math.log2 || function (n) {
return Math.log(n) / Math.log(2); return Math.log(n) / Math.log(2);
}; };
......
/** /**
* @license * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Copyright 2021 schukai GmbH * 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 * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL
* @author schukai GmbH
*/ */
/** /**
* Main namespace for Monster. * Main namespace for Monster.
* *
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,7 +5,6 @@ ...@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {internalSymbol} from "../constants.mjs"; import {internalSymbol} from "../constants.mjs";
import {extend} from "../data/extend.mjs"; import {extend} from "../data/extend.mjs";
import {Pipe} from "../data/pipe.mjs"; import {Pipe} from "../data/pipe.mjs";
...@@ -55,13 +52,6 @@ const workingDataSymbol = Symbol('workingData'); ...@@ -55,13 +52,6 @@ const workingDataSymbol = Symbol('workingData');
* *
* Look at the example below. The placeholders use the logic of Pipe. * 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 * ## Marker in marker
* *
* Markers can be nested. Here, the inner marker is resolved first `${subkey} ↦ 1 = ${mykey2}` and then the outer marker `${mykey2}`. * Markers can be nested. Here, the inner marker is resolved first `${subkey} ↦ 1 = ${mykey2}` and then the outer marker `${mykey2}`.
......
/** /**
* Namespace for texts. * Namespace for texts.
* *
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,8 +5,6 @@ ...@@ -7,8 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {getGlobal} from '../types/global.mjs'; import {getGlobal} from '../types/global.mjs';
import {isArray, isFunction, isObject, isPrimitive} from '../types/is.mjs'; import {isArray, isFunction, isObject, isPrimitive} from '../types/is.mjs';
import {typeOf} from "../types/typeof.mjs"; import {typeOf} from "../types/typeof.mjs";
...@@ -25,13 +21,6 @@ export {clone} ...@@ -25,13 +21,6 @@ export {clone}
* *
* If an object has a method `getClone()`, this method is used to create the 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 * @param {*} obj object to be cloned
* @returns {*} * @returns {*}
* @license AGPLv3 * @license AGPLv3
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,7 +5,6 @@ ...@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {Base} from '../types/base.mjs'; import {Base} from '../types/base.mjs';
import {isFunction} from '../types/is.mjs'; import {isFunction} from '../types/is.mjs';
...@@ -16,13 +13,6 @@ export {Comparator} ...@@ -16,13 +13,6 @@ export {Comparator}
/** /**
* The comparator allows a comparison function to be abstracted. * 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. * The following are some examples of the application of the class.
* *
* ``` * ```
...@@ -41,19 +31,7 @@ export {Comparator} ...@@ -41,19 +31,7 @@ export {Comparator}
* }).equal({v: 2}, {v: 2}); // ↦ true * }).equal({v: 2}, {v: 2}); // ↦ true
* ``` * ```
* *
* @example * @externalExample ../../example/util/comparator.mjs
*
* 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
*
* @license AGPLv3 * @license AGPLv3
* @since 1.3.0 * @since 1.3.0
* @memberOf Monster.Util * @memberOf Monster.Util
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,7 +5,6 @@ ...@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {internalSymbol} from "../constants.mjs"; import {internalSymbol} from "../constants.mjs";
import {Base} from "../types/base.mjs"; import {Base} from "../types/base.mjs";
...@@ -19,24 +16,7 @@ export {DeadMansSwitch} ...@@ -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. * The dead man's switch allows to set a timer which can be reset again and again within a defined period of time.
* *
* ``` * @externalExample ../../example/util/deadmansswitch.mjs
* <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
*
* @copyright schukai GmbH * @copyright schukai GmbH
* @license AGPLv3 * @license AGPLv3
* @since 1.29.0 * @since 1.29.0
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,7 +5,6 @@ ...@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {validateObject} from '../types/validate.mjs'; import {validateObject} from '../types/validate.mjs';
export {deepFreeze} export {deepFreeze}
...@@ -15,13 +12,6 @@ export {deepFreeze} ...@@ -15,13 +12,6 @@ export {deepFreeze}
/** /**
* Deep freeze a object * 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 * @param {object} object object to be freeze
* @license AGPLv3 * @license AGPLv3
* @since 1.0.0 * @since 1.0.0
......
/** /**
* Namespace for utilities. * Namespace for utilities.
* *
......
/** /**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster * Node module: @schukai/monster
...@@ -7,7 +5,6 @@ ...@@ -7,7 +5,6 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/ */
import {internalSymbol} from "../constants.mjs"; import {internalSymbol} from "../constants.mjs";
import {Base} from "../types/base.mjs"; import {Base} from "../types/base.mjs";
import {getGlobalFunction} from "../types/global.mjs"; import {getGlobalFunction} from "../types/global.mjs";
...@@ -76,32 +73,7 @@ class Callback { ...@@ -76,32 +73,7 @@ class Callback {
* *
* The result of `run()` is a promise. * The result of `run()` is a promise.
* *
* ``` * @externalExample ../../example/util/processing.mjs
* <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"
* })
*
* @copyright schukai GmbH * @copyright schukai GmbH
* @license AGPLv3 * @license AGPLv3
* @since 1.21.0 * @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