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

chore: commit save point

parent ccb2cba1
Branches
Tags v1.15.1
No related merge requests found
Showing
with 85 additions and 492 deletions
......@@ -4,28 +4,16 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {getGlobal} from '../types/global.js';
/**
* this function uses crypt and returns a random number.
*
* you can call the method via the monster namespace `Monster.Math.random()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Math.random(1,10)
* // ↦ 5
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/math/random.js';
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/math/random.js';
* random(1,10)
* // ↦ 5
* </script>
......@@ -42,7 +30,7 @@ import {getGlobal} from '../types/global.js';
* @since 1.0.0
* @copyright schukai GmbH
*/
function random(min, max) {
export function random(min, max) {
if (min === undefined) {
min = 0;
......@@ -125,10 +113,3 @@ function create(min, max) {
return rval;
}
assignToNamespace('Monster.Math', random);
export {Monster, random}
......@@ -7,10 +7,11 @@
import {internalSymbol} from "../constants.js";
import {extend} from "../data/extend.js";
import {Pipe} from "../data/pipe.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {BaseWithOptions} from "../types/basewithoptions.js";
import {isObject, isString} from "../types/is.js";
import {validateArray, validateString} from "../types/validate.js";
import {getMonsterVersion} from "../types/version.js";
/**
......@@ -49,20 +50,9 @@ const workingDataSymbol = Symbol('workingData');
*
* Look at the example below. The placeholders use the logic of Pipe.
*
* You can create an instance via the monster namespace `new Monster.Text.Formatter()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Text.Formatter()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/text/formatter.js';
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/text/formatter.js';
* new Formatter()
* </script>
* ```
......@@ -107,7 +97,7 @@ const workingDataSymbol = Symbol('workingData');
*
* @example
*
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/text/formatter.js';
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/text/formatter.js';
*
* new Formatter({
* a: {
......@@ -124,7 +114,7 @@ const workingDataSymbol = Symbol('workingData');
* @copyright schukai GmbH
* @memberOf Monster.Text
*/
class Formatter extends BaseWithOptions {
export class Formatter extends BaseWithOptions {
/**
* Default values for the markers are `${` and `}`
......@@ -362,6 +352,3 @@ function tokenize(text, openMarker, closeMarker) {
return formatted.join('');
}
assignToNamespace('Monster.Text', Formatter);
export {Monster, Formatter}
'use strict';
/**
* Namespace for texts.
*
* @namespace Monster.Text
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Text";
\ No newline at end of file
......@@ -4,25 +4,14 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
/**
* This is the base class from which all monster classes are derived.
*
* You can call the method via the monster namespace `new Monster.Types.Base()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.Base()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/base.js';
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/base.js';
* new Base()
* </script>
* ```
......@@ -33,7 +22,7 @@ import {assignToNamespace, Monster} from '../namespace.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class Base extends Object {
export class Base extends Object {
/**
*
......@@ -45,6 +34,3 @@ class Base extends Object {
}
assignToNamespace('Monster.Types', Base);
export {Monster, Base}
......@@ -7,7 +7,7 @@
import {internalSymbol} from "../constants.js";
import {extend} from "../data/extend.js";
import {Pathfinder} from "../data/pathfinder.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from "./base.js";
import {validateObject} from "./validate.js";
......@@ -16,20 +16,9 @@ import {validateObject} from "./validate.js";
*
* This class is actually only used as a base class.
*
* However, you can also create an instance directly via the monster namespace `new Monster.Types.BaseWithOptions()`.
*
* ```html
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.BaseWithOptions()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```html
* <script type="module">
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/basewithoptions.js';
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/basewithoptions.js';
* new BaseWithOptions()
* </script>
* ```
......@@ -53,7 +42,7 @@ import {validateObject} from "./validate.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class BaseWithOptions extends Base {
export class BaseWithOptions extends Base {
/**
*
......@@ -113,6 +102,3 @@ class BaseWithOptions extends Base {
}
assignToNamespace('Monster.Types', BaseWithOptions);
export {Monster, BaseWithOptions}
......@@ -13,16 +13,7 @@ import {Monster, validateString} from "./validate.js";
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.toBinary()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {toBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/binary.js';
* import {toBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/binary.js';
* toBinary()
* </script>
* ```
......@@ -33,7 +24,7 @@ import {Monster, validateString} from "./validate.js";
* @memberOf Monster.Types
* @since 1.18.0
*/
function toBinary(string) {
export function toBinary(string) {
const codeUnits = new Uint16Array(validateString(string).length);
for (let i = 0; i < codeUnits.length; i++) {
codeUnits[i] = string.charCodeAt(i);
......@@ -54,16 +45,7 @@ function toBinary(string) {
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.fromBinary()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {fromBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/binary.js';
* import {fromBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/binary.js';
* fromBinary()
* </script>
* ```
......@@ -74,7 +56,7 @@ function toBinary(string) {
* @memberOf Monster.Types
* @since 1.18.0
*/
function fromBinary(binary) {
export function fromBinary(binary) {
const bytes = new Uint8Array(validateString(binary).length);
for (let i = 0; i < bytes.length; i++) {
bytes[i] = binary.charCodeAt(i);
......@@ -87,6 +69,3 @@ function fromBinary(binary) {
return result;
}
assignToNamespace('Monster.Types', toBinary, fromBinary);
export {Monster, toBinary, fromBinary};
......@@ -20,16 +20,7 @@ const internal = Symbol('internal');
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.DataUrl()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js';
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js';
* new DataUrl()
* </script>
* ```
......@@ -40,7 +31,7 @@ const internal = Symbol('internal');
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
* @see https://datatracker.ietf.org/doc/html/rfc2397
*/
class DataUrl extends Base {
export class DataUrl extends Base {
/**
*
......@@ -98,17 +89,8 @@ class DataUrl extends Base {
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(Monster.Types.parseDataURL())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js';
* console.log(parseDataURL())
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js';
* parseDataURL(...)
* </script>
* ```
*
......@@ -129,7 +111,7 @@ class DataUrl extends Base {
* @throws {TypeError} malformed data url
* @memberOf Monster.Types
*/
function parseDataURL(dataurl) {
export function parseDataURL(dataurl) {
validateString(dataurl);
......@@ -170,7 +152,3 @@ function parseDataURL(dataurl) {
}
assignToNamespace('Monster.Types', parseDataURL, DataUrl);
export {Monster, parseDataURL, DataUrl};
......@@ -3,7 +3,7 @@
/**
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {validateString} from "./validate.js";
......@@ -20,20 +20,9 @@ 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.
*
* You can call the method via the monster namespace `new Monster.Types.ID()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.Types.ID())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/id.js';
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/id.js';
* console.log(new ID())
* </script>
* ```
......@@ -45,7 +34,7 @@ let internalCounter = new Map;
* @memberOf Monster.Types
* @summary Automatic generation of ids
*/
class ID extends Base {
export class ID extends Base {
/**
* create new id with prefix
......@@ -79,6 +68,3 @@ class ID extends Base {
}
}
assignToNamespace('Monster.Types', ID);
export {Monster, ID}
......@@ -4,7 +4,7 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
/**
* With this function you can check if a value is iterable.
......@@ -15,18 +15,7 @@ import {assignToNamespace, Monster} from '../namespace.js';
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isIterable(null) // ↦ false
* Monster.Types.isIterable('hello') // ↦ true
* Monster.Types.isIterable([]) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isIterable(null) // ↦ false
* isIterable('hello') // ↦ true
* isIterable([]) // ↦ true
......@@ -39,7 +28,7 @@ import {assignToNamespace, Monster} from '../namespace.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isIterable(value) {
export function isIterable(value) {
if (value === undefined) return false;
if (value === null) return false;
return typeof value?.[Symbol.iterator] === 'function';
......@@ -51,21 +40,9 @@ function isIterable(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isPrimitive()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isPrimitive('2') // ↦ false
* Monster.Types.isPrimitive([]) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isPrimitive('2')) // ↦ true
* isPrimitive([])) // ↦ false
* </script>
......@@ -77,7 +54,7 @@ function isIterable(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isPrimitive(value) {
export function isPrimitive(value) {
var type;
if (value === undefined || value === null) {
......@@ -98,21 +75,9 @@ function isPrimitive(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isSymbol()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isSymbol('2') // ↦ false
* Monster.Types.isSymbol(Symbol('test') // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isSymbol(Symbol('a'))) // ↦ true
* isSymbol([]) // ↦ false
* </script>
......@@ -124,7 +89,7 @@ function isPrimitive(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isSymbol(value) {
export function isSymbol(value) {
return ('symbol' === typeof value) ? true : false;
}
......@@ -133,22 +98,9 @@ function isSymbol(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isBoolean()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isBoolean('2') // ↦ false
* Monster.Types.isBoolean([]) // ↦ false
* Monster.Types.isBoolean(true) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isBoolean('2')) // ↦ false
* isBoolean([])) // ↦ false
* isBoolean(2>4)) // ↦ true
......@@ -161,7 +113,7 @@ function isSymbol(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isBoolean(value) {
export function isBoolean(value) {
if (value === true || value === false) {
return true;
......@@ -175,21 +127,9 @@ function isBoolean(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isString()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isString('2') // ↦ true
* Monster.Types.isString([]) // ↦ false
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isString('2')) // ↦ true
* isString([])) // ↦ false
* </script>
......@@ -201,7 +141,7 @@ function isBoolean(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isString(value) {
export function isString(value) {
if (value === undefined || typeof value !== 'string') {
return false;
}
......@@ -213,22 +153,9 @@ function isString(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isObject()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isObject('2') // ↦ false
* Monster.Types.isObject([]) // ↦ false
* Monster.Types.isObject({}) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isObject('2')) // ↦ false
* isObject([])) // ↦ false
* </script>
......@@ -240,7 +167,7 @@ function isString(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isObject(value) {
export function isObject(value) {
if (isArray(value)) return false;
if (isPrimitive(value)) return false;
......@@ -257,22 +184,9 @@ function isObject(value) {
*
* This method is used in the library to have consistent names.
*
* you can call the method via the monster namespace `Monster.Types.isInstance()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isInstance('2') // ↦ false
* Monster.Types.isInstance([]) // ↦ false
* Monster.Types.isInstance({}) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isInstance('2')) // ↦ false
* isInstance([])) // ↦ false
* </script>
......@@ -285,7 +199,7 @@ function isObject(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isInstance(value, instance) {
export function isInstance(value, instance) {
if (!isObject(value)) return false;
if (!isFunction(instance)) return false;
......@@ -299,21 +213,9 @@ function isInstance(value, instance) {
*
* This method is used in the library to have consistent names.
*
* you can call the method via the monster namespace `Monster.Types.isArray()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isArray('2') // ↦ false
* Monster.Types.isArray([]) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isArray('2')) // ↦ false
* isArray([])) // ↦ true
* </script>
......@@ -326,7 +228,7 @@ function isInstance(value, instance) {
* @memberOf Monster.Types
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
*/
function isArray(value) {
export function isArray(value) {
return Array.isArray(value);
}
......@@ -335,22 +237,9 @@ function isArray(value) {
*
* This method is used in the library to have consistent names.
*
* you can call the method via the monster namespace `Monster.Types.isFunction()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isFunction(()=>{}) // ↦ true
* Monster.Types.isFunction('2') // ↦ false
* Monster.Types.isFunction([]) // ↦ false
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isFunction(()=>{}) // ↦ true
* isFunction('2')) // ↦ false
* isFunction([])) // ↦ false
......@@ -363,7 +252,7 @@ function isArray(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isFunction(value) {
export function isFunction(value) {
if (isArray(value)) return false;
if (isPrimitive(value)) return false;
......@@ -380,22 +269,9 @@ function isFunction(value) {
*
* This method is used in the library to have consistent names.
*
* You can call the method via the monster namespace `Monster.Types.isFunction()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* Monster.Types.isInteger(()=>{}) // ↦ true
* Monster.Types.isInteger('2') // ↦ false
* Monster.Types.isInteger(2) // ↦ true
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
* isInteger(()=>{}) // ↦ true
* isInteger('2')) // ↦ false
* isInteger(2)) // ↦ true
......@@ -408,22 +284,7 @@ function isFunction(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
function isInteger(value) {
export function isInteger(value) {
return Number.isInteger(value);
}
assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable, isInteger, isSymbol);
export {
Monster,
isPrimitive,
isBoolean,
isString,
isObject,
isInstance,
isArray,
isFunction,
isIterable,
isInteger,
isSymbol
}
......@@ -28,16 +28,7 @@ const internal = Symbol('internal');
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.Types.MediaType())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/mediatype.js';
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/mediatype.js';
* console.log(new MediaType())
* </script>
* ```
......@@ -46,7 +37,7 @@ const internal = Symbol('internal');
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class MediaType extends Base {
export class MediaType extends Base {
/**
*
......@@ -146,7 +137,7 @@ class MediaType extends Base {
*
* ```
* <script type="module">
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js';
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js';
* console.log(parseMediaType())
* </script>
* ```
......@@ -168,7 +159,7 @@ class MediaType extends Base {
* @throws {TypeError} malformed data url
* @memberOf Monster.Types
*/
function parseMediaType(mediatype) {
export function parseMediaType(mediatype) {
const regex = /(?<type>[A-Za-z]+|\*)\/(?<subtype>([a-zA-Z0-9.\+_\-]+)|\*|)(?<parameter>\s*;\s*([a-zA-Z0-9]+)\s*(=\s*("?[A-Za-z0-9_\-]+"?))?)*/g;
const result = regex.exec(validateString(mediatype));
......@@ -230,7 +221,3 @@ function parseParameter(parameter) {
return result;
}
assignToNamespace('Monster.Types', parseMediaType, MediaType);
export {Monster, parseMediaType, MediaType};
'use strict';
/**
* Namespace for types.
*
* @namespace Monster.Types
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Types";
\ No newline at end of file
......@@ -5,7 +5,7 @@
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {isPrimitive} from "./is.js";
import {NodeList} from './nodelist.js';
......@@ -29,16 +29,7 @@ const treeStructureSymbol = Symbol('treeStructure');
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.Node()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/node.js';
* import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/node.js';
* new Node()
* </script>
* ```
......@@ -49,7 +40,7 @@ const treeStructureSymbol = Symbol('treeStructure');
* @summary A Node Class
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Iteration_protocols
*/
class Node extends Base {
export class Node extends Base {
/**
* @param {*} [value]
......@@ -205,6 +196,3 @@ function setChildLevelAndParent(node, operand) {
});
return this;
}
assignToNamespace('Monster.Types', Node);
export {Monster, Node}
......@@ -3,7 +3,7 @@
/**
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray, isInstance} from "./is.js";
import {Node} from "./node.js";
import {validateInstance} from "./validate.js";
......@@ -13,16 +13,7 @@ import {validateInstance} from "./validate.js";
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.NodeList()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {NodeList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/nodelist.js';
* import {NodeList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/nodelist.js';
* new NodeList()
* </script>
* ```
......@@ -32,7 +23,7 @@ import {validateInstance} from "./validate.js";
* @memberOf Monster.Types
* @summary A NodeList class
*/
class NodeList extends Set {
export class NodeList extends Set {
/**
* @throws {Error} invalid value type
......@@ -124,6 +115,3 @@ class NodeList extends Set {
}
}
assignToNamespace('Monster.Types', NodeList);
export {Monster, NodeList}
......@@ -6,7 +6,7 @@
import {internalSymbol} from "../constants.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {isInstance} from "./is.js";
import {Node} from "./node.js";
......@@ -25,23 +25,14 @@ const isNodeListSymbol = Symbol('isNodeList');
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.NodeRecursiveIterator()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/noderecursiveiterator.js';
* import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/noderecursiveiterator.js';
* new NodeRecursiveIterator()
* </script>
* ```
*
* @example
* import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/node.js';
* import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/noderecursiveiterator.js';
* import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/node.js';
* import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/noderecursiveiterator.js';
*
* const node =new Node('1')
*
......@@ -78,7 +69,7 @@ const isNodeListSymbol = Symbol('isNodeList');
* @memberOf Monster.Types
* @summary An iterator to run recursively through a tree of nodes
*/
class NodeRecursiveIterator extends Base {
export class NodeRecursiveIterator extends Base {
/**
* @param {Node} [data]
......@@ -142,7 +133,3 @@ class NodeRecursiveIterator extends Base {
}
}
assignToNamespace('Monster.Types', NodeRecursiveIterator);
export {Monster, NodeRecursiveIterator}
......@@ -4,7 +4,7 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {isObject} from './is.js';
import {TokenList} from './tokenlist.js';
......@@ -13,17 +13,8 @@ import {UniqueQueue} from './uniquequeue.js';
/**
* An observer manages a callback function
*
* You can call the method via the monster namespace `new Monster.Types.Observer()`.
*
* ```
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.Observer()
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js';
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js';
* new Observer()
* ```
*
......@@ -52,7 +43,7 @@ import {UniqueQueue} from './uniquequeue.js';
*
* @example
*
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js';
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js';
*
* const observer = new Observer(function(a, b, c) {
* console.log(this, a, b, c); // ↦ "a", 2, true
......@@ -65,7 +56,7 @@ import {UniqueQueue} from './uniquequeue.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class Observer extends Base {
export class Observer extends Base {
/**
*
......@@ -168,9 +159,3 @@ class Observer extends Base {
};
}
assignToNamespace('Monster.Types', Observer);
export {Monster, Observer}
......@@ -4,7 +4,7 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {Observer} from "./observer.js";
import {validateInstance} from "./validate.js";
......@@ -12,21 +12,9 @@ import {validateInstance} from "./validate.js";
/**
* With the help of the ObserverList class, observer can be managed.
*
* You can call the method via the monster namespace `new Monster.Types.ObserverList()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.Types.ObserverList())
* console.log(new Monster.Types.ObserverList())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observerlist.js';
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observerlist.js';
* console.log(ObserverList())
* console.log(ObserverList())
* </script>
......@@ -36,7 +24,7 @@ import {validateInstance} from "./validate.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class ObserverList extends Base {
export class ObserverList extends Base {
/**
*
......@@ -113,6 +101,3 @@ class ObserverList extends Base {
};
}
assignToNamespace('Monster.Types', ObserverList);
export {Monster, ObserverList}
export declare let Monster: Object;
\ No newline at end of file
......@@ -3,7 +3,7 @@
/**
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
import {isArray, isObject, isPrimitive} from "./is.js";
import {Observer} from "./observer.js";
......@@ -14,33 +14,22 @@ import {extend} from "../data/extend.js";
/**
* An observer manages a callback function
*
* You can call create the class via the monster namespace `new Monster.Types.ProxyObserver()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.ProxyObserver()
* </script>
* ```
*
* Alternatively, you can also integrate this class individually.
*
* ```
* <script type="module">
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/proxyobserver.js';
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/proxyobserver.js';
* 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.
* 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 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/proxyobserver.js';
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js';
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js';
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/proxyobserver.js';
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js';
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js';
*
* const o = new Observer(function () {
* if (isObject(this) && this instanceof ProxyObserver) {
......@@ -68,7 +57,7 @@ import {extend} from "../data/extend.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
class ProxyObserver extends Base {
export class ProxyObserver extends Base {
/**
*
......@@ -167,9 +156,6 @@ class ProxyObserver extends Base {
}
assignToNamespace('Monster.Types', ProxyObserver);
export {Monster, ProxyObserver}
/**
*
* @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}}
......
......@@ -3,7 +3,7 @@
/**
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from './base.js';
/**
......@@ -11,23 +11,14 @@ import {Base} from './base.js';
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Types.Queue()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/queue.js';
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/queue.js';
* new Queue()
* </script>
* ```
*
* @example
*
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/queue.js';
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/queue.js';
*
* const queue = new Queue;
*
......@@ -53,7 +44,7 @@ import {Base} from './base.js';
* @memberOf Monster.Types
* @summary A Queue (Fifo)
*/
class Queue extends Base {
export class Queue extends Base {
/**
*
......@@ -120,6 +111,3 @@ class Queue extends Base {
}
assignToNamespace('Monster.Types', Queue);
export {Monster, Queue}
......@@ -4,7 +4,7 @@ import {random} from "../math/random.js";
/**
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {getGlobal} from "./global.js";
import {ID} from "./id.js";
......@@ -15,20 +15,11 @@ import {ID} from "./id.js";
let internalCounter = 0;
/**
* You can call the method via the monster namespace `new Monster.Types.RandomID()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.Types.RandomID())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
* The `RandomID` class provides a unique ID for an item.
*
* ```
* <script type="module">
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/randomid.js';
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/randomid.js';
* console.log(new RandomID())
* </script>
* ```
......@@ -38,7 +29,7 @@ let internalCounter = 0;
* @memberOf Monster.Types
* @summary class to generate random numbers
*/
class RandomID extends ID {
export class RandomID extends ID {
/**
* create new object
......@@ -55,6 +46,3 @@ class RandomID extends ID {
}
}
assignToNamespace('Monster.Types', RandomID);
export {Monster, RandomID}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment