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

chore: commit save point

parent fcc71af1
Branches
Tags
No related merge requests found
Showing
with 145 additions and 74 deletions
'use strict';
/**
* @namespace Monster.Logging.Handler
* @memberOf Monster.Logging
* @author schukai GmbH
*/
const ns = {};
......@@ -8,6 +8,7 @@
import {Base} from '../types/base.js';
import {validateInteger} from '../types/validate.js';
export {LogEntry}
/**
* A log entry for the logger
......@@ -23,7 +24,7 @@ import {validateInteger} from '../types/validate.js';
* @copyright schukai GmbH
* @memberOf Monster.Logging
*/
export class LogEntry extends Base {
class LogEntry extends Base {
/**
*
* @param {Integer} loglevel
......
......@@ -10,55 +10,56 @@ import {LogEntry} from '../logging/logentry.js';
import {Base} from '../types/base.js';
import {validateInteger, validateObject, validateString} from '../types/validate.js';
export {Logger, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF};
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const ALL = 255;
const ALL = 255;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const TRACE = 64;
const TRACE = 64;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const DEBUG = 32;
const DEBUG = 32;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const INFO = 16;
const INFO = 16;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const WARN = 8;
const WARN = 8;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const ERROR = 4;
const ERROR = 4;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const FATAL = 2;
const FATAL = 2;
/**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number}
* @memberOf Monster.Logging
*/
export const OFF = 0;
const OFF = 0;
/**
* The logger is a class that takes care of logging.
......@@ -74,7 +75,7 @@ export const OFF = 0;
* @copyright schukai GmbH
* @memberOf Monster.Logging
*/
export class Logger extends Base {
class Logger extends Base {
/**
*
......
'use strict';
/**
* Namespace for logging.
*
* @namespace Monster.Logging
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
\ No newline at end of file
'use strict';
/**
* Namespace for math.
*
* @namespace Monster.Math
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
\ No newline at end of file
......@@ -7,6 +7,7 @@
import {getGlobal} from '../types/global.js';
export {random}
/**
* this function uses crypt and returns a random number.
......@@ -30,7 +31,7 @@ import {getGlobal} from '../types/global.js';
* @since 1.0.0
* @copyright schukai GmbH
*/
export function random(min, max) {
function random(min, max) {
if (min === undefined) {
min = 0;
......
......@@ -5,6 +5,13 @@
* @author schukai GmbH
*/
/**
* Main namespace for Monster.
*
* @namespace Monster
* @author schukai GmbH
*/
'use strict';
import './constants.js';
......@@ -92,6 +99,7 @@ import './data/datasource/storage/localstorage.js';
import './data/datasource/restapi/writeerror.js';
import './math/random.js';
export {Monster}
/**
* This class has no other purpose than to exist.
......@@ -100,6 +108,6 @@ import './math/random.js';
* @copyright schukai GmbH
* @memberOf Monster
*/
export class Monster {
class Monster {
}
......@@ -13,6 +13,7 @@ import {isObject, isString} from "../types/is.js";
import {validateArray, validateString} from "../types/validate.js";
import {getMonsterVersion} from "../types/version.js";
export {Formatter}
/**
* @private
......@@ -114,7 +115,7 @@ const workingDataSymbol = Symbol('workingData');
* @copyright schukai GmbH
* @memberOf Monster.Text
*/
export class Formatter extends BaseWithOptions {
class Formatter extends BaseWithOptions {
/**
* Default values for the markers are `${` and `}`
......
'use strict';
/**
* Namespace for texts.
*
* @namespace Monster.Text
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
......@@ -4,7 +4,7 @@
* @author schukai GmbH
*/
export {Base}
/**
* This is the base class from which all monster classes are derived.
......@@ -22,7 +22,7 @@
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class Base extends Object {
class Base extends Object {
/**
*
......
......@@ -11,6 +11,8 @@ import {Pathfinder} from "../data/pathfinder.js";
import {Base} from "./base.js";
import {validateObject} from "./validate.js";
export {BaseWithOptions}
/**
* This is the base class with options from which some monster classes are derived.
*
......@@ -42,7 +44,7 @@ import {validateObject} from "./validate.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class BaseWithOptions extends Base {
class BaseWithOptions extends Base {
/**
*
......
'use strict';
import {assignToNamespace} from "../namespace.js";
/**
* @author schukai GmbH
*/
import {Monster, validateString} from "./validate.js";
import {validateString} from "./validate.js";
export {toBinary, fromBinary}
/**
* You can call the function via the monster namespace `Monster.Types.toBinary()`.
......@@ -24,7 +23,7 @@ import {Monster, validateString} from "./validate.js";
* @memberOf Monster.Types
* @since 1.18.0
*/
export function toBinary(string) {
function toBinary(string) {
const codeUnits = new Uint16Array(validateString(string).length);
for (let i = 0; i < codeUnits.length; i++) {
codeUnits[i] = string.charCodeAt(i);
......@@ -56,7 +55,7 @@ export function toBinary(string) {
* @memberOf Monster.Types
* @since 1.18.0
*/
export function fromBinary(binary) {
function fromBinary(binary) {
const bytes = new Uint8Array(validateString(binary).length);
for (let i = 0; i < bytes.length; i++) {
bytes[i] = binary.charCodeAt(i);
......
'use strict';
import {assignToNamespace} from "../namespace.js";
/**
* @author schukai GmbH
*/
import {Base, Monster} from "./base.js";
import {isString} from "./is.js";
import {MediaType, parseMediaType} from "./mediatype.js";
import {validateBoolean, validateInstance, validateString} from "./validate.js";
export {DataUrl, parseDataURL}
/**
* @private
* @type {symbol}
*/
const internal = Symbol('internal');
/**
* You can create an object via the monster namespace `new Monster.Types.DataUrl()`.
*
......@@ -31,7 +35,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
*/
export class DataUrl extends Base {
class DataUrl extends Base {
/**
*
......@@ -111,7 +115,7 @@ export class DataUrl extends Base {
* @throws {TypeError} malformed data url
* @memberOf Monster.Types
*/
export function parseDataURL(dataurl) {
function parseDataURL(dataurl) {
validateString(dataurl);
......
......@@ -7,6 +7,8 @@
import {Base} from './base.js';
import {validateString} from "./validate.js";
export {ID}
/**
* @private
* @type {Map<string, integer>}
......@@ -34,7 +36,7 @@ let internalCounter = new Map;
* @memberOf Monster.Types
* @summary Automatic generation of ids
*/
export class ID extends Base {
class ID extends Base {
/**
* create new id with prefix
......
......@@ -4,6 +4,7 @@
* @author schukai GmbH
*/
export {isIterable, isPrimitive, isSymbol, isBoolean, isString, isObject, isInstance, isArray, isFunction, isInteger}
/**
......@@ -28,7 +29,7 @@
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isIterable(value) {
function isIterable(value) {
if (value === undefined) return false;
if (value === null) return false;
return typeof value?.[Symbol.iterator] === 'function';
......@@ -54,7 +55,7 @@ export function isIterable(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isPrimitive(value) {
function isPrimitive(value) {
var type;
if (value === undefined || value === null) {
......@@ -89,7 +90,7 @@ export function isPrimitive(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isSymbol(value) {
function isSymbol(value) {
return ('symbol' === typeof value) ? true : false;
}
......@@ -113,7 +114,7 @@ export function isSymbol(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isBoolean(value) {
function isBoolean(value) {
if (value === true || value === false) {
return true;
......@@ -141,7 +142,7 @@ export function isBoolean(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isString(value) {
function isString(value) {
if (value === undefined || typeof value !== 'string') {
return false;
}
......@@ -167,7 +168,7 @@ export function isString(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isObject(value) {
function isObject(value) {
if (isArray(value)) return false;
if (isPrimitive(value)) return false;
......@@ -199,13 +200,11 @@ export function isObject(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isInstance(value, instance) {
function isInstance(value, instance) {
if (!isObject(value)) return false;
if (!isFunction(instance)) return false;
if (!instance.hasOwnProperty('prototype')) return false;
return (value instanceof instance) ? true : false;
}
/**
......@@ -228,7 +227,7 @@ export function isInstance(value, instance) {
* @memberOf Monster.Types
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
*/
export function isArray(value) {
function isArray(value) {
return Array.isArray(value);
}
......@@ -252,7 +251,7 @@ export function isArray(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isFunction(value) {
function isFunction(value) {
if (isArray(value)) return false;
if (isPrimitive(value)) return false;
......@@ -284,7 +283,7 @@ export function isFunction(value) {
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export function isInteger(value) {
function isInteger(value) {
return Number.isInteger(value);
}
'use strict';
import {assignToNamespace} from "../namespace.js";
/**
* @author schukai GmbH
*/
import {Base, Monster} from "./base.js";
import {isString} from "./is.js";
import {validateArray, validateString} from "./validate.js";
export {MediaType, parseMediaType}
/**
* @private
......@@ -37,7 +39,7 @@ const internal = Symbol('internal');
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class MediaType extends Base {
class MediaType extends Base {
/**
*
......@@ -159,7 +161,7 @@ export class MediaType extends Base {
* @throws {TypeError} malformed data url
* @memberOf Monster.Types
*/
export function parseMediaType(mediatype) {
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));
......
'use strict';
/**
* Namespace for types.
*
* @namespace Monster.Types
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
......@@ -4,13 +4,13 @@
* @author schukai GmbH
*/
import {Base} from './base.js';
import {isPrimitive} from "./is.js";
import {NodeList} from './nodelist.js';
import {validateInstance} from './validate.js';
export {Node}
/**
* @private
* @type {symbol}
......@@ -40,7 +40,7 @@ const treeStructureSymbol = Symbol('treeStructure');
* @summary A Node Class
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Iteration_protocols
*/
export class Node extends Base {
class Node extends Base {
/**
* @param {*} [value]
......
......@@ -8,6 +8,8 @@ import {isArray, isInstance} from "./is.js";
import {Node} from "./node.js";
import {validateInstance} from "./validate.js";
export {NodeList}
/**
* You can create the instance via the monster namespace `new Monster.Types.NodeList()`.
*
......@@ -23,7 +25,7 @@ import {validateInstance} from "./validate.js";
* @memberOf Monster.Types
* @summary A NodeList class
*/
export class NodeList extends Set {
class NodeList extends Set {
/**
* @throws {Error} invalid value type
......
......@@ -4,7 +4,6 @@
* @author schukai GmbH
*/
import {internalSymbol} from "../constants.js";
import {Base} from './base.js';
......@@ -13,6 +12,7 @@ import {Node} from "./node.js";
import {NodeList} from "./nodelist.js";
import {validateInstance} from "./validate.js";
export {NodeRecursiveIterator}
/**
* @private
......@@ -69,7 +69,7 @@ const isNodeListSymbol = Symbol('isNodeList');
* @memberOf Monster.Types
* @summary An iterator to run recursively through a tree of nodes
*/
export class NodeRecursiveIterator extends Base {
class NodeRecursiveIterator extends Base {
/**
* @param {Node} [data]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment