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

#71

parent 519be23b
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 25 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.20.1] - 2021-10-19
## Fixed
- [the integration of class instances into empty arrays throws an exception](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/71)
## [1.20.0] - 2021-10-18 ## [1.20.0] - 2021-10-18
## Fixed ## Fixed
......
...@@ -40,7 +40,7 @@ For some functions you need additional [polyfills](#polyfill). ...@@ -40,7 +40,7 @@ For some functions you need additional [polyfills](#polyfill).
<script type="module"> <script type="module">
import { import {
Monster Monster
} from 'https://unpkg.com/@schukai/monster@1.20.0/dist/modules/monster.js'; } from 'https://unpkg.com/@schukai/monster@1.20.1/dist/modules/monster.js';
let id = document.getElementById('version'); let id = document.getElementById('version');
id.innerHTML = Monster.getVersion(); id.innerHTML = Monster.getVersion();
</script> </script>
...@@ -51,8 +51,8 @@ For some functions you need additional [polyfills](#polyfill). ...@@ -51,8 +51,8 @@ For some functions you need additional [polyfills](#polyfill).
`nomodule` for backwards compatibility `nomodule` for backwards compatibility
``` ```
<script type="module" src="https://unpkg.com/@schukai/monster@1.20.0/dist/modules/monster.js"></script> <script type="module" src="https://unpkg.com/@schukai/monster@1.20.1/dist/modules/monster.js"></script>
<script nomodule src="https://unpkg.com/@schukai/monster@1.20.0/dist/monster.js"></script> <script nomodule src="https://unpkg.com/@schukai/monster@1.20.1/dist/monster.js"></script>
``` ```
### Polyfill ### Polyfill
......
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{Monster}from"./namespace.js";const PROPERTY_KEY_INTERNALDATA="monsterInternalData";export{Monster,PROPERTY_KEY_INTERNALDATA}; "use strict";import{Monster}from"./namespace.js";const PROPERTY_KEY_INTERNALDATA="monsterInternalData";export{Monster,PROPERTY_KEY_INTERNALDATA};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";class AbstractConstraint extends Base{constructor(){super()}isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";class AbstractConstraint extends Base{constructor(){super()}isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(t,r){if(super(),!(t instanceof AbstractConstraint&&r instanceof AbstractConstraint))throw new TypeError("parameters must be from type AbstractConstraint");this.operantA=t,this.operantB=r}}assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(t,r){if(super(),!(t instanceof AbstractConstraint&&r instanceof AbstractConstraint))throw new TypeError("parameters must be from type AbstractConstraint");this.operantA=t,this.operantB=r}}assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(r){return Promise.all([this.operantA.isValid(r),this.operantB.isValid(r)])}}assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(r){return Promise.all([this.operantA.isValid(r),this.operantB.isValid(r)])}}assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsArray extends AbstractConstraint{isValid(s){return isArray(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsArray extends AbstractConstraint{isValid(s){return isArray(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isObject}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsObject extends AbstractConstraint{isValid(s){return isObject(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isObject}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsObject extends AbstractConstraint{isValid(s){return isObject(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Constraints";export{namespace}; "use strict";const namespace="Monster.Constraints";export{namespace};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(s){var o=this;return new Promise(function(t,r){let a,e;o.operantA.isValid(s).then(function(){t()}).catch(function(){(a=!1)===e&&r()}),o.operantB.isValid(s).then(function(){t()}).catch(function(){(e=!1)===a&&r()})})}}assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(s){var o=this;return new Promise(function(t,r){let a,e;o.operantA.isValid(s).then(function(){t()}).catch(function(){(a=!1)===e&&r()}),o.operantB.isValid(s).then(function(){t()}).catch(function(){(e=!1)===a&&r()})})}}assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(s){return Promise.resolve(s)}}assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(s){return Promise.resolve(s)}}assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction,isObject,isString}from"../types/is.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{DELIMITER,Pathfinder,WILDCARD}from"./pathfinder.js";function buildMap(t,e,a,n,r){const o=new Map;let i;if(isFunction(e)){if(i=e(t),!(i instanceof Map))throw new TypeError("the selector callback must return a map")}else{if(!isString(e))throw new TypeError("value is neither a string nor a function");i=new Map,buildFlatMap.call(i,t,e)}return i instanceof Map&&i.forEach((t,e,i)=>{isFunction(r)&&!0!==r.call(i,t,e)||(e=build(t,n,e),t=build(t,a),o.set(e,t))}),o}function buildFlatMap(i,t,a,n){var r=this;const o=new Map;var e=r.size;void 0===a&&(a=[]);let l=t.split(DELIMITER),s,p=[];do{if(s=l.shift(),p.push(s),s===WILDCARD){let t=new Pathfinder(i),e;try{e=t.getVia(p.join(DELIMITER))}catch(t){e=new Map}for(const[d,h]of e){let e=clone(a);p.map(t=>{e.push(t===WILDCARD?d:t)});var c=e.join(DELIMITER);let t=buildFlatMap.call(r,h,l.join(DELIMITER),e,h);isObject(t)&&(t["^"]=n),o.set(c,t)}}}while(0<l.length);if(e===r.size)for(var[f,u]of o)r.set(f,u);return i}function build(t,a,n){if(void 0===a)return n||t;validateString(a);const e=[...a.matchAll(/(?<placeholder>\${(?<path>[a-z\^A-Z.\-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===e.length?r.getVia(a):(e.forEach(e=>{var i=e?.groups,e=i?.placeholder;if(void 0!==e){i=i?.path;let t=r.getVia(i);void 0===t&&(t=n),a=a.replaceAll(e,t)}}),a)}assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction,isObject,isString}from"../types/is.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{DELIMITER,Pathfinder,WILDCARD}from"./pathfinder.js";function buildMap(t,e,a,n,r){const o=new Map;let i;if(isFunction(e)){if(i=e(t),!(i instanceof Map))throw new TypeError("the selector callback must return a map")}else{if(!isString(e))throw new TypeError("value is neither a string nor a function");i=new Map,buildFlatMap.call(i,t,e)}return i instanceof Map&&i.forEach((t,e,i)=>{isFunction(r)&&!0!==r.call(i,t,e)||(e=build(t,n,e),t=build(t,a),o.set(e,t))}),o}function buildFlatMap(i,t,a,n){var r=this;const o=new Map;var e=r.size;void 0===a&&(a=[]);let l=t.split(DELIMITER),s,p=[];do{if(s=l.shift(),p.push(s),s===WILDCARD){let t=new Pathfinder(i),e;try{e=t.getVia(p.join(DELIMITER))}catch(t){e=new Map}for(const[d,h]of e){let e=clone(a);p.map(t=>{e.push(t===WILDCARD?d:t)});var c=e.join(DELIMITER);let t=buildFlatMap.call(r,h,l.join(DELIMITER),e,h);isObject(t)&&(t["^"]=n),o.set(c,t)}}}while(0<l.length);if(e===r.size)for(var[f,u]of o)r.set(f,u);return i}function build(t,a,n){if(void 0===a)return n||t;validateString(a);const e=[...a.matchAll(/(?<placeholder>\${(?<path>[a-z\^A-Z.\-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===e.length?r.getVia(a):(e.forEach(e=>{var i=e?.groups,e=i?.placeholder;if(void 0!==e){i=i?.path;let t=r.getVia(i);void 0===t&&(t=n),a=a.replaceAll(e,t)}}),a)}assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap};
\ No newline at end of file
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{typeOf}from"../types/typeof.js";function Diff(e,t){return doDiff(e,t)}function getKeys(e,t,n){if(isArray(n)){const o=e.length>t.length?new Array(e.length):new Array(t.length);return o.fill(0),new Set(o.map((e,t)=>t))}return new Set(Object.keys(e).concat(Object.keys(t)))}function doDiff(t,n,e,o){var r=typeOf(t),s=typeOf(n);const a=e||[],i=o||[];return r!==s||"object"!==r&&"array"!==r?void 0!==(s=getOperator(t,n,r,s))&&i.push(buildResult(t,n,s,e)):getKeys(t,n,r).forEach(e=>{Object.prototype.hasOwnProperty.call(t,e)?Object.prototype.hasOwnProperty.call(n,e)?doDiff(t[e],n[e],a.concat(e),i):i.push(buildResult(t[e],n[e],"delete",a.concat(e))):i.push(buildResult(t[e],n[e],"add",a.concat(e)))}),i}function buildResult(e,t,n,o){const r={operator:n,path:o};return"add"!==n&&(r.first={value:e,type:typeof e},!isObject(e)||void 0!==(e=Object.getPrototypeOf(e)?.constructor?.name)&&(r.first.instance=e)),"add"!==n&&"update"!==n||(r.second={value:t,type:typeof t},!isObject(t)||void 0!==(t=Object.getPrototypeOf(t)?.constructor?.name)&&(r.second.instance=t)),r}function isNotEqual(e,t){return typeof e!=typeof t||(e instanceof Date&&t instanceof Date?e.getTime()!==t.getTime():e!==t)}function getOperator(e,t){let n;var o=typeof e,r=typeof t;return"undefined"==o&&"undefined"!=r?n="add":"undefined"!=o&&"undefined"==r?n="delete":isNotEqual(e,t)&&(n="update"),n}assignToNamespace("Monster.Data",Diff);export{Monster,Diff}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{typeOf}from"../types/typeof.js";function Diff(e,t){return doDiff(e,t)}function getKeys(e,t,n){if(isArray(n)){const o=e.length>t.length?new Array(e.length):new Array(t.length);return o.fill(0),new Set(o.map((e,t)=>t))}return new Set(Object.keys(e).concat(Object.keys(t)))}function doDiff(t,n,e,o){var r=typeOf(t),s=typeOf(n);const a=e||[],i=o||[];return r!==s||"object"!==r&&"array"!==r?void 0!==(s=getOperator(t,n,r,s))&&i.push(buildResult(t,n,s,e)):getKeys(t,n,r).forEach(e=>{Object.prototype.hasOwnProperty.call(t,e)?Object.prototype.hasOwnProperty.call(n,e)?doDiff(t[e],n[e],a.concat(e),i):i.push(buildResult(t[e],n[e],"delete",a.concat(e))):i.push(buildResult(t[e],n[e],"add",a.concat(e)))}),i}function buildResult(e,t,n,o){const r={operator:n,path:o};return"add"!==n&&(r.first={value:e,type:typeof e},!isObject(e)||void 0!==(e=Object.getPrototypeOf(e)?.constructor?.name)&&(r.first.instance=e)),"add"!==n&&"update"!==n||(r.second={value:t,type:typeof t},!isObject(t)||void 0!==(t=Object.getPrototypeOf(t)?.constructor?.name)&&(r.second.instance=t)),r}function isNotEqual(e,t){return typeof e!=typeof t||(e instanceof Date&&t instanceof Date?e.getTime()!==t.getTime():e!==t)}function getOperator(e,t){let n;var o=typeof e,r=typeof t;return"undefined"==o&&"undefined"!=r?n="add":"undefined"!=o&&"undefined"==r?n="delete":isNotEqual(e,t)&&(n="update"),n}assignToNamespace("Monster.Data",Diff);export{Monster,Diff};
\ No newline at end of file
This diff is collapsed.
/** Monster 1.20.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.20.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Data";export{namespace}; "use strict";const namespace="Monster.Data";export{namespace};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment