From 516da11126c0e136f03daef6a6eac18d8c683c86 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 9 Aug 2022 21:25:08 +0200 Subject: [PATCH] chore: commit save point --- application/example/types/basewithoptions.mjs | 10 ++ application/example/types/is-1.mjs | 5 + application/example/types/is-10.mjs | 6 ++ application/example/types/is-2.mjs | 4 + application/example/types/is-3.mjs | 4 + application/example/types/is-4.mjs | 5 + application/example/types/is-5.mjs | 4 + application/example/types/is-6.mjs | 4 + application/example/types/is-7.mjs | 4 + application/example/types/is-8.mjs | 4 + application/example/types/is-9.mjs | 6 ++ .../example/types/noderecursiveiterator.mjs | 32 ++++++ application/example/types/observer.mjs | 9 ++ application/example/types/proxyobserver.mjs | 25 +++++ application/example/types/queue.mjs | 20 ++++ application/example/types/tokenlist-1.mjs | 4 + application/example/types/tokenlist-2.mjs | 7 ++ application/example/types/tokenlist-3.mjs | 5 + application/example/types/tokenlist-4.mjs | 5 + application/example/types/tokenlist-5.mjs | 5 + application/example/types/typeof.mjs | 9 ++ application/example/types/version-1.mjs | 6 ++ application/example/types/version-2.mjs | 3 + application/source/types/base.mjs | 12 +-- application/source/types/basewithoptions.mjs | 24 +---- application/source/types/binary.mjs | 16 --- application/source/types/dataurl.mjs | 21 ---- application/source/types/id.mjs | 12 +-- application/source/types/is.mjs | 102 +++--------------- application/source/types/mediatype.mjs | 11 -- application/source/types/namespace.mjs | 2 - application/source/types/node.mjs | 10 -- application/source/types/nodelist.mjs | 10 -- .../source/types/noderecursiveiterator.mjs | 45 +------- application/source/types/observer.mjs | 26 +---- application/source/types/observerlist.mjs | 8 -- application/source/types/proxyobserver.mjs | 44 +------- application/source/types/queue.mjs | 34 +----- application/source/types/randomid.mjs | 11 -- application/source/types/regex.mjs | 10 -- application/source/types/stack.mjs | 10 -- application/source/types/tokenlist.mjs | 52 ++------- application/source/types/typeof.mjs | 31 +----- application/source/types/uniquequeue.mjs | 10 -- application/source/types/uuid.mjs | 10 -- application/source/types/validate.mjs | 3 - application/source/types/version.mjs | 50 ++------- 47 files changed, 231 insertions(+), 519 deletions(-) create mode 100644 application/example/types/basewithoptions.mjs create mode 100644 application/example/types/is-1.mjs create mode 100644 application/example/types/is-10.mjs create mode 100644 application/example/types/is-2.mjs create mode 100644 application/example/types/is-3.mjs create mode 100644 application/example/types/is-4.mjs create mode 100644 application/example/types/is-5.mjs create mode 100644 application/example/types/is-6.mjs create mode 100644 application/example/types/is-7.mjs create mode 100644 application/example/types/is-8.mjs create mode 100644 application/example/types/is-9.mjs create mode 100644 application/example/types/noderecursiveiterator.mjs create mode 100644 application/example/types/observer.mjs create mode 100644 application/example/types/proxyobserver.mjs create mode 100644 application/example/types/queue.mjs create mode 100644 application/example/types/tokenlist-1.mjs create mode 100644 application/example/types/tokenlist-2.mjs create mode 100644 application/example/types/tokenlist-3.mjs create mode 100644 application/example/types/tokenlist-4.mjs create mode 100644 application/example/types/tokenlist-5.mjs create mode 100644 application/example/types/typeof.mjs create mode 100644 application/example/types/version-1.mjs create mode 100644 application/example/types/version-2.mjs diff --git a/application/example/types/basewithoptions.mjs b/application/example/types/basewithoptions.mjs new file mode 100644 index 000000000..1bf1b6413 --- /dev/null +++ b/application/example/types/basewithoptions.mjs @@ -0,0 +1,10 @@ +import {BaseWithOptions} from '@schukai/monster/source/types/basewithoptions.mjs'; + +class My extends BaseWithOptions { + get defaults() { + return Object.assign({}, super.defaults, { + mykey: true + }); + } +} + diff --git a/application/example/types/is-1.mjs b/application/example/types/is-1.mjs new file mode 100644 index 000000000..7a68e2596 --- /dev/null +++ b/application/example/types/is-1.mjs @@ -0,0 +1,5 @@ +import {isIterable} from '@schukai/monster/source/types/is.mjs'; + +isIterable(null) // ↦ false +isIterable('hello') // ↦ true +isIterable([]) // ↦ true \ No newline at end of file diff --git a/application/example/types/is-10.mjs b/application/example/types/is-10.mjs new file mode 100644 index 000000000..3194393ab --- /dev/null +++ b/application/example/types/is-10.mjs @@ -0,0 +1,6 @@ +import {isInteger} from '@schukai/monster/source/types/is.mjs'; + +isInteger(() => { +}) // ↦ true +isInteger('2') // ↦ false +isInteger(2) // ↦ true diff --git a/application/example/types/is-2.mjs b/application/example/types/is-2.mjs new file mode 100644 index 000000000..91838b199 --- /dev/null +++ b/application/example/types/is-2.mjs @@ -0,0 +1,4 @@ +import {isPrimitive} from '@schukai/monster/source/types/is.mjs'; + +isPrimitive('2') // ↦ true +isPrimitive([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/is-3.mjs b/application/example/types/is-3.mjs new file mode 100644 index 000000000..c0cd89e3f --- /dev/null +++ b/application/example/types/is-3.mjs @@ -0,0 +1,4 @@ +import {isSymbol} from '@schukai/monster/source/types/is.mjs'; + +isSymbol(Symbol('a')) // ↦ true +isSymbol([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/is-4.mjs b/application/example/types/is-4.mjs new file mode 100644 index 000000000..2c3821b50 --- /dev/null +++ b/application/example/types/is-4.mjs @@ -0,0 +1,5 @@ +import {isBoolean} from '@schukai/monster/source/types/is.mjs'; + +isBoolean('2') // ↦ false +isBoolean([]) // ↦ false +isBoolean(2 > 4) // ↦ true \ No newline at end of file diff --git a/application/example/types/is-5.mjs b/application/example/types/is-5.mjs new file mode 100644 index 000000000..4870272f5 --- /dev/null +++ b/application/example/types/is-5.mjs @@ -0,0 +1,4 @@ +import {isString} from '@schukai/monster/source/types/is.mjs'; + +isString('2') // ↦ true +isString([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/is-6.mjs b/application/example/types/is-6.mjs new file mode 100644 index 000000000..157b50fb1 --- /dev/null +++ b/application/example/types/is-6.mjs @@ -0,0 +1,4 @@ +import {isObject} from '@schukai/monster/source/types/is.mjs'; + +isObject('2') // ↦ false +isObject([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/is-7.mjs b/application/example/types/is-7.mjs new file mode 100644 index 000000000..f39f4cbe3 --- /dev/null +++ b/application/example/types/is-7.mjs @@ -0,0 +1,4 @@ +import {isInstance} from '@schukai/monster/source/types/is.mjs'; + +isInstance('2') // ↦ false +isInstance([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/is-8.mjs b/application/example/types/is-8.mjs new file mode 100644 index 000000000..5ffc51c79 --- /dev/null +++ b/application/example/types/is-8.mjs @@ -0,0 +1,4 @@ +import {isArray} from '@schukai/monster/source/types/is.mjs'; + +isArray('2') // ↦ false +isArray([]) // ↦ true \ No newline at end of file diff --git a/application/example/types/is-9.mjs b/application/example/types/is-9.mjs new file mode 100644 index 000000000..fbe47f0a3 --- /dev/null +++ b/application/example/types/is-9.mjs @@ -0,0 +1,6 @@ +import {isFunction} from '@schukai/monster/source/types/is.mjs'; + +isFunction(() => { +}) // ↦ true +isFunction('2') // ↦ false +isFunction([]) // ↦ false \ No newline at end of file diff --git a/application/example/types/noderecursiveiterator.mjs b/application/example/types/noderecursiveiterator.mjs new file mode 100644 index 000000000..9fdd5fffe --- /dev/null +++ b/application/example/types/noderecursiveiterator.mjs @@ -0,0 +1,32 @@ +import {Node} from '@schukai/monster/source/types/node.mjs'; +import {NodeRecursiveIterator} from '@schukai/monster/source/types/noderecursiveiterator.mjs'; + +const node = new Node('1') + +// 1 +// 2 +// ├ 2.1 +// ├ 2.2 +// └ 2.3 +// 3 +// 4 +// ├ 4.1 +// └ 4.2 +node.appendChild( + (new Node('2')) + .appendChild(new Node('2.1')) + .appendChild(new Node('2.2')) + .appendChild(new Node('2.3'))) + .appendChild(new Node('3')) + .appendChild(new Node('4') + .appendChild(new Node('4.1')) + .appendChild(new Node('4.2'))); + +const iterator = new NodeRecursiveIterator(node); + +const result = []; +for (const n of iterator) { + result.push(n.value); +} + +// ↦ ['1', '2', '2.1', '2.2', '2.3', '3', '4', '4.1', '4.2'] diff --git a/application/example/types/observer.mjs b/application/example/types/observer.mjs new file mode 100644 index 000000000..0d1cda3f0 --- /dev/null +++ b/application/example/types/observer.mjs @@ -0,0 +1,9 @@ +import {Observer} from '@schukai/monster/source/types/observer.mjs'; + +const observer = new Observer(function (a, b, c) { + console.log(this, a, b, c); // ↦ "a", 2, true +}, "a", 2, true); + +observer.update({value: true}).then(() => { +}); +// ↦ {value: true} "a" 2 true \ No newline at end of file diff --git a/application/example/types/proxyobserver.mjs b/application/example/types/proxyobserver.mjs new file mode 100644 index 000000000..9325f6cc9 --- /dev/null +++ b/application/example/types/proxyobserver.mjs @@ -0,0 +1,25 @@ +import {ProxyObserver} from '@schukai/monster/source/types/proxyobserver.mjs'; +import {Observer} from '@schukai/monster/source/types/observer.mjs'; +import {isObject} from '@schukai/monster/source/types/is.mjs'; + +const o = new Observer(function () { + if (isObject(this) && this instanceof ProxyObserver) { + // do something (this ist ProxyObserver) + const subject = this.getSubject(); + console.log(subject); + } +}); + +let realSubject = { + a: { + b: { + c: true + }, + d: 9 + } +} + +const p = new ProxyObserver(realSubject); +p.attachObserver(o); +const s = p.getSubject(); +s.a.b.c = false; diff --git a/application/example/types/queue.mjs b/application/example/types/queue.mjs new file mode 100644 index 000000000..bbbbb978d --- /dev/null +++ b/application/example/types/queue.mjs @@ -0,0 +1,20 @@ +import {Queue} from '@schukai/monster/source/types/queue.mjs'; + +const queue = new Queue; + +queue.add(2); +queue.add(true); +queue.add("Hello"); +queue.add(4.5); + +console.log(queue.poll()); +// ↦ 2 +console.log(queue.poll()); +// ↦ true +console.log(queue.poll()); +// ↦ "Hello" +console.log(queue.poll()); +// ↦ 4.5 +console.log(queue.poll()); +// ↦ undefined + diff --git a/application/example/types/tokenlist-1.mjs b/application/example/types/tokenlist-1.mjs new file mode 100644 index 000000000..922afdcd8 --- /dev/null +++ b/application/example/types/tokenlist-1.mjs @@ -0,0 +1,4 @@ +import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; + +typeof new TokenList("myclass row")[Symbol.iterator]; +// ↦ "function" \ No newline at end of file diff --git a/application/example/types/tokenlist-2.mjs b/application/example/types/tokenlist-2.mjs new file mode 100644 index 000000000..fe69017cc --- /dev/null +++ b/application/example/types/tokenlist-2.mjs @@ -0,0 +1,7 @@ +import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; + +new TokenList("start middle end").contains('start'); // ↦ true +new TokenList("start middle end").contains('end'); // ↦ true +new TokenList("start middle end").contains('xyz'); // ↦ false +new TokenList("start middle end").contains(['end','start','middle']); // ↦ true +new TokenList("start middle end").contains(['end','start','xyz']); // ↦ false \ No newline at end of file diff --git a/application/example/types/tokenlist-3.mjs b/application/example/types/tokenlist-3.mjs new file mode 100644 index 000000000..81934668f --- /dev/null +++ b/application/example/types/tokenlist-3.mjs @@ -0,0 +1,5 @@ +import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; + +new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" +new TokenList().add(["abc", "xyz"]).toString(); // ↦ "abc xyz" +new TokenList().add(undefined); // ↦ add nothing \ No newline at end of file diff --git a/application/example/types/tokenlist-4.mjs b/application/example/types/tokenlist-4.mjs new file mode 100644 index 000000000..5ddb8307f --- /dev/null +++ b/application/example/types/tokenlist-4.mjs @@ -0,0 +1,5 @@ +import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; + +new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" +new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" +new TokenList("abc xyz").remove(undefined); // ↦ remove nothing \ No newline at end of file diff --git a/application/example/types/tokenlist-5.mjs b/application/example/types/tokenlist-5.mjs new file mode 100644 index 000000000..0c4a62729 --- /dev/null +++ b/application/example/types/tokenlist-5.mjs @@ -0,0 +1,5 @@ +import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; + +new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" +new TokenList("abc def ghi").toggle(["abc", "xyz"]).toString(); // ↦ "def ghi xyz" +new TokenList().toggle(undefined); // ↦ nothing \ No newline at end of file diff --git a/application/example/types/typeof.mjs b/application/example/types/typeof.mjs new file mode 100644 index 000000000..e163ae061 --- /dev/null +++ b/application/example/types/typeof.mjs @@ -0,0 +1,9 @@ +import {typeOf} from '@schukai/monster/source/types/typeof.mjs'; + +typeOf(undefined); // ↦ undefined +typeOf(""); // ↦ string +typeOf(5); // ↦ number +typeOf({}); // ↦ object +typeOf([]); // ↦ array +typeOf(new Map); // ↦ map +typeOf(true); // ↦ boolean \ No newline at end of file diff --git a/application/example/types/version-1.mjs b/application/example/types/version-1.mjs new file mode 100644 index 000000000..122e38d04 --- /dev/null +++ b/application/example/types/version-1.mjs @@ -0,0 +1,6 @@ +import {Version} from '@schukai/monster/source/types/version.mjs'; + +new Version('1.0.0') // ↦ 1.0.0 +new Version(1) // ↦ 1.0.0 +new Version(1, 0, 0) // ↦ 1.0.0 +new Version('1.2.3', 4, 5) // ↦ 1.4.5 diff --git a/application/example/types/version-2.mjs b/application/example/types/version-2.mjs new file mode 100644 index 000000000..ad52e87d0 --- /dev/null +++ b/application/example/types/version-2.mjs @@ -0,0 +1,3 @@ +import {getMonsterVersion} from '@schukai/monster/source/types/version.mjs'; + +getMonsterVersion(); \ No newline at end of file diff --git a/application/source/types/base.mjs b/application/source/types/base.mjs index 5648dfcc0..dbd001658 100644 --- a/application/source/types/base.mjs +++ b/application/source/types/base.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -7,19 +5,11 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - export {Base} /** * This is the base class from which all monster classes are derived. * - * ``` - * <script type="module"> - * import {Base} from '@schukai/monster/source/types/base.mjs'; - * new Base() - * </script> - * ``` - * * The class was formerly called Object. * * @license AGPLv3 @@ -27,7 +17,7 @@ export {Base} * @copyright schukai GmbH * @memberOf Monster.Types */ - class Base extends Object { +class Base extends Object { /** * diff --git a/application/source/types/basewithoptions.mjs b/application/source/types/basewithoptions.mjs index fa178728c..0812fc86d 100644 --- a/application/source/types/basewithoptions.mjs +++ b/application/source/types/basewithoptions.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -7,11 +5,9 @@ * 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 {Pathfinder} from "../data/pathfinder.mjs"; - import {Base} from "./base.mjs"; import {validateObject} from "./validate.mjs"; @@ -22,28 +18,10 @@ export {BaseWithOptions} * * This class is actually only used as a base class. * - * ```html - * <script type="module"> - * import {BaseWithOptions} from '@schukai/monster/source/types/basewithoptions.mjs'; - * new BaseWithOptions() - * </script> - * ``` - * * Classes that require the possibility of options can be derived directly from this class. * Derived classes almost always override the `defaul` getter with their own values. * - * ```javascript - * class My extends BaseWithOptions { - * get defaults() { - * return Object.assign({}, super.defaults, { - * mykey: true - * }); - * } - * } - * ``` - * - * The class was formerly called Object. - * + * @externalExample ../../example/types/basewithoptions.mjs * @license AGPLv3 * @since 1.13.0 * @copyright schukai GmbH diff --git a/application/source/types/binary.mjs b/application/source/types/binary.mjs index 2e2e5391f..3d1c7c402 100644 --- a/application/source/types/binary.mjs +++ b/application/source/types/binary.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -14,13 +12,6 @@ export {toBinary, fromBinary} /** * You can call the function via the monster namespace `Monster.Types.toBinary()`. * - * ``` - * <script type="module"> - * import {toBinary} from '@schukai/monster/source/types/binary.mjs'; - * toBinary() - * </script> - * ``` - * * @param {String} binary * @return {String} * @throws {TypeError} value is not a string @@ -47,13 +38,6 @@ function toBinary(string) { /** * You can call the function via the monster namespace `Monster.Types.fromBinary()`. * - * ``` - * <script type="module"> - * import {fromBinary} from '@schukai/monster/source/types/binary.mjs'; - * fromBinary() - * </script> - * ``` - * * @param {String} binary * @return {String} * @throws {TypeError} value is not a string diff --git a/application/source/types/dataurl.mjs b/application/source/types/dataurl.mjs index f85a308d0..350a3d970 100644 --- a/application/source/types/dataurl.mjs +++ b/application/source/types/dataurl.mjs @@ -1,6 +1,3 @@ - - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -8,7 +5,6 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - import {Base} from "./base.mjs"; import {isString} from "./is.mjs"; import {MediaType, parseMediaType} from "./mediatype.mjs"; @@ -22,17 +18,9 @@ export {DataUrl, parseDataURL} */ const internal = Symbol('internal'); - /** * You can create an object via the monster namespace `new Monster.Types.DataUrl()`. * - * ``` - * <script type="module"> - * import {DataUrl} from '@schukai/monster/source/types/dataurl.mjs'; - * new DataUrl() - * </script> - * ``` - * * @license AGPLv3 * @since 1.8.0 * @copyright schukai GmbH @@ -96,13 +84,6 @@ class DataUrl extends Base { /** * You can call the function via the monster namespace `Monster.Types.parseDataURL()`. * - * ``` - * <script type="module"> - * import {parseDataURL} from '@schukai/monster/source/types/dataurl.mjs'; - * parseDataURL(...) - * </script> - * ``` - * * Specification: * * ``` @@ -158,6 +139,4 @@ function parseDataURL(dataurl) { } return new DataUrl(content, mediatype, base64Flag); - - } diff --git a/application/source/types/id.mjs b/application/source/types/id.mjs index 754aab130..b7d726722 100644 --- a/application/source/types/id.mjs +++ b/application/source/types/id.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 './base.mjs'; import {validateString} from "./validate.mjs"; @@ -26,13 +23,6 @@ let internalCounter = new Map; * * So the ids can also be used for navigation. you just have to take care that the order stays the same. * - * ``` - * <script type="module"> - * import {ID} from '@schukai/monster/source/types/id.mjs'; - * console.log(new ID()) - * </script> - * ``` - * * As of version 1.6.0 there is the new RandomID. this ID class is continuous from now on. * * @license AGPLv3 @@ -41,7 +31,7 @@ let internalCounter = new Map; * @memberOf Monster.Types * @summary Automatic generation of ids */ - class ID extends Base { +class ID extends Base { /** * create new id with prefix diff --git a/application/source/types/is.mjs b/application/source/types/is.mjs index 5790c90cc..56e5cb3b3 100644 --- a/application/source/types/is.mjs +++ b/application/source/types/is.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -7,10 +5,8 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - export {isIterable, isPrimitive, isSymbol, isBoolean, isString, isObject, isInstance, isArray, isFunction, isInteger} - /** * With this function you can check if a value is iterable. * @@ -18,15 +14,7 @@ export {isIterable, isPrimitive, isSymbol, isBoolean, isString, isObject, isInst * * You can call the method via the monster namespace `Monster.Types.isPrimitive()`. * - * ``` - * <script type="module"> - * import {isIterable} from '@schukai/monster/source/types/is.mjs'; - * isIterable(null) // ↦ false - * isIterable('hello') // ↦ true - * isIterable([]) // ↦ true - * </script> - * ``` - * + * @externalExample ../../example/types/is-1.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -46,14 +34,7 @@ function isIterable(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isPrimitive} from '@schukai/monster/source/types/is.mjs'; - * isPrimitive('2')) // ↦ true - * isPrimitive([])) // ↦ false - * </script> - * ``` - * + * @externalExample ../../example/types/is-2.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -82,14 +63,7 @@ function isPrimitive(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isSymbol} from '@schukai/monster/source/types/is.mjs'; - * isSymbol(Symbol('a'))) // ↦ true - * isSymbol([]) // ↦ false - * </script> - * ``` - * + * @externalExample ../../example/types/is-3.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -106,15 +80,7 @@ function isSymbol(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isBoolean} from '@schukai/monster/source/types/is.mjs'; - * isBoolean('2')) // ↦ false - * isBoolean([])) // ↦ false - * isBoolean(2>4)) // ↦ true - * </script> - * ``` - * + * @externalExample ../../example/types/is-4.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -136,14 +102,7 @@ function isBoolean(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isString} from '@schukai/monster/source/types/is.mjs'; - * isString('2')) // ↦ true - * isString([])) // ↦ false - * </script> - * ``` - * + * @externalExample ../../example/types/is-5.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -163,14 +122,7 @@ function isString(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isObject} from '@schukai/monster/source/types/is.mjs'; - * isObject('2')) // ↦ false - * isObject([])) // ↦ false - * </script> - * ``` - * + * @externalExample ../../example/types/is-6.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -194,15 +146,8 @@ function isObject(value) { * Checks whether the value passed is a object and instance of instance. * * This method is used in the library to have consistent names. - * - * ``` - * <script type="module"> - * import {isInstance} from '@schukai/monster/source/types/is.mjs'; - * isInstance('2')) // ↦ false - * isInstance([])) // ↦ false - * </script> - * ``` - * + * + * @externalExample ../../example/types/is-7.mjs * @param {*} value * @param {*} instance * @returns {boolean} @@ -223,14 +168,7 @@ function isInstance(value, instance) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isArray} from '@schukai/monster/source/types/is.mjs'; - * isArray('2')) // ↦ false - * isArray([])) // ↦ true - * </script> - * ``` - * + * @externalExample ../../example/types/is-8.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -247,16 +185,8 @@ function isArray(value) { * Checks whether the value passed is a function * * This method is used in the library to have consistent names. - * - * ``` - * <script type="module"> - * import {isFunction} from '@schukai/monster/source/types/is.mjs'; - * isFunction(()=>{}) // ↦ true - * isFunction('2')) // ↦ false - * isFunction([])) // ↦ false - * </script> - * ``` - * + * + * @externalExample ../../example/types/is-9.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 @@ -281,15 +211,7 @@ function isFunction(value) { * * This method is used in the library to have consistent names. * - * ``` - * <script type="module"> - * import {isInteger} from '@schukai/monster/source/types/is.mjs'; - * isInteger(()=>{}) // ↦ true - * isInteger('2')) // ↦ false - * isInteger(2)) // ↦ true - * </script> - * ``` - * + * @externalExample ../../example/types/is-10.mjs * @param {*} value * @returns {boolean} * @license AGPLv3 diff --git a/application/source/types/mediatype.mjs b/application/source/types/mediatype.mjs index 83a695255..7065254d9 100644 --- a/application/source/types/mediatype.mjs +++ b/application/source/types/mediatype.mjs @@ -1,6 +1,3 @@ - - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -8,7 +5,6 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - import {Base} from "./base.mjs"; import {isString} from "./is.mjs"; import {validateArray, validateString} from "./validate.mjs"; @@ -32,13 +28,6 @@ const internal = Symbol('internal'); /** * You can create an object via the monster namespace `new Monster.Types.MediaType()`. * - * ``` - * <script type="module"> - * import {MediaType} from '@schukai/monster/source/types/mediatype.mjs'; - * console.log(new MediaType()) - * </script> - * ``` - * * @license AGPLv3 * @since 1.8.0 * @copyright schukai GmbH diff --git a/application/source/types/namespace.mjs b/application/source/types/namespace.mjs index 3e00ef543..73b24c29b 100644 --- a/application/source/types/namespace.mjs +++ b/application/source/types/namespace.mjs @@ -1,5 +1,3 @@ - - /** * Namespace for types. * diff --git a/application/source/types/node.mjs b/application/source/types/node.mjs index 39bbe7893..a1d9dc152 100644 --- a/application/source/types/node.mjs +++ b/application/source/types/node.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 './base.mjs'; import {isPrimitive} from "./is.mjs"; import {NodeList} from './nodelist.mjs'; @@ -31,13 +28,6 @@ const treeStructureSymbol = Symbol('treeStructure'); /** * You can create the instance via the monster namespace `new Monster.Types.Node()`. * - * ``` - * <script type="module"> - * import {Node} from '@schukai/monster/source/types/node.mjs'; - * new Node() - * </script> - * ``` - * * @license AGPLv3 * @since 1.26.0 * @copyright schukai GmbH diff --git a/application/source/types/nodelist.mjs b/application/source/types/nodelist.mjs index ff4cd4773..8262c00f9 100644 --- a/application/source/types/nodelist.mjs +++ b/application/source/types/nodelist.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 {isArray, isInstance} from "./is.mjs"; import {Node} from "./node.mjs"; import {validateInstance} from "./validate.mjs"; @@ -17,13 +14,6 @@ export {NodeList} /** * You can create the instance via the monster namespace `new Monster.Types.NodeList()`. * - * ``` - * <script type="module"> - * import {NodeList} from '@schukai/monster/source/types/nodelist.mjs'; - * new NodeList() - * </script> - * ``` - * * @license AGPLv3 * @since 1.26.0 * @copyright schukai GmbH diff --git a/application/source/types/noderecursiveiterator.mjs b/application/source/types/noderecursiveiterator.mjs index 96cec23eb..d4253c087 100644 --- a/application/source/types/noderecursiveiterator.mjs +++ b/application/source/types/noderecursiveiterator.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 './base.mjs'; @@ -27,47 +24,7 @@ const isNodeListSymbol = Symbol('isNodeList'); /** * You can create the instance via the monster namespace `new Monster.Types.NodeRecursiveIterator()`. * - * ``` - * <script type="module"> - * import {NodeRecursiveIterator} from '@schukai/monster/source/types/noderecursiveiterator.mjs'; - * new NodeRecursiveIterator() - * </script> - * ``` - * - * @example - * import {Node} from '@schukai/monster/source/types/node.mjs'; - * import {NodeRecursiveIterator} from '@schukai/monster/source/types/noderecursiveiterator.mjs'; - * - * const node =new Node('1') - * - * // 1 - * // 2 - * // ├ 2.1 - * // ├ 2.2 - * // └ 2.3 - * // 3 - * // 4 - * // ├ 4.1 - * // └ 4.2 - * node.appendChild( - * (new Node('2')) - * .appendChild(new Node('2.1')) - * .appendChild(new Node('2.2')) - * .appendChild(new Node('2.3'))) - * .appendChild(new Node('3')) - * .appendChild(new Node('4') - * .appendChild(new Node('4.1')) - * .appendChild(new Node('4.2'))); - * - * const iterator = new NodeRecursiveIterator(node); - * - * const result = []; - * for (const n of iterator) { - * result.push(n.value); - * } - * - * // ↦ ['1', '2', '2.1', '2.2', '2.3', '3', '4', '4.1', '4.2'] - * + * @externalExample ../../example/types/noderecursiveiterator.mjs * @license AGPLv3 * @since 1.26.0 * @copyright schukai GmbH diff --git a/application/source/types/observer.mjs b/application/source/types/observer.mjs index d0e82febd..8b5b585fa 100644 --- a/application/source/types/observer.mjs +++ b/application/source/types/observer.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 './base.mjs'; import {isObject} from './is.mjs'; import {TokenList} from './tokenlist.mjs'; @@ -18,15 +15,10 @@ export {Observer} /** * An observer manages a callback function * - * ``` - * import {Observer} from '@schukai/monster/source/types/observer.mjs'; - * new Observer() - * ``` - * * The update method is called with the subject object as this pointer. For this reason the callback should not - * be an arrow function, because it gets the this pointer of its own context. + * be an arrow function, because it gets this pointer of its own context. * - * ``` + * ```js * new Observer(()=>{ * // this is not subject * }) @@ -38,7 +30,7 @@ export {Observer} * * Additional arguments can be passed to the callback. To do this, simply specify them. * - * ``` + * ```js * Observer(function(a, b, c) { * console.log(a, b, c); // ↦ "a", 2, true * }, "a", 2, true) @@ -46,17 +38,7 @@ export {Observer} * * The callback function must have as many parameters as arguments are given. * - * @example - * - * import {Observer} from '@schukai/monster/source/types/observer.mjs'; - * - * const observer = new Observer(function(a, b, c) { - * console.log(this, a, b, c); // ↦ "a", 2, true - * }, "a", 2, true); - * - * observer.update({value:true}).then(()=>{}); - * // ↦ {value: true} "a" 2 true - * + * @externalExample ../../example/types/observer.mjs * @license AGPLv3 * @since 1.0.0 * @copyright schukai GmbH diff --git a/application/source/types/observerlist.mjs b/application/source/types/observerlist.mjs index 6028e4116..249baa7a8 100644 --- a/application/source/types/observerlist.mjs +++ b/application/source/types/observerlist.mjs @@ -17,14 +17,6 @@ export {ObserverList} /** * With the help of the ObserverList class, observer can be managed. * - * ``` - * <script type="module"> - * import {ObserverList} from '@schukai/monster/source/types/observerlist.mjs'; - * console.log(ObserverList()) - * console.log(ObserverList()) - * </script> - * ``` - * * @license AGPLv3 * @since 1.0.0 * @copyright schukai GmbH diff --git a/application/source/types/proxyobserver.mjs b/application/source/types/proxyobserver.mjs index 7698a8e5f..2e673f1f3 100644 --- a/application/source/types/proxyobserver.mjs +++ b/application/source/types/proxyobserver.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 './base.mjs'; import {isArray, isObject, isPrimitive} from "./is.mjs"; import {Observer} from "./observer.mjs"; @@ -20,45 +17,12 @@ export {ProxyObserver} /** * An observer manages a callback function * - * ``` - * <script type="module"> - * import {ProxyObserver} from '@schukai/monster/source/types/proxyobserver.mjs'; - * new ProxyObserver() - * </script> - * ``` - * - * With the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. - * - * this also applies to nested objects. - * - * @example - * - * import {ProxyObserver} from '@schukai/monster/source/types/proxyobserver.mjs'; - * import {Observer} from '@schukai/monster/source/types/observer.mjs'; - * import {isObject} from '@schukai/monster/source/types/is.mjs'; - * - * const o = new Observer(function () { - * if (isObject(this) && this instanceof ProxyObserver) { - * // do something (this ist ProxyObserver) - * const subject = this.getSubject(); - * console.log(subject); - * } - * }); - * - * let realSubject = { - * a: { - * b: { - * c: true - * }, - * d: 9 - * } - * } + * With the ProxyObserver you can attach observer for observation. + * With each change at the object to be observed an update takes place. * - * const p = new ProxyObserver(realSubject); - * p.attachObserver(o); - * const s = p.getSubject(); - * s.a.b.c = false; + * This also applies to nested objects. * + * @externalExample ../../example/types/proxyobserver.mjs * @license AGPLv3 * @since 1.0.0 * @copyright schukai GmbH diff --git a/application/source/types/queue.mjs b/application/source/types/queue.mjs index 665944ae5..d8fa2ea37 100644 --- a/application/source/types/queue.mjs +++ b/application/source/types/queue.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 './base.mjs'; export {Queue} @@ -15,36 +12,7 @@ export {Queue} /** * You can create the instance via the monster namespace `new Monster.Types.Queue()`. * - * ``` - * <script type="module"> - * import {Queue} from '@schukai/monster/source/types/queue.mjs'; - * new Queue() - * </script> - * ``` - * - * @example - * - * import {Queue} from '@schukai/monster/source/types/queue.mjs'; - * - * const queue = new Queue; - * - * queue.add(2); - * queue.add(true); - * queue.add("Hello"); - * queue.add(4.5); - * - * console.log(queue.poll()); - * // ↦ 2 - * console.log(queue.poll()); - * // ↦ true - * console.log(queue.poll()); - * // ↦ "Hello" - * console.log(queue.poll()); - * // ↦ 4.5 - * console.log(queue.poll()); - * // ↦ undefined - * - * + * @externalExample ../../example/types/queue.mjs * @license AGPLv3 * @since 1.4.0 * @copyright schukai GmbH diff --git a/application/source/types/randomid.mjs b/application/source/types/randomid.mjs index 754531b18..0767da510 100644 --- a/application/source/types/randomid.mjs +++ b/application/source/types/randomid.mjs @@ -1,6 +1,3 @@ - - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -8,7 +5,6 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - import {random} from "../math/random.mjs"; import {getGlobal} from "./global.mjs"; import {ID} from "./id.mjs"; @@ -24,13 +20,6 @@ let internalCounter = 0; /** * The `RandomID` class provides a unique ID for an item. * - * ``` - * <script type="module"> - * import {RandomID} from '@schukai/monster/source/types/randomid.mjs'; - * console.log(new RandomID()) - * </script> - * ``` - * * @license AGPLv3 * @since 1.6.0 * @copyright schukai GmbH diff --git a/application/source/types/regex.mjs b/application/source/types/regex.mjs index d6238ca1f..04736365d 100644 --- a/application/source/types/regex.mjs +++ b/application/source/types/regex.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 {validateString} from "./validate.mjs"; export {escapeString} @@ -15,13 +12,6 @@ export {escapeString} /** * This function prefixes all special characters that may appear in a regex with a slash. * - * ``` - * <script type="module"> - * import {escapeString} from '@schukai/monster/source/types/validate.mjs'; - * escapeString() - * </script> - * ``` - * * @param {string} value * @return {string} * @license AGPLv3 diff --git a/application/source/types/stack.mjs b/application/source/types/stack.mjs index aee42fca6..ea87e0e2b 100644 --- a/application/source/types/stack.mjs +++ b/application/source/types/stack.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 './base.mjs'; export {Stack} @@ -15,13 +12,6 @@ export {Stack} /** * You can call the method via the monster namespace `new Monster.Types.Queue()`. * - * ``` - * <script type="module"> - * import {ID} from '@schukai/monster/source/types/stack.mjs'; - * console.log(new Stack()) - * </script> - * ``` - * * @license AGPLv3 * @since 1.4.0 * @copyright schukai GmbH diff --git a/application/source/types/tokenlist.mjs b/application/source/types/tokenlist.mjs index fc463ad94..f5054e82b 100644 --- a/application/source/types/tokenlist.mjs +++ b/application/source/types/tokenlist.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 {isIterable, isString} from '../types/is.mjs'; import {validateFunction, validateString} from '../types/validate.mjs'; import {Base} from './base.mjs'; @@ -15,24 +12,13 @@ import {Base} from './base.mjs'; export {TokenList} /** - * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). + * A `TokenList` allows you to manage tokens (individual character strings such as css classes in an attribute string). * - * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. - * - * ``` - * <script type="module"> - * import {TokenList} from '@schukai/monster/source/types/tokenlist.mjs'; - * new TokenList("myclass row") - * </script> - * ``` + * The `TokenList` offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. * * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * - * ``` - * typeof new TokenList("myclass row")[Symbol.iterator]; - * // ↦ "function" - * ``` - * + * @externalExample ../../example/types/tokenlist-1.mjs * @license AGPLv3 * @since 1.2.0 * @copyright schukai GmbH @@ -89,14 +75,7 @@ class TokenList extends Base { /** * Returns true if it contains token, otherwise false * - * ``` - * new TokenList("start middle end").contains('start')); // ↦ true - * new TokenList("start middle end").contains('end')); // ↦ true - * new TokenList("start middle end").contains('xyz')); // ↦ false - * new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true - * new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false - * ``` - * + * @externalExample ../../example/types/tokenlist-2.mjs * @param {array|string|iteratable} value * @returns {boolean} */ @@ -125,14 +104,9 @@ class TokenList extends Base { } /** - * add tokens - * - * ``` - * new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" - * new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" - * new TokenList().add(undefined); // ↦ add nothing - * ``` + * Add tokens * + * @externalExample ../../example/types/tokenlist-3.mjs * @param {array|string|iteratable} value * @returns {TokenList} * @throws {TypeError} unsupported value @@ -167,12 +141,7 @@ class TokenList extends Base { /** * Removes token * - * ``` - * new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" - * new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" - * new TokenList("abc xyz").remove(undefined); // ↦ remove nothing - * ``` - * + * @externalExample ../../example/types/tokenlist-4.mjs * @param {array|string|iteratable} value * @returns {TokenList} * @throws {TypeError} unsupported value @@ -227,12 +196,7 @@ class TokenList extends Base { /** * Removes token from string. If token doesn't exist it's added. * - * ``` - * new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" - * new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" - * new TokenList().toggle(undefined); // ↦ nothing - * ``` - * + * @externalExample ../../example/types/tokenlist-5.mjs * @param {array|string|iteratable} value * @returns {boolean} * @throws {TypeError} unsupported value diff --git a/application/source/types/typeof.mjs b/application/source/types/typeof.mjs index 3dca1dd65..c71723851 100644 --- a/application/source/types/typeof.mjs +++ b/application/source/types/typeof.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -7,31 +5,12 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - export {typeOf} /** * The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result. * - * ``` - * <script type="module"> - * import {typeOf} from '@schukai/monster/source/types/typeof.mjs'; - * console.log(typeOf()) - * </script> - * ``` - * - * @example - * - * import {typeOf} from '@schukai/monster/source/types/typeof.mjs'; - * - * console.log(typeOf(undefined)); // ↦ undefined - * console.log(typeOf("")); // ↦ string - * console.log(typeOf(5)); // ↦ number - * console.log(typeOf({})); // ↦ object - * console.log(typeOf([])); // ↦ array - * console.log(typeOf(new Map)); // ↦ map - * console.log(typeOf(true)); // ↦ boolean - * + * @externalExample ../../example/types/typeof.mjs * @param {*} value * @return {string} * @license AGPLv3 @@ -43,16 +22,16 @@ export {typeOf} function typeOf(value) { let type = ({}).toString.call(value).match(/\s([a-zA-Z]+)/)[1]; if ('Object' === type) { - - const name=value.constructor.name; + + const name = value.constructor.name; if (name) { return name.toLowerCase(); } - + const results = (/^(class|function)\s+(\w+)/).exec(value.constructor.toString()); type = (results && results.length > 2) ? results[2] : ''; } - + return type.toLowerCase(); } diff --git a/application/source/types/uniquequeue.mjs b/application/source/types/uniquequeue.mjs index 8a0e73fc6..23ce29631 100644 --- a/application/source/types/uniquequeue.mjs +++ b/application/source/types/uniquequeue.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 {Queue} from "./queue.mjs"; import {validateObject} from "./validate.mjs"; @@ -16,13 +13,6 @@ export {UniqueQueue} /** * A UniqueQueue is a queue that contains items only once. * - * ``` - * <script type="module"> - * import {UniqueQueue} from '@schukai/monster/source/types/uniquequeue.mjs'; - * new UniqueQueue() - * </script> - * ``` - * * @license AGPLv3 * @since 1.4.0 * @copyright schukai GmbH diff --git a/application/source/types/uuid.mjs b/application/source/types/uuid.mjs index f58edb662..52b9ef288 100644 --- a/application/source/types/uuid.mjs +++ b/application/source/types/uuid.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 {random} from "../math/random.mjs"; import {isObject} from '../types/is.mjs'; @@ -19,13 +16,6 @@ export {UUID} /** * The UUID class makes it possible to get a unique UUID for an object. * - * ``` - * <script type="module"> - * import {Base} from '@schukai/monster/source/types/uuid.mjs'; - * new UUID() - * </script> - * ``` - * * @license AGPLv3 * @since 1.25.0 * @copyright schukai GmbH diff --git a/application/source/types/validate.mjs b/application/source/types/validate.mjs index 4c7c99491..2803df9a6 100644 --- a/application/source/types/validate.mjs +++ b/application/source/types/validate.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 { isArray, isBoolean, diff --git a/application/source/types/version.mjs b/application/source/types/version.mjs index f05e6bbdb..243659f73 100644 --- a/application/source/types/version.mjs +++ b/application/source/types/version.mjs @@ -1,5 +1,3 @@ - - /** * Copyright schukai GmbH and contributors 2022. All Rights Reserved. * Node module: @schukai/monster @@ -7,31 +5,14 @@ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html */ - import {Base} from './base.mjs'; export {Version, getMonsterVersion} /** - * The version object contains a sematic version number - * - * ``` - * <script type="module"> - * import {Version} from '@schukai/monster/source/types/version.mjs'; - * console.log(new Version('1.2.3')) // ↦ 1.2.3 - * console.log(new Version('1')) // ↦ 1.0.0 - * </script> - * ``` - * - * @example - * - * import {Version} from '@schukai/monster/source/types/version.mjs'; - * - * new Version('1.0.0') // ↦ 1.0.0 - * new Version(1) // ↦ 1.0.0 - * new Version(1, 0, 0) // ↦ 1.0.0 - * new Version('1.2.3', 4, 5) // ↦ 1.4.5 + * The version object contains a semantic version number * + * @externalExample ../../example/types/version-1.mjs * @license AGPLv3 * @since 1.0.0 * @author schukai GmbH @@ -101,7 +82,7 @@ class Version extends Base { /** * returns 0 if equal, -1 if the object version is less and 1 if greater - * then the compared version + * than the compared version * * @param {string|Version} version Version to compare * @returns {number} @@ -142,24 +123,7 @@ let monsterVersion; /** * Version of monster * - * You can call the method via the monster namespace `Monster.getVersion()`. - * - * ``` - * <script type="module"> - * import {Monster} from '@schukai/monster/source//monster.mjs'; - * console.log(Monster.getVersion()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {getMonsterVersion} from '@schukai/monster/source/types/version.mjs'; - * console.log(getMonsterVersion()) - * </script> - * ``` - * + * @externalExample ../../example/types/version-2.mjs * @returns {Monster.Types.Version} * @license AGPLv3 * @since 1.0.0 @@ -171,9 +135,9 @@ function getMonsterVersion() { if (monsterVersion instanceof Version) { return monsterVersion; } - /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.31.0') - /**#@-*/ + + /** don't touch, replaced by make with package.json version */ + monsterVersion = new Version(/**#@+*/'1.31.0'/**#@-*/) return monsterVersion; -- GitLab