diff --git a/application/example/types/basewithoptions.mjs b/application/example/types/basewithoptions.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1bf1b641304094c378c8e0e34f2474bee71f53dd --- /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 0000000000000000000000000000000000000000..7a68e2596065571af30a0bb2641f49085d41137c --- /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 0000000000000000000000000000000000000000..3194393abd3ed50d950c19c4f186753250bf329c --- /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 0000000000000000000000000000000000000000..91838b199782f2b85e15537755555455aaa7e2f2 --- /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 0000000000000000000000000000000000000000..c0cd89e3fad874b5942284d7b1d35ae45c86e714 --- /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 0000000000000000000000000000000000000000..2c3821b508ec64a53a3b8d4e22fff58a55508938 --- /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 0000000000000000000000000000000000000000..4870272f584e9c3d80674b7c4e0f12fec63c8835 --- /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 0000000000000000000000000000000000000000..157b50fb14d1826a9ddab6e37c3be9a1214621d1 --- /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 0000000000000000000000000000000000000000..f39f4cbe3625cf23eaf1dc1ba6ca9535f61e4c83 --- /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 0000000000000000000000000000000000000000..5ffc51c7934f7c98fa1d954babd4b8fdc862ccce --- /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 0000000000000000000000000000000000000000..fbe47f0a36599a5fcc6f923a28af3dc7f662193b --- /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 0000000000000000000000000000000000000000..9fdd5fffe8acf5a0f43658adb2f55ef8ce7766ff --- /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 0000000000000000000000000000000000000000..0d1cda3f0bdf5523f789e8600b66c800c6b6e9a6 --- /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 0000000000000000000000000000000000000000..9325f6cc9d9611de0d28c66e631fc9c7fd27067b --- /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 0000000000000000000000000000000000000000..bbbbb978d320a9111ed119fa4d33ed2225adba65 --- /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 0000000000000000000000000000000000000000..922afdcd81fe4bb2eb569e992be939a4b8c58adf --- /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 0000000000000000000000000000000000000000..fe69017cc13e6647b394611c7b755af3ab75d6ee --- /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 0000000000000000000000000000000000000000..81934668fd1841de6934db6eaf9b239dede8490b --- /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 0000000000000000000000000000000000000000..5ddb8307f21fbaad5136d34a307c33d8f2126b52 --- /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 0000000000000000000000000000000000000000..0c4a62729ce120f69e7903419ffc8b91aae36684 --- /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 0000000000000000000000000000000000000000..e163ae06148f29ad29e93bb616cb3de69b1851e5 --- /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 0000000000000000000000000000000000000000..122e38d0403f6d57ae1272c7036e28a9d5765cd6 --- /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 0000000000000000000000000000000000000000..ad52e87d0fda3e85f85368c144857b2f36382199 --- /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 5648dfcc005f36048247a41d72b83a5e38e6e154..dbd00165873474c471b39cbc7b15fa702fb4dddd 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 fa178728cd48320759c7515ba71a492fc6a4c4f2..0812fc86d63243531f58202eb783e87a031c5669 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 2e2e5391fac6b23e9956ab275be9b7e081ddfad4..3d1c7c4026c785e6a673ccb5ac4bec13b17047b0 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 f85a308d010ab33ce50df9aa4bb97023f3b665c6..350a3d970c3d3bdcce786c81635dabc364abc1c7 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 754aab13099647f0c633c06d4874884be35ba708..b7d7267227062eae80d89ecadc8262320ae24612 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 5790c90cc096d35a0da0b246ba5f88876dd2c005..56e5cb3b386559b597ffcb3c315b99577caba4ca 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 83a695255e79ab603a164f6eeadbdc617d2dc879..7065254d96510175f29106d0d3a09b5e72bf966c 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 3e00ef543dec290e961963f8a5311069f6e1f211..73b24c29b4239f478181e22247f2af52ac683316 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 39bbe7893d250da1d5064f7f6bf7763e662fae30..a1d9dc152b89c97eb6bf350eb16b938f22a7c561 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 ff4cd4773c19f92f9f595a1617f76b92e755831b..8262c00f9de1df46a7e29fd85cc8a70f97f86d04 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 96cec23eb351c4020c2adee7e2951fd942282231..d4253c0870763f61837e4320194a09514981acfa 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 d0e82febd52ebc5a7ec5217d441447d96726a8a0..8b5b585fad1724e5729652ea6d71b3274397a8d6 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 6028e411657f4798614302735c925ef88f60dd80..249baa7a8613d06ba0ee9acab4dc8c11902f4625 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 7698a8e5ffd041cb79cf75d48ed68c1936c0e1af..2e673f1f3aa4170d521a265f2b78690296cd1382 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 665944ae527df8eefc95ff4bf410f3b31cd284ac..d8fa2ea37b33c26f9ae8fff28f9e5628682f365f 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 754531b18ddd71be2431bd40a96b17e52e58cc59..0767da51034ead3f9174a0ceb85ffe2a092f7580 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 d6238ca1f40b14345fa3bc55e99267a4aadb8356..04736365d4af879980763e553e2376037180e132 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 aee42fca6b1b39c497e0abb2e0831d0b1e0ebeea..ea87e0e2b59fd8d96b0f48fe5fad0d99874dd74a 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 fc463ad94d43cb319203cc8ca2bcf96fc98a5585..f5054e82bd449cc2bfbbecc3b968a462e5630154 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 3dca1dd6567bf19dece2769866e0dbde8aa10ee3..c71723851b2ba4ceddb4ff5520c465fcf2a10a66 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 8a0e73fc618e7050b2f0e50cd931055b2ea44a3a..23ce29631a4f62a68ceb58c8fec9eabaa261fb7c 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 f58edb662fdec3dc1b0a2b3b841c7e7573f02724..52b9ef288a3b409249600afdcc3cc43a8a342a85 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 4c7c9949167f95d08ff5c868c03dda65896b0c09..2803df9a6e986e9602e9e170c56df306e3ef570b 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 f05e6bbdb5df76ea45bdfe257df3fe63eba73faa..243659f738b94006cef25b44261f392f004e7f4d 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;