Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results
Show changes
Showing
with 25 additions and 23 deletions
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{isObject}from"../types/is.js";class IsObject extends AbstractConstraint{isValid(value){if(isObject(value)){return Promise.resolve(value)}return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.Constraints";
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(value){var self=this;return new Promise(function(resolve,reject){let a,b;self.operantA.isValid(value).then(function(){resolve()}).catch(function(){a=false;if(b===false){reject()}});self.operantB.isValid(value).then(function(){resolve()}).catch(function(){b=false;if(a===false){reject()}})})}}Monster.assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(value){return Promise.resolve(value)}}Monster.assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{isFunction}from"../types/is.js";import{validateString}from"../types/validate.js";import{Pathfinder}from"./pathfinder.js";function buildMap(subject,selector,valuePath,keyPath,filter){validateString(selector);const result=new Map;let finder=new Pathfinder(subject);let map=finder.getVia(selector);if(!(map instanceof Map)){return result}map.forEach((v,k,m)=>{if(isFunction(filter)){if(filter.call(m,v,k)!==true)return}k=build(v,keyPath,k);v=build(v,valuePath);result.set(k,v)});return result}function build(subject,definition,defaultValue){if(definition===undefined)return defaultValue?defaultValue:subject;validateString(definition);const regexp=/(?<placeholder>\$\{(?<path>[a-z.-]*)\})/gm;const array=[...definition.matchAll(regexp)];let finder=new Pathfinder(subject);if(array.length===0){return finder.getVia(definition)}array.forEach(a=>{let groups=a?.["groups"];let placeholder=groups?.["placeholder"];if(placeholder===undefined)return;let path=groups?.["path"];let v=finder.getVia(path);definition=definition.replaceAll(placeholder,v)});return definition}Monster.assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,isArray,isObject}from"../types/is.js";function Diff(first,second){return doDiff(first,second)}function getKeys(a,b,type){if(isArray(type)){const keys=a.length>b.length?new Array(a.length):new Array(b.length);keys.fill(0);return new Set(keys.map((_,i)=>i))}return new Set(Object.keys(a).concat(Object.keys(b)))}function doDiff(a,b,path,diff){let typeA=typeof a;let typeB=typeof b;const currPath=path||[];const currDiff=diff||[];if(typeA===typeB&&typeA==="object"){getKeys(a,b,typeA).forEach(v=>{if(!Object.prototype.hasOwnProperty.call(a,v)){currDiff.push(buildResult(a[v],b[v],"add",currPath.concat(v)))}else if(!Object.prototype.hasOwnProperty.call(b,v)){currDiff.push(buildResult(a[v],b[v],"delete",currPath.concat(v)))}else{doDiff(a[v],b[v],currPath.concat(v),currDiff)}})}else{const o=getOperator(a,b,typeA,typeB);if(o!==undefined){currDiff.push(buildResult(a,b,o,path))}}return currDiff}function buildResult(a,b,operator,path){const result={operator,path};if(operator!=="add"){result.first={value:a,type:typeof a};if(isObject(a)){const name=Object.getPrototypeOf(a)?.constructor?.name;if(name!==undefined){result.first.instance=name}}}if(operator==="add"||operator==="update"){result.second={value:b,type:typeof b};if(isObject(b)){const name=Object.getPrototypeOf(b)?.constructor?.name;if(name!==undefined){result.second.instance=name}}}return result}function isNotEqual(a,b){if(typeof a!==typeof b){return true}if(a instanceof Date&&b instanceof Date){return a.getTime()!==b.getTime()}return a!==b}function getOperator(a,b){let operator;let typeA=typeof a;let typeB=typeof b;if(typeA==="undefined"&&typeB!=="undefined"){operator="add"}else if(typeA!=="undefined"&&typeB==="undefined"){operator="delete"}else if(isNotEqual(a,b)){operator="update"}return operator}Monster.assignToNamespace("Monster.Data",Diff);export{Monster,Diff};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.Data";
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{isObject,isArray,isInteger}from"../types/is.js";import{validateString,validateInteger}from"../types/validate.js";import{Base}from"../types/base.js";import{Stack}from"../types/stack.js";const DELIMITER=".";const WILDCARD="*";class Pathfinder extends Base{constructor(object){super();this.object=object;this.wildCard=WILDCARD}setWildCard(wildcard){validateString(wildcard);this.wildCard=wildcard;return this}getVia(path){validateString(path);return getValueViaPath.call(this,this.object,path)}setVia(path,value){validateString(path);setValueViaPath.call(this,this.object,path,value);return this}deleteVia(path){validateString(path);deleteValueViaPath.call(this,this.object,path);return this}exists(path){validateString(path);try{getValueViaPath.call(this,this.object,path,true);return true}catch(e){}return false}}Monster.assignToNamespace("Monster.Data",Pathfinder);export{Monster,Pathfinder};function iterate(subject,path,check){const result=new Map;if(isObject(subject)||isArray(subject)){for(const[key,value]of Object.entries(subject)){result.set(key,getValueViaPath.call(this,value,path,check))}}else{let key=path.split(DELIMITER).shift();result.set(key,getValueViaPath.call(this,subject,path,check))}return result}function getValueViaPath(subject,path,check){if(path===""){return subject}let parts=path.split(DELIMITER);let current=parts.shift();if(current===this.wildCard){return iterate.call(this,subject,parts.join(DELIMITER),check)}if(isObject(subject)||isArray(subject)){let anchor;if(subject instanceof Map||subject instanceof WeakMap){anchor=subject.get(current)}else if(subject instanceof Set||subject instanceof WeakSet){current=parseInt(current);validateInteger(current);anchor=[...subject]?.[current]}else if(subject instanceof WeakRef){throw Error("unsupported action for this data type")}else if(isArray(subject)){current=parseInt(current);validateInteger(current);anchor=subject?.[current]}else{anchor=subject?.[current]}if(isObject(anchor)||isArray(anchor)){return getValueViaPath.call(this,anchor,parts.join(DELIMITER),check)}if(parts.length>0){throw Error("the journey is not at its end ("+parts.join(DELIMITER)+")")}if(check===true&&!subject.hasOwnProperty(current)){throw Error("unknown value")}return anchor}throw TypeError("unsupported type "+typeof subject)}function setValueViaPath(object,path,value){validateString(path);let parts=path.split(DELIMITER);let last=parts.pop();let subpath=parts.join(DELIMITER);let stack=new Stack;let current=subpath;while(true){try{getValueViaPath.call(this,object,current,true);break}catch(e){}stack.push(current);parts.pop();current=parts.join(DELIMITER);if(current==="")break}while(!stack.isEmpty()){current=stack.pop();let obj={};if(!stack.isEmpty()){let n=stack.peek().split(DELIMITER).pop();if(isInteger(parseInt(n))){obj=[]}}setValueViaPath.call(this,object,current,obj)}let anchor=getValueViaPath.call(this,object,subpath);if(!isObject(object)&&!isArray(object)){throw TypeError("unsupported type: "+typeof object)}if(anchor instanceof Map||anchor instanceof WeakMap){anchor.set(last,value)}else if(anchor instanceof Set||anchor instanceof WeakSet){anchor.append(value)}else if(anchor instanceof WeakRef){throw Error("unsupported action for this data type")}else if(isArray(anchor)){last=parseInt(last);validateInteger(last);anchor[last]=value}else{anchor[last]=value}return}function deleteValueViaPath(object,path){const parts=path.split(DELIMITER);let last=parts.pop();const subpath=parts.join(DELIMITER);const anchor=getValueViaPath.call(this,object,subpath);if(anchor instanceof Map){anchor.delete(last)}else if(anchor instanceof Set||anchor instanceof WeakMap||anchor instanceof WeakSet||anchor instanceof WeakRef){throw Error("unsupported action for this data type")}else if(isArray(anchor)){last=parseInt(last);validateInteger(last);delete anchor[last]}else{delete anchor[last]}return}
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{Transformer}from"./transformer.js";import{Base}from"../types/base.js";import{validateFunction,validateString}from"../types/validate.js";const DELIMITER="|";class Pipe extends Base{constructor(pipe){super();validateString(pipe);this.pipe=pipe.split(DELIMITER).map(v=>{return new Transformer(v)})}setCallback(name,callback){for(const[,t]of Object.entries(this.pipe)){t.setCallback(name,callback)}return this}run(value){return this.pipe.reduce((accumulator,transformer,currentIndex,array)=>{return transformer.run(accumulator)},value)}}Monster.assignToNamespace("Monster.Data",Pipe);export{Monster,Pipe};
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{Transformer}from"./transformer.js";import{Base}from"../types/base.js";import{validateFunction,validateString}from"../types/validate.js";const DELIMITER="|";class Pipe extends Base{constructor(pipe){super();validateString(pipe);this.pipe=pipe.split(DELIMITER).map(v=>{return new Transformer(v)})}setCallback(name,callback,context){for(const[,t]of Object.entries(this.pipe)){t.setCallback(name,callback,context)}return this}run(value){return this.pipe.reduce((accumulator,transformer,currentIndex,array)=>{return transformer.run(accumulator)},value)}}Monster.assignToNamespace("Monster.Data",Pipe);export{Monster,Pipe};
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString,validatePrimitive,validateFunction,validateInteger}from"../types/validate.js";import{isObject,isString,isArray}from"../types/is.js";import{ID}from"../types/id.js";import{clone}from"../util/clone.js";import{Pathfinder}from"./pathfinder.js";class Transformer extends Base{constructor(definition){super();validateString(definition);this.args=disassemble(definition);this.command=this.args.shift();this.callbacks=new Map}setCallback(name,callback){validateString(name);validateFunction(callback);this.callbacks.set(name,callback);return this}run(value){return transform.apply(this,[value])}}Monster.assignToNamespace("Monster.Data",Transformer);export{Monster,Transformer};function disassemble(command){validateString(command);let placeholder=new Map;const regex=/((?<pattern>\\(?<char>.)){1})/mig;let result=command.matchAll(regex);for(let m of result){let g=m?.["groups"];if(!isObject(g)){continue}let p=g?.["pattern"];let c=g?.["char"];if(p&&c){let r="__"+new ID().toString()+"__";placeholder.set(r,c);command=command.replace(p,r)}}let parts=command.split(":");parts=parts.map(function(value){let v=value.trim();for(let k of placeholder){v=v.replace(k[0],k[1])}return v});return parts}function convertToString(value){if(isObject(value)&&value.hasOwnProperty("toString")){value=value.toString()}validateString(value);return value}function transform(value){let args=clone(this.args);let key;switch(this.command){case"static":return this.args.join(":");case"tolower":case"strtolower":case"tolowercase":validateString(value);return value.toLowerCase();case"toupper":case"strtoupper":case"touppercase":validateString(value);return value.toUpperCase();case"tostring":return""+value;case"tointeger":let n=parseInt(value);validateInteger(n);return n;case"tojson":return JSON.stringify(value);case"trim":validateString(value);return value.trim();case"rawurlencode":validateString(value);return encodeURIComponent(value).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A");case"call":let callback;let callbackName=args.shift();if(isObject(value)&&value.hasOwnProperty(callbackName)){callback=value[callbackName]}else if(this.callbacks.has(callbackName)){callback=this.callbacks.get(callbackName)}else if(typeof window==="object"&&window.hasOwnProperty(callbackName)){callback=window[callbackName]}validateFunction(callback);args.unshift(value);return callback(...args);case"plain":case"plaintext":validateString(value);let doc=new DOMParser().parseFromString(value,"text/html");return doc.body.textContent||"";case"if":case"?":validatePrimitive(value);let trueStatement=args.shift()||undefined;let falseStatement=args.shift()||undefined;if(trueStatement==="value"){trueStatement=value}if(trueStatement==="\\value"){trueStatement="value"}if(falseStatement==="value"){falseStatement=value}if(falseStatement==="\\value"){falseStatement="value"}let condition=value!==undefined&&value!==""&&value!=="off"&&value!=="false"&&value!==false||value==="on"||value==="true"||value===true;return condition?trueStatement:falseStatement;case"ucfirst":validateString(value);let firstchar=value.charAt(0).toUpperCase();return firstchar+value.substr(1);case"ucwords":validateString(value);return value.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(v){return v.toUpperCase()});case"count":case"length":if((isString(value)||isObject(value)||isArray(value))&&value.hasOwnProperty("length")){return value.length}throw new TypeError("unsupported type");case"base64":convertToString(value);return btoa(value);case"empty":return"";case"undefined":return undefined;case"prefix":validateString(value);let prefix=args?.[0];return prefix+value;case"suffix":validateString(value);let suffix=args?.[0];return value+suffix;case"uniqid":return new ID().toString();case"key":case"property":case"index":key=args.shift()||"undefined";let defaultValue=args.shift()||"";if(value instanceof Map){if(!value.has(key)){return defaultValue}return value.get(key)}if(isObject(value)||isArray(value)){if(value?.[key]){return value?.[key]}return defaultValue}throw new Error("type not supported");case"path":key=args.shift()||"undefined";return new Pathfinder(value).getVia(key);case"substring":validateString(value);let start=parseInt(args[0])||0;let end=(parseInt(args[1])||0)+start;return value.substring(start,end);case"nop":return value;default:throw new Error("unknown command "+this.command);}return value}
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobal}from"../types/global.js";import{validateString,validatePrimitive,validateFunction,validateInteger,validateObject}from"../types/validate.js";import{isObject,isString,isArray}from"../types/is.js";import{ID}from"../types/id.js";import{clone}from"../util/clone.js";import{Pathfinder}from"./pathfinder.js";class Transformer extends Base{constructor(definition){super();validateString(definition);this.args=disassemble(definition);this.command=this.args.shift();this.callbacks=new Map}setCallback(name,callback,context){validateString(name);validateFunction(callback);if(context!==undefined){validateObject(context)}this.callbacks.set(name,{callback:callback,context:context});return this}run(value){return transform.apply(this,[value])}}Monster.assignToNamespace("Monster.Data",Transformer);export{Monster,Transformer};function disassemble(command){validateString(command);let placeholder=new Map;const regex=/((?<pattern>\\(?<char>.)){1})/mig;let result=command.matchAll(regex);for(let m of result){let g=m?.["groups"];if(!isObject(g)){continue}let p=g?.["pattern"];let c=g?.["char"];if(p&&c){let r="__"+new ID().toString()+"__";placeholder.set(r,c);command=command.replace(p,r)}}let parts=command.split(":");parts=parts.map(function(value){let v=value.trim();for(let k of placeholder){v=v.replace(k[0],k[1])}return v});return parts}function convertToString(value){if(isObject(value)&&value.hasOwnProperty("toString")){value=value.toString()}validateString(value);return value}function transform(value){let args=clone(this.args);let key;switch(this.command){case"static":return this.args.join(":");case"tolower":case"strtolower":case"tolowercase":validateString(value);return value.toLowerCase();case"toupper":case"strtoupper":case"touppercase":validateString(value);return value.toUpperCase();case"tostring":return""+value;case"tointeger":let n=parseInt(value);validateInteger(n);return n;case"tojson":return JSON.stringify(value);case"trim":validateString(value);return value.trim();case"rawurlencode":validateString(value);return encodeURIComponent(value).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A");case"call":let callback;let callbackName=args.shift();let context=getGlobal();if(isObject(value)&&value.hasOwnProperty(callbackName)){callback=value[callbackName]}else if(this.callbacks.has(callbackName)){let s=this.callbacks.get(callbackName);callback=s?.["callback"];context=s?.["context"]}else if(typeof window==="object"&&window.hasOwnProperty(callbackName)){callback=window[callbackName]}validateFunction(callback);args.unshift(value);return callback.call(context,...args);case"plain":case"plaintext":validateString(value);let doc=new DOMParser().parseFromString(value,"text/html");return doc.body.textContent||"";case"if":case"?":validatePrimitive(value);let trueStatement=args.shift()||undefined;let falseStatement=args.shift()||undefined;if(trueStatement==="value"){trueStatement=value}if(trueStatement==="\\value"){trueStatement="value"}if(falseStatement==="value"){falseStatement=value}if(falseStatement==="\\value"){falseStatement="value"}let condition=value!==undefined&&value!==""&&value!=="off"&&value!=="false"&&value!==false||value==="on"||value==="true"||value===true;return condition?trueStatement:falseStatement;case"ucfirst":validateString(value);let firstchar=value.charAt(0).toUpperCase();return firstchar+value.substr(1);case"ucwords":validateString(value);return value.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(v){return v.toUpperCase()});case"count":case"length":if((isString(value)||isObject(value)||isArray(value))&&value.hasOwnProperty("length")){return value.length}throw new TypeError("unsupported type");case"base64":convertToString(value);return btoa(value);case"empty":return"";case"undefined":return undefined;case"prefix":validateString(value);let prefix=args?.[0];return prefix+value;case"suffix":validateString(value);let suffix=args?.[0];return value+suffix;case"uniqid":return new ID().toString();case"key":case"property":case"index":key=args.shift()||"undefined";let defaultValue=args.shift()||"";if(value instanceof Map){if(!value.has(key)){return defaultValue}return value.get(key)}if(isObject(value)||isArray(value)){if(value?.[key]){return value?.[key]}return defaultValue}throw new Error("type not supported");case"path":key=args.shift()||"undefined";return new Pathfinder(value).getVia(key);case"substring":validateString(value);let start=parseInt(args[0])||0;let end=(parseInt(args[1])||0)+start;return value.substring(start,end);case"nop":return value;default:throw new Error("unknown command "+this.command);}return value}
This diff is collapsed.
/** Monster 1.8.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
/** Monster 1.9.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.DOM";