diff --git a/application/example/util/comparator.mjs b/application/example/util/comparator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..401af78e54fa04a68614473a3c133b4e5b5788ba --- /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 0000000000000000000000000000000000000000..344fc8aad99a717bab12bef2c3a1520d9c8e8fa6 --- /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 0000000000000000000000000000000000000000..ff05bf8d9960f54b8bbb133766fd1e27081ace2a --- /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 2d91c35c4f6079e345c1b3bc3bd59e2b3f49fdb0..15bb6eb3aaa6c0cea8c8e9cc28cc67ba47f379ca 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 c1321814ba05604fefe8b7bc4b1d0ecebfed61af..6f21f1e9e8382aee37c3f4e7fcba620df42cfec7 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 57cb98d518b114379643c392b7868aa539e56afb..c62a88ab300d0e08d6eb0a3cf03cc72b02539b0c 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 a1a97a7ac710540a99dcb9c1df52c999026d7e24..61a58f0dde68e5e42b8621bbe2aa262ae4cf4371 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 6e5379ff4cee9ee24e90e6c3107790ec146f655c..7757ffd6787c9678aedfc5a44614d511a045e4a1 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 cd45da0f30a7ab8e7587a98fe294f020bee2a87f..944c14e45a2adf37755b6940d1bd2dcd98ac4a90 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 57cfaadda23429facd4a43d7691b2f8400e24bef..f8284703b31ad7a7d8d2d17ed7ceedd15829e666 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 14d37d0bd1a819b8b133b39a74576c274d8eaab7..55d93f4dba3d7e70febc4de807b2529975ec26b1 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 05831ee8dcce5c93503e02501d9407b2fff8a68c..fa3f7e08d1fe4ec9b7c007ae6327ee39b1a08ff1 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 eb4bec5e0167b8fa578566076471a17930542676..4bdc0ec42ebb9421a234e52ca789524b3cf46a76 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 b5c4f68af2ce47c6ca7923553fa461f99a09f266..c4d98f161ac1c8ead6585f097cf02cc5dd961be1 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 6f9d9633e209db74d50d5631b91538967b18792e..8d33a0fa8f51f875e493fbb281d6c8cefe673b2a 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