From 14152bb2163e2625315f83de68e191b53d020df6 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 9 Aug 2022 19:57:41 +0200 Subject: [PATCH] chore: commit save point --- application/example/util/comparator.mjs | 10 +++++++ application/example/util/deadmansswitch.mjs | 9 +++++++ application/example/util/processing.mjs | 17 ++++++++++++ application/source/constants.mjs | 3 --- application/source/math/namespace.mjs | 2 -- application/source/math/random.mjs | 13 --------- application/source/monster.mjs | 10 +++---- application/source/text/formatter.mjs | 10 ------- application/source/text/namespace.mjs | 2 -- application/source/util/clone.mjs | 11 -------- application/source/util/comparator.mjs | 24 +---------------- application/source/util/deadmansswitch.mjs | 22 +-------------- application/source/util/freeze.mjs | 10 ------- application/source/util/namespace.mjs | 2 -- application/source/util/processing.mjs | 30 +-------------------- 15 files changed, 44 insertions(+), 131 deletions(-) create mode 100644 application/example/util/comparator.mjs create mode 100644 application/example/util/deadmansswitch.mjs create mode 100644 application/example/util/processing.mjs diff --git a/application/example/util/comparator.mjs b/application/example/util/comparator.mjs new file mode 100644 index 000000000..401af78e5 --- /dev/null +++ b/application/example/util/comparator.mjs @@ -0,0 +1,10 @@ +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 diff --git a/application/example/util/deadmansswitch.mjs b/application/example/util/deadmansswitch.mjs new file mode 100644 index 000000000..344fc8aad --- /dev/null +++ b/application/example/util/deadmansswitch.mjs @@ -0,0 +1,9 @@ +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 diff --git a/application/example/util/processing.mjs b/application/example/util/processing.mjs new file mode 100644 index 000000000..ff05bf8d9 --- /dev/null +++ b/application/example/util/processing.mjs @@ -0,0 +1,17 @@ +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" +}) diff --git a/application/source/constants.mjs b/application/source/constants.mjs index 2d91c35c4..15bb6eb3a 100644 --- a/application/source/constants.mjs +++ b/application/source/constants.mjs @@ -1,5 +1,3 @@ - - /** * Property-Keys * @author schukai GmbH @@ -10,7 +8,6 @@ export { internalStateSymbol } - /** * @private * @type {symbol} diff --git a/application/source/math/namespace.mjs b/application/source/math/namespace.mjs index c1321814b..6f21f1e9e 100644 --- a/application/source/math/namespace.mjs +++ b/application/source/math/namespace.mjs @@ -1,5 +1,3 @@ - - /** * Namespace for math. * diff --git a/application/source/math/random.mjs b/application/source/math/random.mjs index 57cb98d51..c62a88ab3 100644 --- a/application/source/math/random.mjs +++ b/application/source/math/random.mjs @@ -1,5 +1,3 @@ - - /** * 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); }; diff --git a/application/source/monster.mjs b/application/source/monster.mjs index a1a97a7ac..61a58f0dd 100644 --- a/application/source/monster.mjs +++ b/application/source/monster.mjs @@ -1,14 +1,14 @@ /** - * @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. - * + * * @namespace Monster * @author schukai GmbH */ diff --git a/application/source/text/formatter.mjs b/application/source/text/formatter.mjs index 6e5379ff4..7757ffd67 100644 --- a/application/source/text/formatter.mjs +++ b/application/source/text/formatter.mjs @@ -1,5 +1,3 @@ - - /** * 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}`. diff --git a/application/source/text/namespace.mjs b/application/source/text/namespace.mjs index cd45da0f3..944c14e45 100644 --- a/application/source/text/namespace.mjs +++ b/application/source/text/namespace.mjs @@ -1,5 +1,3 @@ - - /** * Namespace for texts. * diff --git a/application/source/util/clone.mjs b/application/source/util/clone.mjs index 57cfaadda..f8284703b 100644 --- a/application/source/util/clone.mjs +++ b/application/source/util/clone.mjs @@ -1,5 +1,3 @@ - - /** * 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 diff --git a/application/source/util/comparator.mjs b/application/source/util/comparator.mjs index 14d37d0bd..55d93f4db 100644 --- a/application/source/util/comparator.mjs +++ b/application/source/util/comparator.mjs @@ -1,5 +1,3 @@ - - /** * 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 diff --git a/application/source/util/deadmansswitch.mjs b/application/source/util/deadmansswitch.mjs index 05831ee8d..fa3f7e08d 100644 --- a/application/source/util/deadmansswitch.mjs +++ b/application/source/util/deadmansswitch.mjs @@ -1,5 +1,3 @@ - - /** * 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 diff --git a/application/source/util/freeze.mjs b/application/source/util/freeze.mjs index eb4bec5e0..4bdc0ec42 100644 --- a/application/source/util/freeze.mjs +++ b/application/source/util/freeze.mjs @@ -1,5 +1,3 @@ - - /** * 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 diff --git a/application/source/util/namespace.mjs b/application/source/util/namespace.mjs index b5c4f68af..c4d98f161 100644 --- a/application/source/util/namespace.mjs +++ b/application/source/util/namespace.mjs @@ -1,5 +1,3 @@ - - /** * Namespace for utilities. * diff --git a/application/source/util/processing.mjs b/application/source/util/processing.mjs index 6f9d9633e..8d33a0fa8 100644 --- a/application/source/util/processing.mjs +++ b/application/source/util/processing.mjs @@ -1,5 +1,3 @@ - - /** * 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 -- GitLab