From 63d433b40dda14b8e9673224121726d6a5cdfef2 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Wed, 7 Feb 2018 13:28:29 +0100 Subject: [PATCH] Bumped minor version --- bin/es5/AssertJS/Assert.js | 157 +++++++++++++++++++++++++++++++++++++ bin/es5/assert-js.min.js | 2 +- package.json | 2 +- 3 files changed, 159 insertions(+), 2 deletions(-) diff --git a/bin/es5/AssertJS/Assert.js b/bin/es5/AssertJS/Assert.js index 10e93c5..a442e57 100644 --- a/bin/es5/AssertJS/Assert.js +++ b/bin/es5/AssertJS/Assert.js @@ -217,6 +217,28 @@ var Assert = function () { } } + /** + * @param {array} expectedProperties + * @param {object} objectValue + * @param {string} [message] + */ + + }, { + key: 'hasProperties', + value: function hasProperties(expectedProperties, objectValue) { + var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ""; + + this.object(objectValue); + this.containsOnlyString(expectedProperties); + this.string(message, "Custom error message passed to Assert.hasProperties needs to be a valid string."); + + expectedProperties.map(function (expectedProperty) { + if (typeof objectValue[expectedProperty] === 'undefined') { + throw InvalidValueException.expected('object to has properties "' + expectedProperties.join(', ') + '"', objectValue, message); + } + }); + } + /** * @param {array} arrayValue * @param {string} [message] @@ -400,6 +422,141 @@ var Assert = function () { } } + /** + * @param {array} arrayValue + * @param {string} [message] + */ + + }, { + key: 'containsOnlyString', + value: function containsOnlyString(arrayValue) { + var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; + + this.array(arrayValue, "Assert.containsOnlyString require valid array, got \"${received}\"."); + this.string(message, "Custom error message passed to Assert.containsOnly needs to be a valid string."); + + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = arrayValue[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var element = _step2.value; + + try { + this.string(element, message); + } catch (error) { + throw InvalidValueException.expected('string', arrayValue.map(function (value) { + return ValueConverter.toString(value); + }).join(', '), message.length ? message : "Expected array of \"${expected}\" but got \"${received}\"."); + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + } + + /** + * @param {array} arrayValue + * @param {string} [message] + */ + + }, { + key: 'containsOnlyInteger', + value: function containsOnlyInteger(arrayValue) { + var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; + + this.array(arrayValue, "Assert.containsOnlyInteger require valid array, got \"${received}\"."); + this.string(message, "Custom error message passed to Assert.containsOnly needs to be a valid string."); + + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = arrayValue[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var element = _step3.value; + + try { + this.integer(element, message); + } catch (error) { + throw InvalidValueException.expected('integer', arrayValue.map(function (value) { + return ValueConverter.toString(value); + }).join(', '), message.length ? message : "Expected array of \"${expected}\" but got \"${received}\"."); + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + } + + /** + * @param {array} arrayValue + * @param {string} [message] + */ + + }, { + key: 'containsOnlyNumber', + value: function containsOnlyNumber(arrayValue) { + var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; + + this.array(arrayValue, "Assert.containsOnlyNumber require valid array, got \"${received}\"."); + this.string(message, "Custom error message passed to Assert.containsOnly needs to be a valid string."); + + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; + + try { + for (var _iterator4 = arrayValue[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var element = _step4.value; + + try { + this.number(element, message); + } catch (error) { + throw InvalidValueException.expected('number', arrayValue.map(function (value) { + return ValueConverter.toString(value); + }).join(', '), message.length ? message : "Expected array of \"${expected}\" but got \"${received}\"."); + } + } + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4.return) { + _iterator4.return(); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } + } + } + /** * @param {int} expectedCount * @param {array} arrayValue diff --git a/bin/es5/assert-js.min.js b/bin/es5/assert-js.min.js index 55e52f4..b0dfbb5 100644 --- a/bin/es5/assert-js.min.js +++ b/bin/es5/assert-js.min.js @@ -1 +1 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1);e.exports=r,"undefined"!=typeof window&&(window.Assert=r)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(n,"Custom error message passed to Assert.instanceOf needs to be a valid string."),"object"!==("undefined"==typeof e?"undefined":o(e)))throw i.expected("object",e,n);if(!(e instanceof t))throw i.expected(t.name,e,n.length?n:'Expected instance of "${expected}" but got "${received}".')}},{key:"instanceOneOf",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.string(n,"Custom error message passed to Assert.instanceOf needs to be a valid string."),this.array(t);var r=t.find(function(t){return e instanceof t});if(void 0===r)throw i.expected(t.map(function(e){return a.toString(e)}).join(", "),e,n.length?n:'Expected instance of "${expected}" but got "${received}".')}},{key:"integer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.integer needs to be a valid string."),!Number.isInteger(e))throw i.expected("integer",e,t)}},{key:"number",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.number needs to be a valid string."),"number"!=typeof e)throw i.expected("number",e)}},{key:"string",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"!=typeof t)throw"Custom error message passed to Assert.string needs to be a valid string.";if("string"!=typeof e)throw i.expected("string",e,t)}},{key:"boolean",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.boolean needs to be a valid string."),"boolean"!=typeof e)throw i.expected("boolean",e,t)}},{key:"true",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this["boolean"](e),this.string(t,"Custom error message passed to Assert.true needs to be a valid string."),e!==!0)throw i.expected("true",e,t)}},{key:"false",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this["boolean"](e),this.string(t,"Custom error message passed to Assert.false needs to be a valid string."),e!==!1)throw i.expected("false",e,t)}},{key:"object",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.object needs to be a valid string."),"object"!==("undefined"==typeof e?"undefined":o(e)))throw i.expected("object",e,t)}},{key:"hasFunction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.object(t),this.string(n,"Custom error message passed to Assert.hasFunction needs to be a valid string."),"function"!=typeof t[e])throw i.expected('object to has function "'+e+'"',t,n)}},{key:"hasProperty",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.object(t),this.string(n,"Custom error message passed to Assert.hasProperty needs to be a valid string."),"undefined"==typeof t[e])throw i.expected('object to has property "'+e+'"',t,n)}},{key:"array",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.array needs to be a valid string."),!Array.isArray(e))throw i.expected("array",e,t)}},{key:"oneOf",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.string(n,"Custom error message passed to Assert.array needs to be a valid string."),this.array(t);var r=t.find(function(t){return e===t});if(void 0===r)throw i.expected(t.map(function(e){return a.toString(e)}).join(", "),e,n.length?n:'Expected one of "${expected}" but got "${received}".')}},{key:"isFunction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.isFunction needs to be a valid string."),"function"!=typeof e)throw i.expected("function",e,t)}},{key:"greaterThan",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(n,"Custom error message passed to Assert.greaterThan needs to be a valid string."),e>=t)throw n.length>0?n:"Expected value "+t+" to be greater than "+e}},{key:"greaterThanOrEqual",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(n,"Custom error message passed to Assert.greaterThanOrEqual needs to be a valid string."),e>t)throw n.length>0?n:"Expected value "+t+" to be greater than "+e+" or equal"}},{key:"lessThan",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(n,"Custom error message passed to Assert.lessThan needs to be a valid string."),t>=e)throw n.length>0?n:"Expected value "+t+" to be less than "+e}},{key:"lessThanOrEqual",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(n,"Custom error message passed to Assert.lessThanOrEqual needs to be a valid string."),t>e)throw n.length>0?n:"Expected value "+t+" to be less than "+e+" or equal"}},{key:"containsOnly",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.array(e,'Assert.containsOnly require valid array, got "${received}".'),this.string(n,"Custom error message passed to Assert.containsOnly needs to be a valid string.");var r=!0,o=!1,s=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var f=a.value;try{this.instanceOf(f,t,n)}catch(d){throw i.expected(t.name,f,n.length?n:'Expected instance of "${expected}" but got "${received}".')}}}catch(l){o=!0,s=l}finally{try{!r&&u["return"]&&u["return"]()}finally{if(o)throw s}}}},{key:"count",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.integer(e),this.array(t),this.string(n,"Custom error message passed to Assert.count needs to be a valid string."),t.length!==e)throw n.length?n:"Expected count "+e+", got "+t.length}},{key:"notEmpty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.empty needs to be a valid string."),0===e.length)throw i.expected("not empty value",e,t)}},{key:"oddNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.integer(e),this.string(t,"Custom error message passed to Assert.oddNumber needs to be a valid string."),e%2!==1)throw i.expected("odd number",e,t)}},{key:"evenNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.integer(e),this.string(t,"Custom error message passed to Assert.evenNumber needs to be a valid string."),e%2!==0)throw i.expected("even number",e,t)}},{key:"jsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.jsonString needs to be a valid string.");try{JSON.parse(e)}catch(n){throw i.expected("json string",e,t)}}},{key:"email",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.email needs to be a valid string.");var n=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;if(!n.test(e))throw i.expected("valid email address",e,t)}},{key:"url",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.url needs to be a valid string.");var n=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;if(!n.test(e))throw i.expected("valid url",e,t)}},{key:"uuid",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.uuid needs to be a valid string.");var n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;if(!n.test(e))throw i.expected("valid uuid",e,t)}},{key:"hasElement",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.instanceOneOf(t,[HTMLElement,HTMLDocument]),this.string(n,"Custom error message passed to Assert.hasProperty needs to be a valid string."),null===t.querySelector(e))throw i.expected("document fragment "+t+' to has element under selector "'+e+'"',null,n)}}]),e}();e.exports=u},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"";if("string"!=typeof n)throw new Error('Expected string but got "'+i.toString(n)+'".');return n.length?new Error(s.create(n,{expected:e,received:i.toString(t)})):new Error("Expected "+e+' but got "'+i.toString(t)+'".')}}]),e}();e.exports=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new Error('Expected string but got "'+ValueConverter.toString(e)+'".');if("object"!==("undefined"==typeof t?"undefined":r(t)))throw new Error('Expected string but got "'+ValueConverter.toString(t)+'".');return e.replace(s,function(e,n){return t.hasOwnProperty(n)?t[n]:e})}}]),e}();e.exports=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(r,"Custom error message passed to Assert.instanceOf needs to be a valid string."),"object"!==("undefined"==typeof e?"undefined":o(e)))throw s.expected("object",e,r);if(!(e instanceof t))throw s.expected(t.name,e,r.length?r:'Expected instance of "${expected}" but got "${received}".')}},{key:"instanceOneOf",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.string(r,"Custom error message passed to Assert.instanceOf needs to be a valid string."),this.array(t);var n=t.find(function(t){return e instanceof t});if(void 0===n)throw s.expected(t.map(function(e){return a.toString(e)}).join(", "),e,r.length?r:'Expected instance of "${expected}" but got "${received}".')}},{key:"integer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.integer needs to be a valid string."),!Number.isInteger(e))throw s.expected("integer",e,t)}},{key:"number",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.number needs to be a valid string."),"number"!=typeof e)throw s.expected("number",e)}},{key:"string",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"!=typeof t)throw"Custom error message passed to Assert.string needs to be a valid string.";if("string"!=typeof e)throw s.expected("string",e,t)}},{key:"boolean",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.boolean needs to be a valid string."),"boolean"!=typeof e)throw s.expected("boolean",e,t)}},{key:"true",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this["boolean"](e),this.string(t,"Custom error message passed to Assert.true needs to be a valid string."),e!==!0)throw s.expected("true",e,t)}},{key:"false",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this["boolean"](e),this.string(t,"Custom error message passed to Assert.false needs to be a valid string."),e!==!1)throw s.expected("false",e,t)}},{key:"object",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.object needs to be a valid string."),"object"!==("undefined"==typeof e?"undefined":o(e)))throw s.expected("object",e,t)}},{key:"hasFunction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.object(t),this.string(r,"Custom error message passed to Assert.hasFunction needs to be a valid string."),"function"!=typeof t[e])throw s.expected('object to has function "'+e+'"',t,r)}},{key:"hasProperty",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.object(t),this.string(r,"Custom error message passed to Assert.hasProperty needs to be a valid string."),"undefined"==typeof t[e])throw s.expected('object to has property "'+e+'"',t,r)}},{key:"hasProperties",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.object(t),this.containsOnlyString(e),this.string(r,"Custom error message passed to Assert.hasProperties needs to be a valid string."),e.map(function(n){if("undefined"==typeof t[n])throw s.expected('object to has properties "'+e.join(", ")+'"',t,r)})}},{key:"array",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.array needs to be a valid string."),!Array.isArray(e))throw s.expected("array",e,t)}},{key:"oneOf",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.string(r,"Custom error message passed to Assert.array needs to be a valid string."),this.array(t);var n=t.find(function(t){return e===t});if(void 0===n)throw s.expected(t.map(function(e){return a.toString(e)}).join(", "),e,r.length?r:'Expected one of "${expected}" but got "${received}".')}},{key:"isFunction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.isFunction needs to be a valid string."),"function"!=typeof e)throw s.expected("function",e,t)}},{key:"greaterThan",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(r,"Custom error message passed to Assert.greaterThan needs to be a valid string."),e>=t)throw r.length>0?r:"Expected value "+t+" to be greater than "+e}},{key:"greaterThanOrEqual",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(r,"Custom error message passed to Assert.greaterThanOrEqual needs to be a valid string."),e>t)throw r.length>0?r:"Expected value "+t+" to be greater than "+e+" or equal"}},{key:"lessThan",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(r,"Custom error message passed to Assert.lessThan needs to be a valid string."),t>=e)throw r.length>0?r:"Expected value "+t+" to be less than "+e}},{key:"lessThanOrEqual",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.number(e),this.number(t),this.string(r,"Custom error message passed to Assert.lessThanOrEqual needs to be a valid string."),t>e)throw r.length>0?r:"Expected value "+t+" to be less than "+e+" or equal"}},{key:"containsOnly",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.array(e,'Assert.containsOnly require valid array, got "${received}".'),this.string(r,"Custom error message passed to Assert.containsOnly needs to be a valid string.");var n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var f=a.value;try{this.instanceOf(f,t,r)}catch(l){throw s.expected(t.name,f,r.length?r:'Expected instance of "${expected}" but got "${received}".')}}}catch(d){o=!0,i=d}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}}},{key:"containsOnlyString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.array(e,'Assert.containsOnlyString require valid array, got "${received}".'),this.string(t,"Custom error message passed to Assert.containsOnly needs to be a valid string.");var r=!0,n=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var f=i.value;try{this.string(f,t)}catch(l){throw s.expected("string",e.map(function(e){return a.toString(e)}).join(", "),t.length?t:'Expected array of "${expected}" but got "${received}".')}}}catch(d){n=!0,o=d}finally{try{!r&&u["return"]&&u["return"]()}finally{if(n)throw o}}}},{key:"containsOnlyInteger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.array(e,'Assert.containsOnlyInteger require valid array, got "${received}".'),this.string(t,"Custom error message passed to Assert.containsOnly needs to be a valid string.");var r=!0,n=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var f=i.value;try{this.integer(f,t)}catch(l){throw s.expected("integer",e.map(function(e){return a.toString(e)}).join(", "),t.length?t:'Expected array of "${expected}" but got "${received}".')}}}catch(d){n=!0,o=d}finally{try{!r&&u["return"]&&u["return"]()}finally{if(n)throw o}}}},{key:"containsOnlyNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.array(e,'Assert.containsOnlyNumber require valid array, got "${received}".'),this.string(t,"Custom error message passed to Assert.containsOnly needs to be a valid string.");var r=!0,n=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var f=i.value;try{this.number(f,t)}catch(l){throw s.expected("number",e.map(function(e){return a.toString(e)}).join(", "),t.length?t:'Expected array of "${expected}" but got "${received}".')}}}catch(d){n=!0,o=d}finally{try{!r&&u["return"]&&u["return"]()}finally{if(n)throw o}}}},{key:"count",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.integer(e),this.array(t),this.string(r,"Custom error message passed to Assert.count needs to be a valid string."),t.length!==e)throw r.length?r:"Expected count "+e+", got "+t.length}},{key:"notEmpty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.string(t,"Custom error message passed to Assert.empty needs to be a valid string."),0===e.length)throw s.expected("not empty value",e,t)}},{key:"oddNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.integer(e),this.string(t,"Custom error message passed to Assert.oddNumber needs to be a valid string."),e%2!==1)throw s.expected("odd number",e,t)}},{key:"evenNumber",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.integer(e),this.string(t,"Custom error message passed to Assert.evenNumber needs to be a valid string."),e%2!==0)throw s.expected("even number",e,t)}},{key:"jsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.jsonString needs to be a valid string.");try{JSON.parse(e)}catch(r){throw s.expected("json string",e,t)}}},{key:"email",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.email needs to be a valid string.");var r=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;if(!r.test(e))throw s.expected("valid email address",e,t)}},{key:"url",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.url needs to be a valid string.");var r=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;if(!r.test(e))throw s.expected("valid url",e,t)}},{key:"uuid",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.string(e),this.string(t,"Custom error message passed to Assert.uuid needs to be a valid string.");var r=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;if(!r.test(e))throw s.expected("valid uuid",e,t)}},{key:"hasElement",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.string(e),this.instanceOneOf(t,[HTMLElement,HTMLDocument]),this.string(r,"Custom error message passed to Assert.hasProperty needs to be a valid string."),null===t.querySelector(e))throw s.expected("document fragment "+t+' to has element under selector "'+e+'"',null,r)}}]),e}();e.exports=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:"";if("string"!=typeof r)throw new Error('Expected string but got "'+s.toString(r)+'".');return r.length?new Error(i.create(r,{expected:e,received:s.toString(t)})):new Error("Expected "+e+' but got "'+s.toString(t)+'".')}}]),e}();e.exports=a},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw new Error('Expected string but got "'+ValueConverter.toString(e)+'".');if("object"!==("undefined"==typeof t?"undefined":n(t)))throw new Error('Expected string but got "'+ValueConverter.toString(t)+'".');return e.replace(i,function(e,r){return t.hasOwnProperty(r)?t[r]:e})}}]),e}();e.exports=s},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r