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
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 44 deletions
......@@ -4,12 +4,13 @@
* @author schukai GmbH
*/
import {Base} from './base.js';
import {isObject} from './is.js';
import {TokenList} from './tokenlist.js';
import {UniqueQueue} from './uniquequeue.js';
export {Observer}
/**
* An observer manages a callback function
*
......@@ -56,7 +57,7 @@ import {UniqueQueue} from './uniquequeue.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class Observer extends Base {
class Observer extends Base {
/**
*
......
......@@ -4,11 +4,12 @@
* @author schukai GmbH
*/
import {Base} from './base.js';
import {Observer} from "./observer.js";
import {validateInstance} from "./validate.js";
export {ObserverList}
/**
* With the help of the ObserverList class, observer can be managed.
*
......@@ -24,7 +25,7 @@ import {validateInstance} from "./validate.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class ObserverList extends Base {
class ObserverList extends Base {
/**
*
......
......@@ -11,6 +11,8 @@ import {ObserverList} from "./observerlist.js";
import {validateObject} from "./validate.js";
import {extend} from "../data/extend.js";
export {ProxyObserver}
/**
* An observer manages a callback function
*
......@@ -57,7 +59,7 @@ import {extend} from "../data/extend.js";
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class ProxyObserver extends Base {
class ProxyObserver extends Base {
/**
*
......
......@@ -6,6 +6,8 @@
import {Base} from './base.js';
export {Queue}
/**
* You can create the instance via the monster namespace `new Monster.Types.Queue()`.
*
......@@ -44,7 +46,7 @@ import {Base} from './base.js';
* @memberOf Monster.Types
* @summary A Queue (Fifo)
*/
export class Queue extends Base {
class Queue extends Base {
/**
*
......
'use strict';
import {random} from "../math/random.js";
/**
* @author schukai GmbH
*/
import {random} from "../math/random.js";
import {getGlobal} from "./global.js";
import {ID} from "./id.js";
export {RandomID}
/**
* @private
* @type {number}
......@@ -29,7 +32,7 @@ let internalCounter = 0;
* @memberOf Monster.Types
* @summary class to generate random numbers
*/
export class RandomID extends ID {
class RandomID extends ID {
/**
* create new object
......
......@@ -4,10 +4,11 @@
* @author schukai GmbH
*/
import {assignToNamespace, Monster} from "../namespace.js";
import {validateString} from "./validate.js";
export {escapeString}
/**
* This function prefixes all special characters that may appear in a regex with a slash.
*
......@@ -25,7 +26,7 @@ import {validateString} from "./validate.js";
* @memberOf Monster.Types
* @throws {TypeError} value is not a string
*/
export function escapeString(value) {
function escapeString(value) {
return validateString(value)
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
.replace(/-/g, '\\x2d');
......
......@@ -4,9 +4,10 @@
* @author schukai GmbH
*/
import {Base} from './base.js';
export {Stack}
/**
* You can call the method via the monster namespace `new Monster.Types.Queue()`.
*
......@@ -21,7 +22,7 @@ import {Base} from './base.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class Stack extends Base {
class Stack extends Base {
/**
*
......
......@@ -4,11 +4,12 @@
* @author schukai GmbH
*/
import {isIterable, isString} from '../types/is.js';
import {validateFunction, validateString} from '../types/validate.js';
import {Base} from './base.js';
export {TokenList}
/**
* A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string).
*
......@@ -32,7 +33,7 @@ import {Base} from './base.js';
* @copyright schukai GmbH
* @memberOf Monster.Types
*/
export class TokenList extends Base {
class TokenList extends Base {
/**
*
......
......@@ -4,8 +4,7 @@
* @author schukai GmbH
*/
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.
......
......@@ -4,10 +4,11 @@
* @author schukai GmbH
*/
import {Queue} from "./queue.js";
import {validateObject} from "./validate.js";
export {UniqueQueue}
/**
* A UniqueQueue is a queue that contains items only once.
*
......@@ -23,7 +24,7 @@ import {validateObject} from "./validate.js";
* @memberOf Monster.Types
* @summary A queue for unique values
*/
export class UniqueQueue extends Queue {
class UniqueQueue extends Queue {
/**
*
......
......@@ -11,6 +11,8 @@ import {isObject} from '../types/is.js';
import {Base} from "./base.js";
import {getGlobalObject} from "./global.js";
export {UUID}
/**
* The UUID class makes it possible to get a unique UUID for an object.
*
......@@ -26,7 +28,7 @@ import {getGlobalObject} from "./global.js";
* @memberOf Monster.Types
* @throws {Error} unsupported
*/
export class UUID extends Base {
class UUID extends Base {
/**
*
......
......@@ -4,7 +4,6 @@
* @author schukai GmbH
*/
import {
isArray,
isBoolean,
......@@ -18,6 +17,19 @@ import {
isSymbol
} from './is.js';
export {
validateIterable,
validatePrimitive,
validateBoolean,
validateString,
validateObject,
validateInstance,
validateArray,
validateSymbol,
validateFunction,
validateInteger
}
/**
* This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.
*
......@@ -39,7 +51,7 @@ import {
* @see {@link Monster.Types.isPrimitive}
* @see {@link Monster.Types#isPrimitive}
*/
export function validateIterable(value) {
function validateIterable(value) {
if (!isIterable(value)) {
throw new TypeError('value is not iterable')
}
......@@ -67,7 +79,7 @@ export function validateIterable(value) {
* @see {@link Monster.Types.isPrimitive}
* @see {@link Monster.Types#isPrimitive}
*/
export function validatePrimitive(value) {
function validatePrimitive(value) {
if (!isPrimitive(value)) {
throw new TypeError('value is not a primitive')
}
......@@ -94,7 +106,7 @@ export function validatePrimitive(value) {
* @throws {TypeError} value is not primitive
*/
export function validateBoolean(value) {
function validateBoolean(value) {
if (!isBoolean(value)) {
throw new TypeError('value is not a boolean')
}
......@@ -119,7 +131,7 @@ export function validateBoolean(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not a string
*/
export function validateString(value) {
function validateString(value) {
if (!isString(value)) {
throw new TypeError('value is not a string')
}
......@@ -146,7 +158,7 @@ export function validateString(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not a object
*/
export function validateObject(value) {
function validateObject(value) {
if (!isObject(value)) {
throw new TypeError('value is not a object')
}
......@@ -172,7 +184,7 @@ export function validateObject(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not an instance of
*/
export function validateInstance(value, instance) {
function validateInstance(value, instance) {
if (!isInstance(value, instance)) {
let n = "";
if (isObject(instance) || isFunction(instance)) {
......@@ -206,7 +218,7 @@ export function validateInstance(value, instance) {
* @memberOf Monster.Types
* @throws {TypeError} value is not an array
*/
export function validateArray(value) {
function validateArray(value) {
if (!isArray(value)) {
throw new TypeError('value is not an array')
}
......@@ -231,7 +243,7 @@ export function validateArray(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not an symbol
*/
export function validateSymbol(value) {
function validateSymbol(value) {
if (!isSymbol(value)) {
throw new TypeError('value is not an symbol')
}
......@@ -257,7 +269,7 @@ export function validateSymbol(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not a function
*/
export function validateFunction(value) {
function validateFunction(value) {
if (!isFunction(value)) {
throw new TypeError('value is not a function')
}
......@@ -283,7 +295,7 @@ export function validateFunction(value) {
* @memberOf Monster.Types
* @throws {TypeError} value is not an integer
*/
export function validateInteger(value) {
function validateInteger(value) {
if (!isInteger(value)) {
throw new TypeError('value is not an integer')
}
......
'use strict';
/**
* @author schukai GmbH
*/
import {Base} from './base.js';
export {Version, getMonsterVersion}
/**
* The version object contains a sematic version number
*
......@@ -29,7 +34,7 @@ import {Base} from './base.js';
* @memberOf Monster.Types
* @summary The version object contains a sematic version number
*/
export class Version extends Base {
class Version extends Base {
/**
*
......@@ -156,7 +161,7 @@ let monsterVersion;
* @author schukai GmbH
* @memberOf Monster
*/
export function getMonsterVersion() {
function getMonsterVersion() {
if (monsterVersion instanceof Version) {
return monsterVersion;
}
......
......@@ -10,6 +10,7 @@ import {isArray, isFunction, isObject, isPrimitive} from '../types/is.js';
import {typeOf} from "../types/typeof.js";
import {validateObject} from "../types/validate.js";
export {clone}
/**
* With this function, objects can be cloned.
......@@ -34,7 +35,7 @@ import {validateObject} from "../types/validate.js";
* @copyright schukai GmbH
* @throws {Error} unable to clone obj! its type isn't supported.
*/
export function clone(obj) {
function clone(obj) {
// typeof null results in 'object'. https://2ality.com/2013/10/typeof-null.html
if (null === obj) {
......@@ -144,3 +145,4 @@ function cloneObject(obj) {
return copy;
}
......@@ -7,6 +7,8 @@
import {Base} from '../types/base.js';
import {isFunction} from '../types/is.js';
export {Comparator}
/**
* The comparator allows a comparison function to be abstracted.
*
......@@ -51,7 +53,7 @@ import {isFunction} from '../types/is.js';
* @since 1.3.0
* @memberOf Monster.Util
*/
export class Comparator extends Base {
class Comparator extends Base {
/**
* create new comparator
......
......@@ -4,13 +4,14 @@
* @author schukai GmbH
*/
import {internalSymbol} from "../constants.js";
import {Base} from "../types/base.js";
import {isInteger} from "../types/is.js";
import {validateFunction, validateInteger} from "../types/validate.js";
export {DeadMansSwitch}
/**
* The dead man's switch allows to set a timer which can be reset again and again within a defined period of time.
*
......@@ -37,7 +38,7 @@ import {validateFunction, validateInteger} from "../types/validate.js";
* @memberOf Monster.Util
* @summary Class to be able to execute function chains
*/
export class DeadMansSwitch extends Base {
class DeadMansSwitch extends Base {
/**
* Create new dead man's switch
......
......@@ -4,9 +4,10 @@
* @author schukai GmbH
*/
import {validateObject} from '../types/validate.js';
export {deepFreeze}
/**
* Deep freeze a object
*
......@@ -24,7 +25,7 @@ import {validateObject} from '../types/validate.js';
* @copyright schukai GmbH
* @throws {TypeError} value is not a object
*/
export function deepFreeze(object) {
function deepFreeze(object) {
validateObject(object)
......
'use strict';
/**
* Namespace for utilities.
*
* @namespace Monster.Util
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
\ No newline at end of file
......@@ -4,7 +4,6 @@
* @author schukai GmbH
*/
import {internalSymbol} from "../constants.js";
import {Base} from "../types/base.js";
import {getGlobalFunction} from "../types/global.js";
......@@ -12,6 +11,8 @@ import {isFunction, isInteger} from "../types/is.js";
import {Queue} from "../types/queue.js";
import {validateFunction, validateInteger} from "../types/validate.js";
export {Processing}
/**
* @private
*/
......@@ -102,7 +103,7 @@ class Callback {
* @memberOf Monster.Util
* @summary Class to be able to execute function chains
*/
export class Processing extends Base {
class Processing extends Base {
/**
* Create new Processing
......
......@@ -8,6 +8,8 @@ import {ID} from "../types/id.js";
import {isObject} from "../types/is.js";
import {validateString} from "../types/validate.js";
export {trimSpaces}
/**
* This special trim function allows to trim spaces that have been protected by a special escape character.
*
......@@ -32,7 +34,7 @@ import {validateString} from "../types/validate.js";
* @return {string}
* @throws {TypeError} value is not a string
*/
export function trimSpaces(value) {
function trimSpaces(value) {
validateString(value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment