Skip to content
Snippets Groups Projects
Verified Commit 516da111 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: commit save point

parent 14152bb2
No related branches found
No related tags found
No related merge requests found
/**
* 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
......
/**
* 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
......
/**
* 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
......
/**
* 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
......
/**
* 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
......
/**
* 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,
......
/**
* 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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment