mcf-objects/dist/mcf-objects.js

2 lines
6.9 KiB
JavaScript
Raw Normal View History

2020-03-16 23:25:54 +01:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mcfObjects=e():t.mcfObjects=e()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}n.r(e),n.d(e,"definedObject",(function(){return p}));var l=function(){function t(e){f(this,t),this.definition=e,this.validations={}}return s(t,[{key:"setValue",value:function(t){this.validate(t),this.value=t}},{key:"getValue",value:function(){return this.value}},{key:"validate",value:function(t){for(var e in this.validations)this.validations[e](t,this.definition)}}]),t}(),h=function(t){function e(t){var n;return f(this,e),(n=o(this,r(e).call(this,t))).addValidations(),n}return a(e,t),s(e,[{key:"addValidations",value:function(){for(var t in this.validations.type=function(t){if("string"!=typeof t)throw new Error("MCF_String creation: the type of ".concat(t,' isn\'t "string"'))},this.definition)switch(t){case"maxLength":this.validations.maxLength=function(t,e){if(t.length>e.maxLength)throw new Error('MCF_String creation: the length of the string "'.concat(t,'" is higher than the maximum defined: ').concat(e.maxLength))};break;case"minLength":this.validations.minLength=function(t,e){if(t.length<e.minLength)throw new Error('MCF_String creation: the length of the string "'.concat(t,'" is lower than the minimum defined: ').concat(e.minLength))}}}}]),e}(l),d=function(t){function e(t){var n;return f(this,e),(n=o(this,r(e).call(this,t))).addValidations(),n}return a(e,t),s(e,[{key:"addValidations",value:function(){for(var t in this.validations.type=function(t){if("number"!=typeof t)throw new Error("MCF_Number creation: the type of the value ".concat(t,' isn\'t "number"'))},this.definition)switch(t){case"max":this.validations.max=function(t,e){if(t>e.max)throw new Error("MCF_Number creation: the value ".concat(t," is higher than the maximum defined: ").concat(e.maxLength))};break;case"min":this.validations.min=functio
//# sourceMappingURL=mcf-objects.js.map