diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f76c7f3560accfa3c1332509ce8cfca5353382a..a1f7ab731a42ba3a9b1cff3eb0462bca4d6b229a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,14 +8,11 @@ cache: stages: - setup - test -sast: - stage: test - test: stage: test script: - - apt update && apt install -y jq + - apt update && apt install -y jq gawk - make test diff --git a/Makefile b/Makefile index edd5cc9826912710a4921990a1bea7ebb798dc18..8209b20df00e8ebc53760ec83c14c494e5171013 100644 --- a/Makefile +++ b/Makefile @@ -238,18 +238,26 @@ new-package: ## MONSTER CORE ############################################################################# ############################################################################################# +## Name of the subpackage; ex. dom +SUBPACKAGE = +ifneq ($(strip $(PACKAGE)),) +SUBPACKAGE=-$(PACKAGE) +endif + +MONSTER_CORE_DIR := $(THIS_DIR)packages/monster/ -MONSTER_DIR := $(THIS_DIR)packages/monster/ -MONSTER_SOURCE_DIR := $(THIS_DIR)packages/monster/source/ +MONSTER_DIR := $(THIS_DIR)packages/monster$(SUBPACKAGE)/ +MONSTER_SOURCE_DIR := $(MONSTER_DIR)source/ MONSTER_SOURCE_FILES := $(shell find $(MONSTER_SOURCE_DIR) -name '*.js') -MONSTER_DIST_DIR := $(THIS_DIR)packages/monster/dist/ -MONSTER_DIST_MODULE_DIR := $(THIS_DIR)packages/monster/dist/modules/ +MONSTER_DIST_DIR := $(MONSTER_DIR)dist/ +MONSTER_DIST_MODULE_DIR := $(MONSTER_DIST_DIR)modules/ MONSTER_DIST_MODULES_FILES := $(subst $(MONSTER_SOURCE_DIR), $(MONSTER_DIST_MODULE_DIR), $(MONSTER_SOURCE_FILES)) -MONSTER_TEST_DIR := $(THIS_DIR)packages/monster/test/ +MONSTER_TEST_DIR := $(MONSTER_DIR)test/ MONSTER_TEST_CASE_DIR := $(MONSTER_TEST_DIR)cases/ -MONSTER_FILES_WITHVERSION := $(shell grep -l -r -E "monster@[0-9]\.[0-9]\.[0-9]" $(MONSTER_SOURCE_FILES)) +MONSTER_FILES_WITHVERSION := $(shell grep -l -r -E "monster($(SUBPACKAGE))?@[0-9]\.[0-9]\.[0-9]" $(MONSTER_SOURCE_FILES)) +MONSTER_CORE_VERSION := $(shell jq -r ".version" $(MONSTER_CORE_DIR)package.json) MONSTER_VERSION := $(shell jq -r ".version" $(MONSTER_DIR)package.json) LICENSE_C_COMMENT := Monster $(MONSTER_VERSION), $(COPYRIGHT_TEXT) @@ -261,17 +269,19 @@ $(MONSTER_DIST_DIR): .PHONY: version-monster version-monster: $(MONSTER_TEST_CASE_DIR)monster.js $(MONSTER_DIR)README.md $(MONSTER_FILES_WITHVERSION) -$(MONSTER_TEST_CASE_DIR)monster.js: $(MONSTER_DIR)package.json +$(MONSTER_TEST_CASE_DIR)monster.js: $(MONSTER_DIR)package.json $(MONSTER_CORE_DIR)package.json $(ECHOMARKER) "write test/monster.js version $(MONSTER_VERSION)" $(QUIET) $(AWK) -i inplace -v start='/**#@+' -v end='/**#@-*/' -v repl=" /**#@+ dont touch, replaced by make with package.json version */\n monsterVersion = new Version('$(MONSTER_VERSION)')\n /**#@-*/" '$$1 == start{del=2} $$1 == end{$$1 = repl; del=0} !del' $(MONSTER_TEST_CASE_DIR)monster.js -$(MONSTER_DIR)README.md: $(MONSTER_DIR)package.json - $(ECHOMARKER) "write README.md monster version $(MONSTER_VERSION)" - $(QUITE) $(SED) -i -E "s/(\/monster@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_VERSION)\//gi" $(MONSTER_DIR)README.md +$(MONSTER_DIR)README.md: $(MONSTER_DIR)package.json $(MONSTER_CORE_DIR)package.json + $(ECHOMARKER) "write README.md monster version $(MONSTER_VERSION) and monster core version $(MONSTER_CORE_VERSION)" + $(QUITE) $(SED) -i -E "s/(\/monster$(SUBPACKAGE)@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_VERSION)\//gi" $(MONSTER_DIR)README.md + $(QUITE) $(SED) -i -E "s/(\/monster@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_CORE_VERSION)\//gi" $(MONSTER_DIR)README.md -$(MONSTER_FILES_WITHVERSION): $(MONSTER_DIR)package.json - $(ECHOMARKER) "write $@ monster version $(MONSTER_VERSION)" - $(QUITE) $(SED) -i -E "s/(\/monster@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_VERSION)\//gi" $@ +$(MONSTER_FILES_WITHVERSION): $(MONSTER_DIR)package.json $(MONSTER_CORE_DIR)package.json + $(ECHOMARKER) "write $@ monster version $(MONSTER_VERSION) and monster core version $(MONSTER_CORE_VERSION)" + $(QUITE) $(SED) -i -E "s/(\/monster$(SUBPACKAGE)@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_VERSION)\//gi" $@ + $(QUITE) $(SED) -i -E "s/(\/monster@)([0-9]+\.[0-9]+\.[0-9]+)\//\1$(MONSTER_CORE_VERSION)\//gi" $@ $(QUIET) $(AWK) -i inplace -v start='/**#@+' -v end='/**#@-*/' -v repl=" /**#@+ dont touch, replaced by make with package.json version */\n monsterVersion = new Version('$(MONSTER_VERSION)')\n /**#@-*/" '$$1 == start{del=2} $$1 == end{$$1 = repl; del=0} !del' $@ $(MONSTER_DIST_DIR)monster.dev.js: $(MONSTER_SOURCE_FILES) @@ -290,7 +300,7 @@ $(MONSTER_DIST_DIR)monster.js: $(MONSTER_SOURCE_FILES) $(QUIET) $(BROWSERIFY) $(MONSTER_SOURCE_DIR)monster.js -t [ babelify --presets [ @babel/preset-env ] ] | $(UGLIFYJS) -- >> $(MONSTER_DIST_DIR)monster.js .PHONY: build-monster -## create library +## create packages build-monster: version-monster $(NODE_MODULES_DIR) $(MONSTER_DIST_DIR) $(MONSTER_DIST_DIR)monster.js $(MONSTER_DIST_DIR)monster.dev.js $(MONSTER_DIST_MODULES_FILES) .PHONY: test-browser-monster @@ -319,20 +329,35 @@ npm-publish-monster: build-monster $(NPM) publish --access public ; \ $(CD) - +.PHONY: clean-monster +## clean repos +clean-monster: + $(QUITE) $(RM) --recursive $(MONSTER_DIST_DIR) ############################################################################################# +.PHONY: build +## clean +clean: + $(QUIET) $(RM) --recursive $(THIS_DIR)docs/ + make clean-monster + make clean-monster PACKAGE=dom + .PHONY: build ## create all packages -build: build-monster +build: + make build-monster + make build-monster PACKAGE=dom .PHONY: test ## test all packages -test: test-monster +test: + make test-monster + make test-monster PACKAGE=dom .PHONY: doc ## generate docs -doc: test-monster +doc: test $(ECHOMARKER) "create doc" $(QUIET) $(JSDOC) -c $(THIS_DIR)jsdoc.json $(THIS_DIR)README.md $(QUIET) $(GREP) -rl 'Documentation generated by' $(THIS_DIR)docs/ | $(XARGS) sed -i '/Documentation generated by/d' diff --git a/README.md b/README.md index a44420b690dc14cd9015d4b8d650539a4a700564..dfecd8854feb9be94796f8900a5add4e850ba6cd 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ Please make sure to read the Issue Reporting Checklist before opening an issue. ## Changelog -Detailed changes for each release are documented in the corresponding CHANGELOG file. +Detailed changes for each release are documented in the corresponding [CHANGELOG](./CHANGELOG) file. diff --git a/docs/Monster.Constraint.Valid.html b/docs/Monster.Constraint.Valid.html new file mode 100644 index 0000000000000000000000000000000000000000..2ba036a777197b5697ff05057b49684de04c953a --- /dev/null +++ b/docs/Monster.Constraint.Valid.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Valid - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster.Constraints.html">Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">Valid</h1> + + + + + + + +<section> + +<header> + + <h2> + Valid + </h2> + + <div class="class-description usertext"><p>the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing.</p> +<p>you can call the method via the monster namespace <code>new Monster.Constraint.Valid()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +new Monster.Constraint.Valid().then(()=>console.log(true)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +new Valid().then(()=>console.log(true)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Valid"><span class="type-signature"></span>new Valid<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_valid.js.html">constraint/valid.js</a>, <a href="constraint_valid.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_valid.js.html">constraint/valid.js</a>, <a href="constraint_valid.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster.Constraints.html b/docs/Monster.Constraints.html new file mode 100644 index 0000000000000000000000000000000000000000..c954bb5bd020603d03676191cf74189375f1a700 --- /dev/null +++ b/docs/Monster.Constraints.html @@ -0,0 +1,170 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Constraints - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster.Constraints.html">Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">Constraints</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="global.html#Monster">Monster</a>.</span> + + Constraints + </h2> + + +</header> + +<article> + + <div class="container-overview"> + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_namespace.js.html">constraint/namespace.js</a>, <a href="constraint_namespace.js.html#line3">line 3</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + <dt class="tag-author">Author:</dt> + <dd class="tag-author"> + <ul> + <li>schukai GmbH</li> + </ul> + </dd> + + + + + + + + + + + + + +</dl> + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster.Namespace.html b/docs/Monster.Namespace.html index 9c16cb3d056d3833a2fea85527d3f9cb9e3d6cbe..050a451a51d720ea1e889f540e5484c1325ea1ea 100644 --- a/docs/Monster.Namespace.html +++ b/docs/Monster.Namespace.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -55,9 +55,9 @@ Namespace </h2> - <div class="class-description usertext"><p>Namespace class objects form the basic framework of the namespace administration.</p> -<p>All functions, classes and objects of the library hang within the namespace tree.</p> -<p>Via <code>obj instanceof Monster.Namespace</code> it is also easy to check whether it is an object or a namespace.</p></div> + <div class="class-description usertext"><p>namespace class objects form the basic framework of the namespace administration.</p> +<p>all functions, classes and objects of the library hang within the namespace tree.</p> +<p>via <code>obj instanceof Monster.Namespace</code> it is also easy to check whether it is an object or a namespace.</p></div> </header> diff --git a/docs/Monster_Constraint.AbstractConstraint.html b/docs/Monster_Constraint.AbstractConstraint.html new file mode 100644 index 0000000000000000000000000000000000000000..c8ce124c08f256caaf9d765f92e158a97b4ed554 --- /dev/null +++ b/docs/Monster_Constraint.AbstractConstraint.html @@ -0,0 +1,364 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AbstractConstraint - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">AbstractConstraint</h1> + + + + + + + +<section> + +<header> + + <h2> + AbstractConstraint + </h2> + + <div class="class-description usertext"><p>the abstract contraint defines the api for all constraints. mainly the method isValid() is defined.</p> +<p>derived classes must implement the method isValid().</p></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AbstractConstraint"><span class="type-signature"></span>new AbstractConstraint<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_abstract.js.html">constraint/abstract.js</a>, <a href="constraint_abstract.js.html#line20">line 20</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_abstract.js.html">constraint/abstract.js</a>, <a href="constraint_abstract.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method must return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.AbstractOperator.html b/docs/Monster_Constraint.AbstractOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..0767ce7cebbf9e4d2b24da62ace6fd96de4d4d42 --- /dev/null +++ b/docs/Monster_Constraint.AbstractOperator.html @@ -0,0 +1,306 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AbstractOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">AbstractOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + AbstractOperator + </h2> + + <div class="class-description usertext"><p>Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.</p></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AbstractOperator"><span class="type-signature"></span>new AbstractOperator<span class="signature">(operantA, operantB)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_abstractoperator.js.html">constraint/abstractoperator.js</a>, <a href="constraint_abstractoperator.js.html#line16">line 16</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>operantA</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>operantB</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>"parameters must be from type AbstractConstraint"</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.AndOperator.html b/docs/Monster_Constraint.AndOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..1e244049876ea042e952eb184ee7267404927e5b --- /dev/null +++ b/docs/Monster_Constraint.AndOperator.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AndOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">AndOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + AndOperator + </h2> + + <div class="class-description usertext"><p>The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/andoperator.js'; +new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/andoperator.js'; +new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AndOperator"><span class="type-signature"></span>new AndOperator<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_andoperator.js.html">constraint/andoperator.js</a>, <a href="constraint_andoperator.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_andoperator.js.html">constraint/andoperator.js</a>, <a href="constraint_andoperator.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.Invalid.html b/docs/Monster_Constraint.Invalid.html new file mode 100644 index 0000000000000000000000000000000000000000..61832fc5958225c130b33d21322e23984f666d8d --- /dev/null +++ b/docs/Monster_Constraint.Invalid.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Invalid - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">Invalid</h1> + + + + + + + +<section> + +<header> + + <h2> + Invalid + </h2> + + <div class="class-description usertext"><p>the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing.</p> +<p>you can call the method via the monster namespace <code>new Monster.Constraint.Invalid()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/invalid.js'; +new Monster.Constraint.Invalid().catch(()=>console.log(true)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/invalid.js'; +new Invalid().catch(()=>console.log(true)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Invalid"><span class="type-signature"></span>new Invalid<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_invalid.js.html">constraint/invalid.js</a>, <a href="constraint_invalid.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_invalid.js.html">constraint/invalid.js</a>, <a href="constraint_invalid.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a rejected promise</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.IsArray.html b/docs/Monster_Constraint.IsArray.html new file mode 100644 index 0000000000000000000000000000000000000000..4ff779bce95682bb7c2b44e531d91dcac0944579 --- /dev/null +++ b/docs/Monster_Constraint.IsArray.html @@ -0,0 +1,374 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>IsArray - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">IsArray</h1> + + + + + + + +<section> + +<header> + + <h2> + IsArray + </h2> + + <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Constraint.IsObject()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isarray.js'; +console.log(new Monster.Constraint.IsArray()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isarray.js'; +console.log(new IsArray()) +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="IsArray"><span class="type-signature"></span>new IsArray<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_isarray.js.html">constraint/isarray.js</a>, <a href="constraint_isarray.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_isarray.js.html">constraint/isarray.js</a>, <a href="constraint_isarray.js.html#line43">line 43</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.IsObject.html b/docs/Monster_Constraint.IsObject.html new file mode 100644 index 0000000000000000000000000000000000000000..7a07269d2cc3ebb42a906a3853f8c2ad6f3b268a --- /dev/null +++ b/docs/Monster_Constraint.IsObject.html @@ -0,0 +1,374 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>IsObject - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">IsObject</h1> + + + + + + + +<section> + +<header> + + <h2> + IsObject + </h2> + + <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Constraint.IsObject()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isobject.js'; +console.log(new Monster.Constraint.IsObject()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isobject.js'; +console.log(new IsObject()) +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="IsObject"><span class="type-signature"></span>new IsObject<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_isobject.js.html">constraint/isobject.js</a>, <a href="constraint_isobject.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_isobject.js.html">constraint/isobject.js</a>, <a href="constraint_isobject.js.html#line43">line 43</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.Operator.html b/docs/Monster_Constraint.Operator.html new file mode 100644 index 0000000000000000000000000000000000000000..9373553b201f8256ee9dc519dd4484946e4e31fd --- /dev/null +++ b/docs/Monster_Constraint.Operator.html @@ -0,0 +1,302 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Operator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Operator.html">Operator</a></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">Operator</h1> + + + + + + + +<section> + +<header> + + <h2> + Operator + </h2> + + +</header> + +<article> + + <div class="container-overview"> + + + + + + <h4 class="name" id="Operator"><span class="type-signature"></span>new Operator<span class="signature">(operantA, operantB)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_operator.js.html">constraint/abstractoperator.js</a>, <a href="constraint_operator.js.html#line15">line 15</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>operantA</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>operantB</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>"parameters must be from type AbstractConstraint"</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.OrOperator.html b/docs/Monster_Constraint.OrOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..3070aa44cc808aae7d6b907d9be054f8f7f9733e --- /dev/null +++ b/docs/Monster_Constraint.OrOperator.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>OrOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">OrOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + OrOperator + </h2> + + <div class="class-description usertext"><p>The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; +new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; +new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="OrOperator"><span class="type-signature"></span>new OrOperator<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_oroperator.js.html">constraint/oroperator.js</a>, <a href="constraint_oroperator.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_oroperator.js.html">constraint/oroperator.js</a>, <a href="constraint_oroperator.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraint.Valid.html b/docs/Monster_Constraint.Valid.html new file mode 100644 index 0000000000000000000000000000000000000000..8ca4dd0fbf422be8f363c3f970cef372009bbbd5 --- /dev/null +++ b/docs/Monster_Constraint.Valid.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Valid - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">Valid</h1> + + + + + + + +<section> + +<header> + + <h2> + Valid + </h2> + + <div class="class-description usertext"><p>the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing.</p> +<p>you can call the method via the monster namespace <code>new Monster.Constraint.Valid()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +new Monster.Constraint.Valid().then(()=>console.log(true)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; +new Valid().then(()=>console.log(true)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Valid"><span class="type-signature"></span>new Valid<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_valid.js.html">constraint/valid.js</a>, <a href="constraint_valid.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraint_valid.js.html">constraint/valid.js</a>, <a href="constraint_valid.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.AbstractConstraint.html b/docs/Monster_Constraints.AbstractConstraint.html new file mode 100644 index 0000000000000000000000000000000000000000..c09780a77eec85a3ecb3ab5c538904097d551b0e --- /dev/null +++ b/docs/Monster_Constraints.AbstractConstraint.html @@ -0,0 +1,366 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AbstractConstraint - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">AbstractConstraint</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + AbstractConstraint + </h2> + + <div class="class-description usertext"><p>the abstract contraint defines the api for all constraints. mainly the method isValid() is defined.</p> +<p>derived classes must implement the method isValid().</p></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AbstractConstraint"><span class="type-signature"></span>new AbstractConstraint<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_abstract.js.html">constraints/abstract.js</a>, <a href="constraints_abstract.js.html#line20">line 20</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_abstract.js.html">constraints/abstract.js</a>, <a href="constraints_abstract.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method must return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.AbstractOperator.html b/docs/Monster_Constraints.AbstractOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..607de64fb8e3f986e104aa6d0364f5a09ed2fa18 --- /dev/null +++ b/docs/Monster_Constraints.AbstractOperator.html @@ -0,0 +1,308 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AbstractOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">AbstractOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + AbstractOperator + </h2> + + <div class="class-description usertext"><p>Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.</p></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AbstractOperator"><span class="type-signature"></span>new AbstractOperator<span class="signature">(operantA, operantB)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_abstractoperator.js.html">constraints/abstractoperator.js</a>, <a href="constraints_abstractoperator.js.html#line16">line 16</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>operantA</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>operantB</code></td> + + + <td class="type"> + + +<span class="param-type">AbstractConstraint</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>"parameters must be from type AbstractConstraint"</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.AndOperator.html b/docs/Monster_Constraints.AndOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..2e853f371b92d5947f5c412a2be1e3d721de082b --- /dev/null +++ b/docs/Monster_Constraints.AndOperator.html @@ -0,0 +1,377 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>AndOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">AndOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + AndOperator + </h2> + + <div class="class-description usertext"><p>The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; +new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; +import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; +new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="AndOperator"><span class="type-signature"></span>new AndOperator<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_andoperator.js.html">constraints/andoperator.js</a>, <a href="constraints_andoperator.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_andoperator.js.html">constraints/andoperator.js</a>, <a href="constraints_andoperator.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.Invalid.html b/docs/Monster_Constraints.Invalid.html new file mode 100644 index 0000000000000000000000000000000000000000..5d935c7c9765867a886b39d5b08c5e7308796396 --- /dev/null +++ b/docs/Monster_Constraints.Invalid.html @@ -0,0 +1,377 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Invalid - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">Invalid</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + Invalid + </h2> + + <div class="class-description usertext"><p>the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing.</p> +<p>you can call the method via the monster namespace <code>new Monster.Constraint.Invalid()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; +new Monster.Constraint.Invalid().catch(()=>console.log(true)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; +new Invalid().catch(()=>console.log(true)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Invalid"><span class="type-signature"></span>new Invalid<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_invalid.js.html">constraints/invalid.js</a>, <a href="constraints_invalid.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_invalid.js.html">constraints/invalid.js</a>, <a href="constraints_invalid.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a rejected promise</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.IsArray.html b/docs/Monster_Constraints.IsArray.html new file mode 100644 index 0000000000000000000000000000000000000000..74bdb33f78fe5669b073d07983f655a5e49cd376 --- /dev/null +++ b/docs/Monster_Constraints.IsArray.html @@ -0,0 +1,376 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>IsArray - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">IsArray</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + IsArray + </h2> + + <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Constraint.IsObject()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; +console.log(new Monster.Constraint.IsArray()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; +console.log(new IsArray()) +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="IsArray"><span class="type-signature"></span>new IsArray<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_isarray.js.html">constraints/isarray.js</a>, <a href="constraints_isarray.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_isarray.js.html">constraints/isarray.js</a>, <a href="constraints_isarray.js.html#line43">line 43</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.IsObject.html b/docs/Monster_Constraints.IsObject.html new file mode 100644 index 0000000000000000000000000000000000000000..9788f6a24fa92a0db7ac5bde64639948d41b701d --- /dev/null +++ b/docs/Monster_Constraints.IsObject.html @@ -0,0 +1,376 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>IsObject - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">IsObject</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + IsObject + </h2> + + <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Constraint.IsObject()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; +console.log(new Monster.Constraint.IsObject()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; +console.log(new IsObject()) +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="IsObject"><span class="type-signature"></span>new IsObject<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_isobject.js.html">constraints/isobject.js</a>, <a href="constraints_isobject.js.html#line35">line 35</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_isobject.js.html">constraints/isobject.js</a>, <a href="constraints_isobject.js.html#line43">line 43</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.OrOperator.html b/docs/Monster_Constraints.OrOperator.html new file mode 100644 index 0000000000000000000000000000000000000000..10dabe077105c9249d66578ccea4a4fd72f0db99 --- /dev/null +++ b/docs/Monster_Constraints.OrOperator.html @@ -0,0 +1,377 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>OrOperator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">OrOperator</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + OrOperator + </h2> + + <div class="class-description usertext"><p>The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; +new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; +import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; +new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="OrOperator"><span class="type-signature"></span>new OrOperator<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_oroperator.js.html">constraints/oroperator.js</a>, <a href="constraints_oroperator.js.html#line33">line 33</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_oroperator.js.html">constraints/oroperator.js</a>, <a href="constraints_oroperator.js.html#line41">line 41</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.Valid.html b/docs/Monster_Constraints.Valid.html new file mode 100644 index 0000000000000000000000000000000000000000..bae4248da42a423efd7e620d77322994e49776b5 --- /dev/null +++ b/docs/Monster_Constraints.Valid.html @@ -0,0 +1,377 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Valid - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">Valid</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Constraints.html">Monster/Constraints</a>.</span> + + Valid + </h2> + + <div class="class-description usertext"><p>the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing.</p> +<p>you can call the method via the monster namespace <code>new Monster.Constraint.Valid()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; +new Monster.Constraint.Valid().then(()=>console.log(true)); +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; +new Valid().then(()=>console.log(true)); +</script> +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Valid"><span class="type-signature"></span>new Valid<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_valid.js.html">constraints/valid.js</a>, <a href="constraints_valid.js.html#line34">line 34</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="isValid"><span class="type-signature"></span>isValid<span class="signature">(value)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_valid.js.html">constraints/valid.js</a>, <a href="constraints_valid.js.html#line42">line 42</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method return a promise containing the result of the check.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Constraints.html b/docs/Monster_Constraints.html new file mode 100644 index 0000000000000000000000000000000000000000..98942c826ea7fb6d27fd8405db4e901040920337 --- /dev/null +++ b/docs/Monster_Constraints.html @@ -0,0 +1,196 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Monster/Constraints - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">Monster/Constraints</h1> + + + + + + + +<section> + +<header> + + <h2> + Monster/Constraints + </h2> + + +</header> + +<article> + + <div class="container-overview"> + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="constraints_namespace.js.html">constraints/namespace.js</a>, <a href="constraints_namespace.js.html#line3">line 3</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + <dt class="tag-author">Author:</dt> + <dd class="tag-author"> + <ul> + <li>schukai GmbH</li> + </ul> + </dd> + + + + + + + + + + + + + +</dl> + + + + + + + + + </div> + + + + + + + + <h3 class="subsection-title">Classes</h3> + + <dl> + <dt><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.AndOperator.html">AndOperator</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.Invalid.html">Invalid</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.IsArray.html">IsArray</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.IsObject.html">IsObject</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.OrOperator.html">OrOperator</a></dt> + <dd></dd> + + <dt><a href="Monster_Constraints.Valid.html">Valid</a></dt> + <dd></dd> + </dl> + + + + + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Math.html b/docs/Monster_Math.html index c52e13c1e71b40f1e5d60305e6256a556d50b7e6..d2d757c5660f68ca47e741bdef5902f3501e2547 100644 --- a/docs/Monster_Math.html +++ b/docs/Monster_Math.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -202,13 +202,13 @@ <p>this function uses crypt and returns a random number.</p> <p>you can call the method via the monster namespace <code>Monster.Math.random()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; console.log(Monster.Math.random(1,10)) // ↦ 5 </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; +import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; console.log(random(1,10)) // ↦ 5 </script> </code></pre> diff --git a/docs/Monster_Types.ID.html b/docs/Monster_Types.ID.html index aaaa9e6051e64153103d9caf204e627454acbe16..c1eda4b5e1baa98979bb4a4caeaacff119082017 100644 --- a/docs/Monster_Types.ID.html +++ b/docs/Monster_Types.ID.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -55,16 +55,17 @@ ID </h2> - <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Types.ID()</code>.</p> + <div class="class-description usertext"><p>id class</p> +<p>you can call the method via the monster namespace <code>new Monster.Types.ID()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; console.log(new Monster.Types.ID()) console.log(new Monster.Types.ID()) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; +import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; console.log(new ID()) console.log(new ID()) </script> @@ -95,7 +96,7 @@ console.log(new ID()) <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_id.js.html">types/id.js</a>, <a href="types_id.js.html#line38">line 38</a> + <a href="types_id.js.html">types/id.js</a>, <a href="types_id.js.html#line40">line 40</a> </li></ul></dd> @@ -140,6 +141,10 @@ console.log(new ID()) +<div class="description usertext"> + <p>create new object</p> +</div> + diff --git a/docs/Monster_Types.Object.html b/docs/Monster_Types.Object.html index e06260783981057a1a68f3cd6c4df391a935028e..783308c71c98cb1a9501f1a49a6b4be7da1440d6 100644 --- a/docs/Monster_Types.Object.html +++ b/docs/Monster_Types.Object.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -58,14 +58,14 @@ <div class="class-description usertext"><p>This is the base class from which all monster classes are derived.</p> <p>you can call the method via the monster namespace <code>new Monster.Types.Object()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; console.log(new Monster.Types.Object()) console.log(new Monster.Types.Object()) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; +import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; console.log(new Object()) console.log(new Object()) </script> diff --git a/docs/Monster_Types.Observer.html b/docs/Monster_Types.Observer.html index 8c049dcfa0820b291fea62add42f26545c3282aa..751a80b01ec52ffb0399443a4e6817460608c776 100644 --- a/docs/Monster_Types.Observer.html +++ b/docs/Monster_Types.Observer.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -58,18 +58,36 @@ <div class="class-description usertext"><p>an observer manages a callback function</p> <p>you can call the method via the monster namespace <code>new Monster.Types.Observer()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; -console.log(new Monster.Types.Observer()) +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; console.log(new Monster.Types.Observer()) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; -console.log(Observer()) +import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; console.log(Observer()) </script> -</code></pre></div> +</code></pre> +<p>the update method is called with the subject object as this pointer. for this reason the callback should not +be an arrow function, because it gets the this pointer of its own context.</p> +<pre class="prettyprint source"><code><script> +Observer(()=>{ + // this is not subject +}) + +Observer(function() { + // this is subject +}) +</script> +</code></pre> +<p>additional arguments can be passed to the callback. to do this, simply specify them.</p> +<pre class="prettyprint source"><code><script> +Observer(function(a, b, c) { + console.log(a, b, c); // ↦ "a", 2, true +}, "a", 2, true) +</script> +</code></pre> +<p>the callback function must have as many parameters as arguments are given.</p></div> </header> @@ -84,7 +102,7 @@ console.log(Observer()) <h2>Constructor</h2> - <h4 class="name" id="Observer"><span class="type-signature"></span>new Observer<span class="signature">()</span><span class="type-signature"></span></h4> + <h4 class="name" id="Observer"><span class="type-signature"></span>new Observer<span class="signature">(callback, …args)</span><span class="type-signature"></span></h4> @@ -96,7 +114,7 @@ console.log(Observer()) <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line37">line 37</a> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line65">line 65</a> </li></ul></dd> @@ -151,6 +169,98 @@ console.log(Observer()) + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>callback</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>args</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + <td class="attributes"> + + + + + + <repeatable><br> + + </td> + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + @@ -187,6 +297,711 @@ console.log(Observer()) + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="addTag"><span class="type-signature"></span>addTag<span class="signature">(tag)</span><span class="type-signature"> → {Observer}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line89">line 89</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>tag</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Observer</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="getTags"><span class="type-signature"></span>getTags<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line108">line 108</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Array</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="hasTag"><span class="type-signature"></span>hasTag<span class="signature">(tag)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line117">line 117</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>tag</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="removeTag"><span class="type-signature"></span>removeTag<span class="signature">(tag)</span><span class="type-signature"> → {Observer}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line99">line 99</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>tag</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Observer</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(subject)</span><span class="type-signature"> → {Promise}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line126">line 126</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>subject</code></td> + + + <td class="type"> + + +<span class="param-type">object</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Promise</span> + + + </dd> +</dl> + + + + + + + diff --git a/docs/Monster_Types.ObserverList.html b/docs/Monster_Types.ObserverList.html index fb1ec3e5c4d6f5e2a32b860a47819151f3223313..f796f677181828b9b8f7a57e87a3f7ac686b4e30 100644 --- a/docs/Monster_Types.ObserverList.html +++ b/docs/Monster_Types.ObserverList.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -58,14 +58,14 @@ <div class="class-description usertext"><p>With the help of the ObserverList class, observer can be managed.</p> <p>you can call the method via the monster namespace <code>new Monster.Types.ObserverList()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; console.log(new Monster.Types.ObserverList()) console.log(new Monster.Types.ObserverList()) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; +import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; console.log(ObserverList()) console.log(ObserverList()) </script> diff --git a/docs/Monster_Types.ProxyObserver.html b/docs/Monster_Types.ProxyObserver.html new file mode 100644 index 0000000000000000000000000000000000000000..0d8674fabc8d6717d2b27356af3c589b8372aa02 --- /dev/null +++ b/docs/Monster_Types.ProxyObserver.html @@ -0,0 +1,1069 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>ProxyObserver - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">ProxyObserver</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Types.html">Monster/Types</a>.</span> + + ProxyObserver + </h2> + + <div class="class-description usertext"><p>an observer manages a callback function</p> +<p>you can call the method via the monster namespace <code>new Monster.Types.Observer()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; +console.log(new Monster.Types.ProxyObserver()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; +console.log(new ProxyObserver()) +</script> +</code></pre> +<p>with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place.</p> +<p>this also applies to nested objects.</p> +<pre class="prettyprint source lang-javascript"><code>const o = new Observer(function () { + if (isObject(this) && this instanceof ProxyObserver) { + // do something (this ist ProxyObserver) + const subject = this.getSubject(); + } +) + +let realSubject = { + a: { + b: { + c: true + }, + d: 5 + } + + +const p = new ProxyObserver(realSubject); +p.attachObserver(o); +const s = p.getSubject(); +s.a.b.c = false; +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="ProxyObserver"><span class="type-signature"></span>new ProxyObserver<span class="signature">(object)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line74">line 74</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>object</code></td> + + + <td class="type"> + + +<span class="param-type">object</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="attachObserver"><span class="type-signature"></span>attachObserver<span class="signature">(observer)</span><span class="type-signature"> → {ProxyObserver}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line114">line 114</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>attach a new observer</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>observer</code></td> + + + <td class="type"> + + +<span class="param-type">Observer</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">ProxyObserver</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="containsObserver"><span class="type-signature"></span>containsObserver<span class="signature">(observer)</span><span class="type-signature"> → {ProxyObserver}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line144">line 144</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>observer</code></td> + + + <td class="type"> + + +<span class="param-type">Observer</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">ProxyObserver</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="detachObserver"><span class="type-signature"></span>detachObserver<span class="signature">(observer)</span><span class="type-signature"> → {ProxyObserver}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line125">line 125</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>detach a observer</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>observer</code></td> + + + <td class="type"> + + +<span class="param-type">Observer</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">ProxyObserver</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="getRealSubject"><span class="type-signature"></span>getRealSubject<span class="signature">()</span><span class="type-signature"> → {object}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line104">line 104</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>get the proxied object</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">object</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="getSubject"><span class="type-signature"></span>getSubject<span class="signature">()</span><span class="type-signature"> → {object}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line96">line 96</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>get the real object</p> +<p>changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later.</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">object</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="notifyObservers"><span class="type-signature"></span>notifyObservers<span class="signature">()</span><span class="type-signature"> → {ProxyObserver}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line135">line 135</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>notify all observer</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">ProxyObserver</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Types.TokenList.html b/docs/Monster_Types.TokenList.html new file mode 100644 index 0000000000000000000000000000000000000000..81041aa4071bff5c41e6707e2875f9d12ee44930 --- /dev/null +++ b/docs/Monster_Types.TokenList.html @@ -0,0 +1,1887 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>TokenList - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">TokenList</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Types.html">Monster/Types</a>.</span> + + TokenList + </h2> + + <div class="class-description usertext"><p>A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string).</p> +<p>The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list.</p> +<p>you can call the method via the monster namespace <code>new Monster.Types.TokenList()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; +console.log(new Monster.Types.TokenList("myclass row")) +console.log(new Monster.Types.TokenList("myclass row")) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; +console.log(new TokenList("myclass row")) +console.log(new TokenList("myclass row")) +</script> +</code></pre> +<p>This class implements the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols">iteration protocol</a>.</p> +<pre class="prettyprint source"><code>console.log(typeof new TokenList("myclass row")[Symbol.iterator]); // "function" +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="TokenList"><span class="type-signature"></span>new TokenList<span class="signature">(init)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line48">line 48</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.2.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>init</code></td> + + + <td class="type"> + + +<span class="param-type">array</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">iteratable</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(value)</span><span class="type-signature"> → {TokenList}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line147">line 147</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>add tokens</p> +<pre class="prettyprint source"><code>new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" +new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" +new TokenList().add(undefined); // ↦ add nothing +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">array</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">iteratable</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>unsupported value</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TokenList</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"> → {TokenList}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line169">line 169</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>remove all tokens</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TokenList</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line110">line 110</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Returns true if it contains token, otherwise false</p> +<pre class="prettyprint source"><code>new TokenList("start middle end").contains('start')); // ↦ true +new TokenList("start middle end").contains('end')); // ↦ true +new TokenList("start middle end").contains('xyz')); // ↦ false +new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true +new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">array</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">iteratable</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="entries"><span class="type-signature"></span>entries<span class="signature">()</span><span class="type-signature"> → {array}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line270">line 270</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>returns an array with all tokens</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">array</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="forEach"><span class="type-signature"></span>forEach<span class="signature">(callback)</span><span class="type-signature"> → {TokenList}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line280">line 280</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>executes the provided function with each value of the set</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>callback</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TokenList</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="getIterator"><span class="type-signature"></span>getIterator<span class="signature">()</span><span class="type-signature"> → {Symbol.iterator}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line69">line 69</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Iterator protocol</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Symbol.iterator</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(value)</span><span class="type-signature"> → {TokenList}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line187">line 187</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Removes token</p> +<pre class="prettyprint source"><code>new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" +new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" +new TokenList("abc xyz").remove(undefined); // ↦ remove nothing +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">array</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">iteratable</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>unsupported value</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TokenList</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="replace"><span class="type-signature"></span>replace<span class="signature">(token, newToken)</span><span class="type-signature"> → {TokenList}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line214">line 214</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method replaces a token with a new token.</p> +<p>if the passed token exists, it is replaced with newToken and TokenList is returned. +if the token does not exist, newToken is not set and TokenList is returned.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>token</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>newToken</code></td> + + + <td class="type"> + + +<span class="param-type">string</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TokenList</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="Symbol.iterator"><span class="type-signature"></span>Symbol.iterator<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line78">line 78</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Iterator</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Object</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="toggle"><span class="type-signature"></span>toggle<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line247">line 247</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Removes token from string. If token doesn't exist it's added.</p> +<pre class="prettyprint source"><code>new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" +new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" +new TokenList().toggle(undefined); // ↦ nothing +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">array</span> +| + +<span class="param-type">string</span> +| + +<span class="param-type">iteratable</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>unsupported value</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_tokenlist.js.html">types/tokenlist.js</a>, <a href="types_tokenlist.js.html#line291">line 291</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>returns the individual tokens separated by a blank character</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">string</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Types.Version.html b/docs/Monster_Types.Version.html index 0058c85758f55d6c26ec30d4f02ebce0b687d7cb..bf3de4d20f1d3346635d5f25edd4ad564b27328f 100644 --- a/docs/Monster_Types.Version.html +++ b/docs/Monster_Types.Version.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -58,14 +58,14 @@ <div class="class-description usertext"><p>the version object contains a sematic version number</p> <p>you can create the object via the monster namespace <code>new Monster.Types.Version()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 </script> </code></pre> <p>Alternatively, you can also integrate this class individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; +import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; console.log(new Version('1.2.3')) // ↦ 1.2.3 console.log(new Version('1')) // ↦ 1.0.0 </script> diff --git a/docs/Monster_Types.html b/docs/Monster_Types.html index bae735ec2add5a4da6f5834de5762123308a2a3c..795f1c8015adaff097264ca3c897ad92b57c81fb 100644 --- a/docs/Monster_Types.html +++ b/docs/Monster_Types.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -139,6 +139,12 @@ <dt><a href="Monster_Types.ObserverList.html">ObserverList</a></dt> <dd></dd> + <dt><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a></dt> + <dd></dd> + + <dt><a href="Monster_Types.TokenList.html">TokenList</a></dt> + <dd></dd> + <dt><a href="Monster_Types.Version.html">Version</a></dt> <dd></dd> </dl> @@ -172,7 +178,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line201">line 201</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line239">line 239</a> </li></ul></dd> @@ -221,14 +227,14 @@ <p>checks whether the value passed is a array</p> <p>you can call the method via the monster namespace <code>Monster.Types.isArray()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isArray('2')) // ↦ false console.log(Monster.Types.isArray([])) // ↦ true </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isArray('2')) // ↦ false console.log(isArray([])) // ↦ true </script> @@ -346,7 +352,7 @@ console.log(isArray([])) // ↦ true <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line85">line 85</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line123">line 123</a> </li></ul></dd> @@ -395,7 +401,7 @@ console.log(isArray([])) // ↦ true <p>checks whether the value passed is a boolean</p> <p>you can call the method via the monster namespace <code>Monster.Types.isBoolean()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isBoolean('2')) // ↦ false console.log(Monster.Types.isBoolean([])) // ↦ false console.log(Monster.Types.isBoolean(true)) // ↦ true @@ -403,7 +409,7 @@ console.log(Monster.Types.isBoolean(true)) // ↦ true </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isBoolean('2')) // ↦ false console.log(isBoolean([])) // ↦ false console.log(isBoolean(2>4)) // ↦ true @@ -522,7 +528,7 @@ console.log(isBoolean(2>4)) // ↦ true <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line239">line 239</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line277">line 277</a> </li></ul></dd> @@ -571,7 +577,7 @@ console.log(isBoolean(2>4)) // ↦ true <p>checks whether the value passed is a function</p> <p>you can call the method via the monster namespace <code>Monster.Types.isFunction()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isFunction(()=>{})) // ↦ true console.log(Monster.Types.isFunction('2')) // ↦ false console.log(Monster.Types.isFunction([])) // ↦ false @@ -579,7 +585,7 @@ console.log(Monster.Types.isFunction([])) // ↦ false </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isFunction(()=>{})) // ↦ true console.log(isFunction('2')) // ↦ false console.log(isFunction([])) // ↦ false @@ -660,6 +666,182 @@ console.log(isFunction([])) // ↦ false +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id=".isIterable"><span class="type-signature">(static) </span>isIterable<span class="signature">(value)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line40">line 40</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.2.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>with this function you can check if a value is iterable</p> +<p>you can call the method via the monster namespace <code>Monster.Types.isPrimitive()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; +console.log(Monster.Types.isIterable(null)) // ↦ false +console.log(Monster.Types.isIterable('hello')) // ↦ true +console.log(Monster.Types.isIterable([])) // ↦ true +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; +console.log(isIterable(null)) // ↦ false +console.log(isIterable('hello')) // ↦ true +console.log(isIterable([])) // ↦ true +</script> +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + <h5>Returns:</h5> @@ -698,7 +880,7 @@ console.log(isFunction([])) // ↦ false <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line160">line 160</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line198">line 198</a> </li></ul></dd> @@ -747,7 +929,7 @@ console.log(isFunction([])) // ↦ false <p>checks whether the value passed is a object</p> <p>you can call the method via the monster namespace <code>Monster.Types.isObject()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isObject('2')) // ↦ false console.log(Monster.Types.isObject([])) // ↦ false console.log(Monster.Types.isObject({})) // ↦ true @@ -755,7 +937,7 @@ console.log(Monster.Types.isObject({})) // ↦ true </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isObject('2')) // ↦ false console.log(isObject([])) // ↦ false </script> @@ -873,7 +1055,7 @@ console.log(isObject([])) // ↦ false <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line38">line 38</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line76">line 76</a> </li></ul></dd> @@ -919,17 +1101,17 @@ console.log(isObject([])) // ↦ false <div class="description usertext"> - <p>checks whether the value passed is a primitive (string, number, boolean or symbol)</p> + <p>checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol)</p> <p>you can call the method via the monster namespace <code>Monster.Types.isPrimitive()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isPrimitive('2')) // ↦ false console.log(Monster.Types.isPrimitive([])) // ↦ true </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isPrimitive('2')) // ↦ true console.log(isPrimitive([])) // ↦ false </script> @@ -1047,7 +1229,7 @@ console.log(isPrimitive([])) // ↦ false <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line123">line 123</a> + <a href="types_is.js.html">types/is.js</a>, <a href="types_is.js.html#line161">line 161</a> </li></ul></dd> @@ -1096,14 +1278,14 @@ console.log(isPrimitive([])) // ↦ false <p>checks whether the value passed is a string</p> <p>you can call the method via the monster namespace <code>Monster.Types.isString()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(Monster.Types.isString('2')) // ↦ true console.log(Monster.Types.isString([])) // ↦ false </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; +import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; console.log(isString('2')) // ↦ true console.log(isString([])) // ↦ false </script> @@ -1221,7 +1403,7 @@ console.log(isString([])) // ↦ false <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line194">line 194</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line233">line 233</a> </li></ul></dd> @@ -1270,14 +1452,14 @@ console.log(isString([])) // ↦ false <p>this method checks if the type matches the array type. this function is identical to isArray() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validateArray()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validateArray('2')) // ↦ TypeError console.log(Monster.Types.validateArray([])) // ↦ undefined </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validateArray('2')) // ↦ TypeError console.log(validateArray([])) // ↦ undefined </script> @@ -1424,7 +1606,7 @@ console.log(validateArray([])) // ↦ undefined <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line82">line 82</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line121">line 121</a> </li></ul></dd> @@ -1473,7 +1655,7 @@ console.log(validateArray([])) // ↦ undefined <p>this method checks if the type matches the boolean type. this function is identical to isBoolean() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validateBoolean()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validateBoolean(true)) // ↦ undefined console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError console.log(Monster.Types.validateBoolean([])) // ↦ TypeError @@ -1481,7 +1663,7 @@ console.log(Monster.Types.validateBoolean([])) // ↦ TypeError </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validateBoolean(false)) // ↦ undefined console.log(validateBoolean('2')) // ↦ TypeError console.log(validateBoolean([])) // ↦ TypeError @@ -1629,7 +1811,7 @@ console.log(validateBoolean([])) // ↦ TypeError <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line232">line 232</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line271">line 271</a> </li></ul></dd> @@ -1678,7 +1860,7 @@ console.log(validateBoolean([])) // ↦ TypeError <p>this method checks if the type matches the function type. this function is identical to isFunction() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validateFunction()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined console.log(Monster.Types.validateFunction('2')) // ↦ TypeError console.log(Monster.Types.validateFunction([])) // ↦ TypeError @@ -1686,7 +1868,7 @@ console.log(Monster.Types.validateFunction([])) // ↦ TypeError </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validateFunction(()=>{})) // ↦ undefined console.log(validateFunction('2')) // ↦ TypeError console.log(validateFunction([])) // ↦ TypeError @@ -1822,6 +2004,220 @@ console.log(validateFunction([])) // ↦ TypeError + <h4 class="name" id=".validateIterable"><span class="type-signature">(static) </span>validateIterable<span class="signature">(value)</span><span class="type-signature"> → {undefined}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line43">line 43</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.2.0</li></ul></dd> + + + + + + + + + + + + + + + + + + <dt class="tag-copyright">Copyright:</dt> + <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> + + + + + + + + + + <dt class="tag-see">See:</dt> + <dd class="tag-see"> + <ul> + <li><code>isPrimitive</code></li> + + <li><code>Monster/Types/isPrimitive</code></li> + + <li><code>Monster/Types#isPrimitive</code></li> + </ul> + </dd> + + + +</dl> + + + + + +<div class="description usertext"> + <p>this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.</p> +<p>you can call the method via the monster namespace <code>Monster.Types.validatePrimitive()</code>.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; +console.log(Monster.Types.validateIterable('2')) // ↦ TypeError +console.log(Monster.Types.validateIterable([])) // ↦ undefined +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; +console.log(validateIterable('2')) // ↦ TypeError +console.log(validateIterable([])) // ↦ undefined +</script> +</code></pre> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc usertext"> + <p>value is not a primitive</p> + </div> + </dt> + <dd></dd> + <dt> + <dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">TypeError</span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">undefined</span> + + + </dd> +</dl> + + + + + + + + + + <h4 class="name" id=".validateObject"><span class="type-signature">(static) </span>validateObject<span class="signature">(value)</span><span class="type-signature"> → {undefined}</span></h4> @@ -1834,7 +2230,7 @@ console.log(validateFunction([])) // ↦ TypeError <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line158">line 158</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line197">line 197</a> </li></ul></dd> @@ -1883,7 +2279,7 @@ console.log(validateFunction([])) // ↦ TypeError <p>this method checks if the type matches the object type. this function is identical to isObject() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validateObject()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validateObject({})) // ↦ undefined console.log(Monster.Types.validateObject('2')) // ↦ TypeError console.log(Monster.Types.validateObject([])) // ↦ TypeError @@ -1891,7 +2287,7 @@ console.log(Monster.Types.validateObject([])) // ↦ TypeError </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validateObject({})) // ↦ undefined console.log(validateObject('2')) // ↦ TypeError console.log(validateObject([])) // ↦ TypeError @@ -2039,7 +2435,7 @@ console.log(validateObject([])) // ↦ TypeError <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line43">line 43</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line82">line 82</a> </li></ul></dd> @@ -2099,14 +2495,14 @@ console.log(validateObject([])) // ↦ TypeError <p>this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validatePrimitive()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validatePrimitive('2')) // ↦ undefined console.log(validatePrimitive([])) // ↦ TypeError </script> @@ -2253,7 +2649,7 @@ console.log(validatePrimitive([])) // ↦ TypeError <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line119">line 119</a> + <a href="types_validate.js.html">types/validate.js</a>, <a href="types_validate.js.html#line158">line 158</a> </li></ul></dd> @@ -2302,14 +2698,14 @@ console.log(validatePrimitive([])) // ↦ TypeError <p>this method checks if the type matches the string type. this function is identical to isString() except that a TypeError is thrown.</p> <p>you can call the method via the monster namespace <code>Monster.Types.validateString()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(Monster.Types.validateString('2')) // ↦ undefined console.log(Monster.Types.validateString([])) // ↦ TypeError </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; +import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; console.log(validateString('2')) // ↦ undefined console.log(validateString([])) // ↦ TypeError </script> diff --git a/docs/Monster_Util.Comparator.html b/docs/Monster_Util.Comparator.html new file mode 100644 index 0000000000000000000000000000000000000000..9f47407ee5439a9d0b19e61b45cdcd4d2410e193 --- /dev/null +++ b/docs/Monster_Util.Comparator.html @@ -0,0 +1,1276 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>Comparator - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">Comparator</h1> + + + + + + + +<section> + +<header> + + <h2> + <span class="ancestors"><a href="Monster_Util.html">Monster/Util</a>.</span> + + Comparator + </h2> + + <div class="class-description usertext"><p>the comparator allows a comparison function to be abstracted.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; +console.log(new Monster.Util.Comparator()) +console.log(new Monster.Util.Comparator()) +</script> +</code></pre> +<p>Alternatively, you can also integrate this function individually.</p> +<pre class="prettyprint source"><code><script type="module"> +import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; +console.log(new Util()) +console.log(new Util()) +</script> +</code></pre> +<p>the following are some examples of the application of the class.</p> +<pre class="prettyprint source"><code>new Comparator().lessThanOrEqual(2, 5) // ↦ true +new Comparator().greaterThan(4, 2) // ↦ true +new Comparator().equal(4, 4) // ↦ true +new Comparator().equal(4, 5) // ↦ false +</code></pre> +<p>you can also pass your own comparison function, and thus define the comparison function.</p> +<pre class="prettyprint source"><code>new Comparator(function (a, b) { + if (a.v === b.v) return 0; + return a.v < b.v ? -1 : 1; + }).equal({v: 2}, {v: 2}); // ↦ true +</code></pre></div> + + +</header> + +<article> + + <div class="container-overview"> + + + + + <h2>Constructor</h2> + + + <h4 class="name" id="Comparator"><span class="type-signature"></span>new Comparator<span class="signature">(callback)</span><span class="type-signature"></span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line52">line 52</a> + </li></ul></dd> + + + + + + <dt class="tag-since">Since:</dt> + <dd class="tag-since"><ul class="dummy"><li>1.3.0</li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>create new comparator</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>callback</code></td> + + + <td class="type"> + + +<span class="param-type">function</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + + + + + + </div> + + + + + + + + + + + + + + + + + + <h3 class="subsection-title">Methods</h3> + + + + + + + <h4 class="name" id="equal"><span class="type-signature"></span>equal<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line104">line 104</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Checks if two variables are equal.</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>a</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>b</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="greaterThan"><span class="type-signature"></span>greaterThan<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line117">line 117</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Checks if variable <code>a</code> is greater than <code>b</code></p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>a</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>b</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="greaterThanOrEqual"><span class="type-signature"></span>greaterThanOrEqual<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line129">line 129</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Checks if variable <code>a</code> is greater than or equal to <code>b</code></p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>a</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>b</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="lessThan"><span class="type-signature"></span>lessThan<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line153">line 153</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Checks if variable a is less than b</p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>a</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>b</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="lessThanOrEqual"><span class="type-signature"></span>lessThanOrEqual<span class="signature">(a, b)</span><span class="type-signature"> → {boolean}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line141">line 141</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>Checks if variable <code>a</code> is less than or equal to <code>b</code></p> +</div> + + + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>a</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + + <tr> + + <td class="name"><code>b</code></td> + + + <td class="type"> + + +<span class="param-type">*</span> + + + + </td> + + + + + + <td class="description last"></td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">boolean</span> + + + </dd> +</dl> + + + + + + + + + + + <h4 class="name" id="reverse"><span class="type-signature"></span>reverse<span class="signature">()</span><span class="type-signature"> → {Comparator}</span></h4> + + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="util_comparator.js.html">util/comparator.js</a>, <a href="util_comparator.js.html#line90">line 90</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>changes the order of the operators</p> +</div> + + + + + + + + + + + + + + + + + + + + + + + + + +<h5>Returns:</h5> + + + + +<dl class="param-type"> + <dt> + Type + </dt> + <dd> + +<span class="param-type">Comparator</span> + + + </dd> +</dl> + + + + + + + + + + + +</article> + +</section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> \ No newline at end of file diff --git a/docs/Monster_Util.html b/docs/Monster_Util.html index cc654c0545e29b52296fe6b14b7eef35a3ff25d6..69b1cad26acdd82e2e9f067bdcee52f08b5ab0ff 100644 --- a/docs/Monster_Util.html +++ b/docs/Monster_Util.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -124,6 +124,13 @@ + <h3 class="subsection-title">Classes</h3> + + <dl> + <dt><a href="Monster_Util.Comparator.html">Comparator</a></dt> + <dd></dd> + </dl> + @@ -206,13 +213,13 @@ Global objects such as windows are also not cloned,</p> <p>If an object has a method <code>getClone()</code>, this method is used to create the clone.</p> <p>you can call the method via the monster namespace <code>Monster.Util.clone()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; console.log(Monster.Util.clone({})) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; +import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; console.log(clone({})) </script> </code></pre> @@ -407,13 +414,13 @@ console.log(clone({})) <p>deep freeze a object</p> <p>you can call the method via the monster namespace <code>Monster.Util.deepFreeze()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; console.log(Monster.Util.deepFreeze({})) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; +import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; console.log(deepFreeze({})) </script> </code></pre> diff --git a/docs/constraint_abstract.js.html b/docs/constraint_abstract.js.html new file mode 100644 index 0000000000000000000000000000000000000000..aa1409c4958fc5085282aadb142f89f8393d06e9 --- /dev/null +++ b/docs/constraint_abstract.js.html @@ -0,0 +1,117 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/abstract.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/abstract.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import '../types/object.js'; + + +/** + * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined. + * + * derived classes must implement the method isValid(). + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class AbstractConstraint extends Object { + + /** + * + */ + constructor() { + super(); + } + + /** + * this method must return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } +} + +Monster.assignToNamespace('Monster.Constraint', AbstractConstraint); +export {Monster, AbstractConstraint}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_abstractoperator.js.html b/docs/constraint_abstractoperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..4caee75b67469a18cc50457b476be9045c0be43d --- /dev/null +++ b/docs/constraint_abstractoperator.js.html @@ -0,0 +1,116 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/abstractoperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/abstractoperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together. + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class AbstractOperator extends AbstractConstraint { + + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" + */ + constructor(operantA, operantB) { + super(); + + if (!(operantA instanceof AbstractConstraint) || !(operantB instanceof AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint") + } + + this.operantA = operantA; + this.operantB = operantB; + + } + + +} + +Monster.assignToNamespace('Monster.Constraint', AbstractOperator); +export {Monster, AbstractOperator}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_andoperator.js.html b/docs/constraint_andoperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..48d79f76d76d725c06de6cfda25c4f0acede567c --- /dev/null +++ b/docs/constraint_andoperator.js.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/andoperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/andoperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {AbstractOperator} from "./abstractoperator.js"; + +/** + * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/andoperator.js'; + * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/andoperator.js'; + * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class AndOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]); + } + +} + +Monster.assignToNamespace('Monster.Constraint', AndOperator); +export {Monster, AndOperator}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_invalid.js.html b/docs/constraint_invalid.js.html new file mode 100644 index 0000000000000000000000000000000000000000..dfd2475ea850f4e791cf94ffcdfcae8a5e2b2180 --- /dev/null +++ b/docs/constraint_invalid.js.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/invalid.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/invalid.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/invalid.js'; + * new Monster.Constraint.Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/invalid.js'; + * new Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class Invalid extends AbstractConstraint { + + /** + * this method return a rejected promise + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraint', Invalid); +export {Monster, Invalid}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_isarray.js.html b/docs/constraint_isarray.js.html new file mode 100644 index 0000000000000000000000000000000000000000..5c2f860cf300f1044774118cad339e4d3e8f0869 --- /dev/null +++ b/docs/constraint_isarray.js.html @@ -0,0 +1,130 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/isarray.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/isarray.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isArray} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isarray.js'; + * console.log(new Monster.Constraint.IsArray()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isarray.js'; + * console.log(new IsArray()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class IsArray extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if(isArray(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraint', IsArray); +export {Monster, IsArray}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_isobject.js.html b/docs/constraint_isobject.js.html new file mode 100644 index 0000000000000000000000000000000000000000..1b1a3778531862d1378a7f027e74a368f62e3f78 --- /dev/null +++ b/docs/constraint_isobject.js.html @@ -0,0 +1,130 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/isobject.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/isobject.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isObject} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isobject.js'; + * console.log(new Monster.Constraint.IsObject()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/isobject.js'; + * console.log(new IsObject()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class IsObject extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if (isObject(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraint', IsObject); +export {Monster, IsObject}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_namespace.js.html b/docs/constraint_namespace.js.html new file mode 100644 index 0000000000000000000000000000000000000000..d609a7512c0a94e9a38ba9e34a3cf1249e74d199 --- /dev/null +++ b/docs/constraint_namespace.js.html @@ -0,0 +1,83 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/namespace.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/namespace.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @namespace Monster/Constraints + + * @author schukai GmbH + */</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_operator.js.html b/docs/constraint_operator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..66bc773be0a9a0e16b9755ec270f7e8a24a0c3fd --- /dev/null +++ b/docs/constraint_operator.js.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/abstractoperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Operator.html">Operator</a></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/abstractoperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class Operator extends AbstractConstraint { + + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" + */ + constructor(operantA, operantB) { + super(); + + if (!(operantA instanceof AbstractConstraint) || !(operantB instanceof AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint") + } + + this.operantA = operantA; + this.operantB = operantB; + + } + + +} + +Monster.assignToNamespace('Monster.Constraint', Operator); +export {Monster, Operator}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_oroperator.js.html b/docs/constraint_oroperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..31f615d131a10a063f29b4fe8ac842388879e055 --- /dev/null +++ b/docs/constraint_oroperator.js.html @@ -0,0 +1,152 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/oroperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/oroperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {AbstractOperator} from "./abstractoperator.js"; + +/** + * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; + * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; + * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class OrOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + 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; + /** b has already been evaluated and was not true */ + if (b === false) { + reject(); + } + }); + + self.operantB.isValid(value) + .then(function () { + resolve(); + }).catch(function () { + b = false; + /** b has already been evaluated and was not true */ + if (a === false) { + reject(); + } + }); + }); + } + + +} + +Monster.assignToNamespace('Monster.Constraint', OrOperator); +export {Monster, OrOperator}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraint_valid.js.html b/docs/constraint_valid.js.html new file mode 100644 index 0000000000000000000000000000000000000000..116cbf30504ec73d10ea59f325f0ca7b6976ff2c --- /dev/null +++ b/docs/constraint_valid.js.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraint/valid.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraint.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraint.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraint.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraint.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> +</nav> + +<div id="main"> + + <h1 class="page-title">constraint/valid.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Valid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * new Monster.Constraint.Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * new Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraint + */ +class Valid extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.resolve(value); + } + +} + +Monster.assignToNamespace('Monster.Constraint', Valid); +export {Monster, Valid}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_abstract.js.html b/docs/constraints_abstract.js.html new file mode 100644 index 0000000000000000000000000000000000000000..15c9c0be9ad8d2b7d8575f983b3d6d6bdbec9d1b --- /dev/null +++ b/docs/constraints_abstract.js.html @@ -0,0 +1,117 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/abstract.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/abstract.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; + + +/** + * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined. + * + * derived classes must implement the method isValid(). + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AbstractConstraint extends Object { + + /** + * + */ + constructor() { + super(); + } + + /** + * this method must return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } +} + +Monster.assignToNamespace('Monster.Constraints', AbstractConstraint); +export {Monster, AbstractConstraint}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_abstractoperator.js.html b/docs/constraints_abstractoperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..2a887356e6b8549d38a98c78b0a2a0c9410ed477 --- /dev/null +++ b/docs/constraints_abstractoperator.js.html @@ -0,0 +1,116 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/abstractoperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/abstractoperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together. + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AbstractOperator extends AbstractConstraint { + + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" + */ + constructor(operantA, operantB) { + super(); + + if (!(operantA instanceof AbstractConstraint) || !(operantB instanceof AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint") + } + + this.operantA = operantA; + this.operantB = operantB; + + } + + +} + +Monster.assignToNamespace('Monster.Constraints', AbstractOperator); +export {Monster, AbstractOperator}</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_andoperator.js.html b/docs/constraints_andoperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..04a1e087da165d248c2f57d0257b240a82df88b1 --- /dev/null +++ b/docs/constraints_andoperator.js.html @@ -0,0 +1,126 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/andoperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/andoperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {AbstractOperator} from "./abstractoperator.js"; + +/** + * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AndOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]); + } + +} + +Monster.assignToNamespace('Monster.Constraints', AndOperator); +export {Monster, AndOperator} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_invalid.js.html b/docs/constraints_invalid.js.html new file mode 100644 index 0000000000000000000000000000000000000000..42909b5985a7398aeb142b489d1ee00a78861a20 --- /dev/null +++ b/docs/constraints_invalid.js.html @@ -0,0 +1,126 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/invalid.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/invalid.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Monster.Constraint.Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class Invalid extends AbstractConstraint { + + /** + * this method return a rejected promise + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', Invalid); +export {Monster, Invalid} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_isarray.js.html b/docs/constraints_isarray.js.html new file mode 100644 index 0000000000000000000000000000000000000000..d023a521f5ea63f85734e642b98f9dde38730e2f --- /dev/null +++ b/docs/constraints_isarray.js.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/isarray.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/isarray.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isArray} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new Monster.Constraint.IsArray()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new IsArray()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class IsArray extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if(isArray(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', IsArray); +export {Monster, IsArray} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_isobject.js.html b/docs/constraints_isobject.js.html new file mode 100644 index 0000000000000000000000000000000000000000..6ecd82959b8fa51a71cd552cf30164ebd9385e5e --- /dev/null +++ b/docs/constraints_isobject.js.html @@ -0,0 +1,131 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/isobject.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/isobject.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isObject} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new Monster.Constraint.IsObject()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new IsObject()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class IsObject extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if (isObject(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', IsObject); +export {Monster, IsObject} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_namespace.js.html b/docs/constraints_namespace.js.html new file mode 100644 index 0000000000000000000000000000000000000000..fb3b3b7f4f7ff741e2b800a2b83ea8aa74815c29 --- /dev/null +++ b/docs/constraints_namespace.js.html @@ -0,0 +1,82 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/namespace.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/namespace.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @namespace Monster/Constraints + * @author schukai GmbH + */</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_oroperator.js.html b/docs/constraints_oroperator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..955f81d6664c2a6a0b456f2753a71e9e019ea1b4 --- /dev/null +++ b/docs/constraints_oroperator.js.html @@ -0,0 +1,152 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/oroperator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/oroperator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractOperator} from "./abstractoperator.js"; + +/** + * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class OrOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + 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; + /** b has already been evaluated and was not true */ + if (b === false) { + reject(); + } + }); + + self.operantB.isValid(value) + .then(function () { + resolve(); + }).catch(function () { + b = false; + /** b has already been evaluated and was not true */ + if (a === false) { + reject(); + } + }); + }); + } + + +} + +Monster.assignToNamespace('Monster.Constraints', OrOperator); +export {Monster, OrOperator} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/constraints_valid.js.html b/docs/constraints_valid.js.html new file mode 100644 index 0000000000000000000000000000000000000000..8123b4217f6021b451c5fefda792f009c8e825a3 --- /dev/null +++ b/docs/constraints_valid.js.html @@ -0,0 +1,126 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>constraints/valid.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">constraints/valid.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Valid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Monster.Constraint.Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class Valid extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.resolve(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', Valid); +export {Monster, Valid} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/global.html b/docs/global.html index 85b9448b7b4d036dc71fd21603adbe8cb8bf70f2..ddd0b21053dc6fc71160ad1178d2ea1d1f40aec6 100644 --- a/docs/global.html +++ b/docs/global.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -192,6 +192,79 @@ + +<h4 class="name" id="proxySet"><span class="type-signature"></span>proxySet<span class="type-signature"> :WeakSet.<object></span></h4> + + + + + +<dl class="details"> + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="types_proxyobserver.js.html">types/proxyobserver.js</a>, <a href="types_proxyobserver.js.html#line19">line 19</a> + </li></ul></dd> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + +<div class="description usertext"> + <p>store proxy objects</p> +</div> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type">WeakSet.<object></span> + + + </li> + </ul> + + + + + + + diff --git a/docs/global.html#Monster b/docs/global.html#Monster index b036522471d31464df25d0cf789535911f308fab..ded3d8ed81f1ead1131cbbb3b76bc8c3432084dd 100644 --- a/docs/global.html#Monster +++ b/docs/global.html#Monster @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -204,7 +204,7 @@ <p>you must call the method in the monster namespace. this allows you to mount your own classes, objects and functions into the namespace.</p> <p>To avoid confusion and so that you do not accidentally overwrite existing functions, you should use the custom namespace <code>X</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/namespace.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/namespace.js'; function hello() { console.log('Hello World!'); } @@ -397,14 +397,14 @@ Monster.X.hello(); // ↦ Hello World! <p>Version of monster</p> <p>you can call the method via the monster namespace <code>Monster.getVersion()</code>.</p> <pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; +import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; console.log(Monster.getVersion()) console.log(Monster.getVersion()) </script> </code></pre> <p>Alternatively, you can also integrate this function individually.</p> <pre class="prettyprint source"><code><script type="module"> -import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; +import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; console.log(getVersion()) console.log(getVersion()) </script> diff --git a/docs/index.html b/docs/index.html index 9b5d280371d6bf6a94f1c68f014d9312149f0efa..ea7f4b54002b945d6fd91263bb60a475cc086b22 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> diff --git a/docs/math_namespace.js.html b/docs/math_namespace.js.html index f4d0fe7d8a881fd7ba98b9fd92b29c2cf4d9b628..300c33a07767d35d05a00629353827a3d51a8e8f 100644 --- a/docs/math_namespace.js.html +++ b/docs/math_namespace.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> diff --git a/docs/math_random.js.html b/docs/math_random.js.html index cbdb057298e5c204f298943fd88c75b50f638a20..dac846d66abdfc71bb989171a3a8240234b473b0 100644 --- a/docs/math_random.js.html +++ b/docs/math_random.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -63,7 +63,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; * console.log(Monster.Math.random(1,10)) // ↦ 5 * </script> * ``` @@ -72,7 +72,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; + * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; * console.log(random(1,10)) // ↦ 5 * </script> * ``` diff --git a/docs/module-Monster.ID.html b/docs/module-Monster.ID.html deleted file mode 100644 index e8ee09154cb5a4f3a56ba255d931765f0ceb2846..0000000000000000000000000000000000000000 --- a/docs/module-Monster.ID.html +++ /dev/null @@ -1,220 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>ID - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">ID</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - ID - </h2> - - <div class="class-description usertext"><p>you can call the method via the monster namespace <code>new Monster.Types.ID()</code>.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/id.js'; -console.log(new Monster.Types.ID()) -console.log(new Monster.Types.ID()) -</script> -</code></pre> -<p>Alternatively, you can also integrate this function individually.</p> -<pre class="prettyprint source"><code><script type="module"> -import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/id.js'; -console.log(new ID()) -console.log(new ID()) -</script> -</code></pre></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="ID"><span class="type-signature"></span>new ID<span class="signature">()</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_id.js.html">types/id.js</a>, <a href="types_id.js.html#line39">line 39</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.Monster_Types.html b/docs/module-Monster.Monster_Types.html deleted file mode 100644 index e52db04a273b7bdf1485e8927ee1679acf24214f..0000000000000000000000000000000000000000 --- a/docs/module-Monster.Monster_Types.html +++ /dev/null @@ -1,170 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Monster/Types - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Monster/Types</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - Monster/Types - </h2> - - -</header> - -<article> - - <div class="container-overview"> - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_namespace.js.html">types/namespace.js</a>, <a href="types_namespace.js.html#line3">line 3</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - <dt class="tag-author">Author:</dt> - <dd class="tag-author"> - <ul> - <li>schukai GmbH</li> - </ul> - </dd> - - - - - - - - - - - - - -</dl> - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.Namespace.html b/docs/module-Monster.Namespace.html deleted file mode 100644 index 956a4b1c29b644767f13d304b45742a8960a35de..0000000000000000000000000000000000000000 --- a/docs/module-Monster.Namespace.html +++ /dev/null @@ -1,477 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Namespace - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Namespace</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - Namespace - </h2> - - <div class="class-description usertext"><p>Namespace class objects form the basic framework of the namespace administration.</p> -<p>All functions, classes and objects of the library hang within the namespace tree.</p> -<p>Via <code>obj instanceof Monster.Namespace</code> it is also easy to check whether it is an object or a namespace.</p></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="Namespace"><span class="type-signature"></span>new Namespace<span class="signature">(namespace, obj)</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="namespace.js.html">namespace.js</a>, <a href="namespace.js.html#line21">line 21</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - <h5>Parameters:</h5> - - -<table class="params"> - <thead> - <tr> - - <th>Name</th> - - - <th>Type</th> - - - - - - <th class="last">Description</th> - </tr> - </thead> - - <tbody> - - - <tr> - - <td class="name"><code>namespace</code></td> - - - <td class="type"> - - </td> - - - - - - <td class="description last"></td> - </tr> - - - - <tr> - - <td class="name"><code>obj</code></td> - - - <td class="type"> - - </td> - - - - - - <td class="description last"></td> - </tr> - - - </tbody> -</table> - - - - - - - - - - - - - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - <h3 class="subsection-title">Methods</h3> - - - - - - - <h4 class="name" id="getNamespace"><span class="type-signature"></span>getNamespace<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="namespace.js.html">namespace.js</a>, <a href="namespace.js.html#line39">line 39</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<h5>Returns:</h5> - - - - -<dl class="param-type"> - <dt> - Type - </dt> - <dd> - -<span class="param-type">string</span> - - - </dd> -</dl> - - - - - - - - - - - <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="namespace.js.html">namespace.js</a>, <a href="namespace.js.html#line47">line 47</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<h5>Returns:</h5> - - - - -<dl class="param-type"> - <dt> - Type - </dt> - <dd> - -<span class="param-type">string</span> - - - </dd> -</dl> - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.Object.html b/docs/module-Monster.Object.html deleted file mode 100644 index fcb441e8950973048f3a8dea2d9964c157398e64..0000000000000000000000000000000000000000 --- a/docs/module-Monster.Object.html +++ /dev/null @@ -1,326 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Object - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Object</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - Object - </h2> - - <div class="class-description usertext"><p>This is the base class from which all monster classes are derived.</p> -<p>you can call the method via the monster namespace <code>new Monster.Types.Object()</code>.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/object.js'; -console.log(new Monster.Types.Object()) -console.log(new Monster.Types.Object()) -</script> -</code></pre> -<p>Alternatively, you can also integrate this function individually.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/object.js'; -console.log(new Object()) -console.log(new Object()) -</script> -</code></pre></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="Object"><span class="type-signature"></span>new Object<span class="signature">()</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_object.js.html">types/object.js</a>, <a href="types_object.js.html#line38">line 38</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - <h3 class="subsection-title">Methods</h3> - - - - - - - <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_object.js.html">types/object.js</a>, <a href="types_object.js.html#line50">line 50</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<h5>Returns:</h5> - - - - -<dl class="param-type"> - <dt> - Type - </dt> - <dd> - -<span class="param-type">string</span> - - - </dd> -</dl> - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.Observer.html b/docs/module-Monster.Observer.html deleted file mode 100644 index ffe5dcbf9384f538f78dec8e808d2d093eb057f3..0000000000000000000000000000000000000000 --- a/docs/module-Monster.Observer.html +++ /dev/null @@ -1,221 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Observer - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Observer</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - Observer - </h2> - - <div class="class-description usertext"><p>an observer manages a callback function</p> -<p>you can call the method via the monster namespace <code>new Monster.Types.Observer()</code>.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observer.js'; -console.log(new Monster.Types.Observer()) -console.log(new Monster.Types.Observer()) -</script> -</code></pre> -<p>Alternatively, you can also integrate this function individually.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observer.js'; -console.log(Observer()) -console.log(Observer()) -</script> -</code></pre></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="Observer"><span class="type-signature"></span>new Observer<span class="signature">()</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_observer.js.html">types/observer.js</a>, <a href="types_observer.js.html#line38">line 38</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.ObserverList.html b/docs/module-Monster.ObserverList.html deleted file mode 100644 index 98ce8e3fdfabdde05d85e13ef336f9eddbe42d82..0000000000000000000000000000000000000000 --- a/docs/module-Monster.ObserverList.html +++ /dev/null @@ -1,221 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>ObserverList - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">ObserverList</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - ObserverList - </h2> - - <div class="class-description usertext"><p>With the help of the ObserverList class, observer can be managed.</p> -<p>you can call the method via the monster namespace <code>new Monster.Types.ObserverList()</code>.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observerlist.js'; -console.log(new Monster.Types.ObserverList()) -console.log(new Monster.Types.ObserverList()) -</script> -</code></pre> -<p>Alternatively, you can also integrate this function individually.</p> -<pre class="prettyprint source"><code><script type="module"> -import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observerlist.js'; -console.log(ObserverList()) -console.log(ObserverList()) -</script> -</code></pre></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="ObserverList"><span class="type-signature"></span>new ObserverList<span class="signature">()</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_observerlist.js.html">types/observerlist.js</a>, <a href="types_observerlist.js.html#line38">line 38</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div> - - - - - - - - - - - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.Version.html b/docs/module-Monster.Version.html deleted file mode 100644 index d895a1c66287f1216757c0ccb3ae23bdc2312ab7..0000000000000000000000000000000000000000 --- a/docs/module-Monster.Version.html +++ /dev/null @@ -1,609 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Version - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.html#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.deepFreeze">deepFreeze</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.getVersion">getVersion</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.random">random</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="module-Monster.html#.validateString">validateString</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="module-Monster.Monster_Types.html">Monster/Types</a></li><li><a href="global.html#Monster">Monster</a></li><li><a href="Monster_Math.html">Monster/Math</a></li><li><a href="Monster_Util.html">Monster/Util</a></li></ul><h3>Classes</h3><ul><li><a href="module-Monster.ID.html">ID</a></li><li><a href="module-Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Object.html#toString">toString</a></li></ul></li><li><a href="module-Monster.Observer.html">Observer</a></li><li><a href="module-Monster.ObserverList.html">ObserverList</a></li><li><a href="module-Monster.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="module-Monster.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Version</h1> - - - - - - - -<section> - -<header> - - <h2> - <span class="ancestors"><a href="module-Monster.html">Monster</a>.</span> - - Version - </h2> - - <div class="class-description usertext"><p>the version object contains a sematic version number</p> -<p>you can create the object via the monster namespace <code>new Monster.Types.Version()</code>.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; -console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 -console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 -</script> -</code></pre> -<p>Alternatively, you can also integrate this class individually.</p> -<pre class="prettyprint source"><code><script type="module"> -import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; -console.log(new Version('1.2.3')) // ↦ 1.2.3 -console.log(new Version('1')) // ↦ 1.0.0 -</script> -</code></pre> -<p>some examples</p> -<pre class="prettyprint source"><code>new Monster.Types.Version('1.0.0') // 1.0.0 -new Monster.Types.Version(1) // 1.0.0 -new Monster.Types.Version(1, 0, 0) // 1.0.0 -new Monster.Types.Version('1.2.3', 4, 5) // 1.4.5 -</code></pre></div> - - -</header> - -<article> - - <div class="container-overview"> - - - - - <h2>Constructor</h2> - - - <h4 class="name" id="Version"><span class="type-signature"></span>new Version<span class="signature">(major, minor, patch)</span><span class="type-signature"></span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_version.js.html">types/version.js</a>, <a href="types_version.js.html#line44">line 44</a> - </li></ul></dd> - - - - - - <dt class="tag-since">Since:</dt> - <dd class="tag-since"><ul class="dummy"><li>1.0.0</li></ul></dd> - - - - - - - - - - - - - - - - <dt class="tag-author">Author:</dt> - <dd class="tag-author"> - <ul> - <li>schukai GmbH</li> - </ul> - </dd> - - - - <dt class="tag-copyright">Copyright:</dt> - <dd class="tag-copyright"><ul class="dummy"><li>schukai GmbH</li></ul></dd> - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - <h5>Parameters:</h5> - - -<table class="params"> - <thead> - <tr> - - <th>Name</th> - - - <th>Type</th> - - - - - - <th class="last">Description</th> - </tr> - </thead> - - <tbody> - - - <tr> - - <td class="name"><code>major</code></td> - - - <td class="type"> - - </td> - - - - - - <td class="description last"></td> - </tr> - - - - <tr> - - <td class="name"><code>minor</code></td> - - - <td class="type"> - - </td> - - - - - - <td class="description last"></td> - </tr> - - - - <tr> - - <td class="name"><code>patch</code></td> - - - <td class="type"> - - </td> - - - - - - <td class="description last"></td> - </tr> - - - </tbody> -</table> - - - - - - - - - - - - - - -<h5>Throws:</h5> -<ul> - <li> - - <div class="param-desc usertext"> - - <p>major is not a number</p> - - </div> - -</li> - - <li> - - <div class="param-desc usertext"> - - <p>minor is not a number</p> - - </div> - -</li> - - <li> - - <div class="param-desc usertext"> - - <p>patch is not a number</p> - - </div> - -</li> - </ul> - - - - - - - </div> - - - - - - - - - - - - - - - - - - <h3 class="subsection-title">Methods</h3> - - - - - - - <h4 class="name" id="compareTo"><span class="type-signature"></span>compareTo<span class="signature">(version)</span><span class="type-signature"> → {number}</span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_version.js.html">types/version.js</a>, <a href="types_version.js.html#line111">line 111</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</dl> - - - - - -<div class="description usertext"> - <p>returns 0 if equal, -1 if the object version is less and 1 if greater -then the compared version</p> -</div> - - - - - - - - - - - - <h5>Parameters:</h5> - - -<table class="params"> - <thead> - <tr> - - <th>Name</th> - - - <th>Type</th> - - - - - - <th class="last">Description</th> - </tr> - </thead> - - <tbody> - - - <tr> - - <td class="name"><code>version</code></td> - - - <td class="type"> - - -<span class="param-type">string</span> -| - -<span class="param-type">Version</span> - - - - </td> - - - - - - <td class="description last"><p>Version to compare</p></td> - </tr> - - - </tbody> -</table> - - - - - - - - - - - - - - - - -<h5>Returns:</h5> - - - - -<dl class="param-type"> - <dt> - Type - </dt> - <dd> - -<span class="param-type">number</span> - - - </dd> -</dl> - - - - - - - - - - - <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> - - - - - - -<dl class="details"> - - - <dt class="tag-source">Source:</dt> - <dd class="tag-source"><ul class="dummy"><li> - <a href="types_version.js.html">types/version.js</a>, <a href="types_version.js.html#line100">line 100</a> - </li></ul></dd> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</dl> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<h5>Returns:</h5> - - - - -<dl class="param-type"> - <dt> - Type - </dt> - <dd> - -<span class="param-type">string</span> - - - </dd> -</dl> - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module-Monster.html b/docs/module-Monster.html deleted file mode 100644 index 14651b554571fe3f8e634ffaab7333c4a83d832b..0000000000000000000000000000000000000000 --- a/docs/module-Monster.html +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>Monster - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a></li></ul><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">Monster</h1> - - - - - - - -<section> - -<header> - - - -</header> - -<article> - - <div class="container-overview"> - - - - - - </div> - - - - - - - - - - - - - - - - - - - - - -</article> - -</section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> \ No newline at end of file diff --git a/docs/module.js.html b/docs/module.js.html deleted file mode 100644 index 8e4843489848accee06e8de83a2630a23a70d6f1..0000000000000000000000000000000000000000 --- a/docs/module.js.html +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - - <meta charset="utf-8"> - <title>module.js - awaken the monster in you; javascript library by schukai GmbH</title> - - <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> - - - - <script src="scripts/prettify/prettify.js"></script> - <script src="scripts/prettify/lang-css.js"></script> - <!--[if lt IE 9]> - <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - <link type="text/css" rel="stylesheet" href="styles/prettify.css"> - <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> - <script src="scripts/nav.js" defer></script> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> -</head> -<body> - -<input type="checkbox" id="nav-trigger" class="nav-trigger" /> -<label for="nav-trigger" class="navicon-button x"> - <div class="navicon"></div> -</label> - -<label for="nav-trigger" class="overlay"></label> - -<nav > - - <input type="text" id="nav-search" placeholder="Search" /> - - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Modules</h3><ul><li><a href="module-Monster.html">Monster</a></li></ul><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> -</nav> - -<div id="main"> - - <h1 class="page-title">module.js</h1> - - - - - - - - <section> - <article> - <pre class="prettyprint source linenums"><code>'use strict'; - -/** - * @module Monster - * @author schukai GmbH - */</code></pre> - </article> - </section> - - - - - - -</div> - -<br class="clear"> - -<footer> -</footer> - -<script>prettyPrint();</script> -<script src="scripts/polyfill.js"></script> -<script src="scripts/linenumber.js"></script> - -<script src="scripts/search.js" defer></script> - - -<script src="scripts/collapse.js" defer></script> - - -</body> -</html> diff --git a/docs/namespace.js.html b/docs/namespace.js.html index 2520e8f650cf7bcbbf12b263bcf1488059ecbc01..496cbeb06e0b8d5e0a6bbe5100441e8cf3cd08e9 100644 --- a/docs/namespace.js.html +++ b/docs/namespace.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -56,11 +56,11 @@ /** - * Namespace class objects form the basic framework of the namespace administration. + * namespace class objects form the basic framework of the namespace administration. * - * All functions, classes and objects of the library hang within the namespace tree. + * all functions, classes and objects of the library hang within the namespace tree. * - * Via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. + * via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. * * @memberOf Monster @@ -120,7 +120,7 @@ assignToNamespace('Monster', assignToNamespace); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/namespace.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/namespace.js'; * function hello() { * console.log('Hello World!'); * } diff --git a/docs/types_id.js.html b/docs/types_id.js.html index 49e71b942b09fbb39731adcd0def123754c22b08..461703b69c9216773cfd7f347d11fde7738fde53 100644 --- a/docs/types_id.js.html +++ b/docs/types_id.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -54,17 +54,19 @@ */ import {Monster} from '../namespace.js'; +import {random} from '../math/random.js'; import '../types/object.js'; let internalCounter = 0; /** + * id class * * you can call the method via the monster namespace `new Monster.Types.ID()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; * console.log(new Monster.Types.ID()) * console.log(new Monster.Types.ID()) * </script> @@ -74,7 +76,7 @@ let internalCounter = 0; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; * console.log(new ID()) * console.log(new ID()) * </script> @@ -86,12 +88,15 @@ let internalCounter = 0; */ class ID extends Monster.Types.Object { + /** + * create new object + */ constructor() { super(); internalCounter += 1; - this.id = global.btoa(Monster.Math.random(1, 10000)) + this.id = global.btoa(random(1, 10000)) .replace(/=/g, '') /** No numbers at the beginning of the ID, because of possible problems with DOM */ .replace(/^[0-9]+/, 'X') + internalCounter; diff --git a/docs/types_is.js.html b/docs/types_is.js.html index cd765c3018864da732ebc36795b8529ef0e35d97..0706e3eb706a36df54c835b4b1278c7097a233d9 100644 --- a/docs/types_is.js.html +++ b/docs/types_is.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -56,13 +56,51 @@ import {Monster} from '../namespace.js'; /** - * checks whether the value passed is a primitive (string, number, boolean or symbol) + * with this function you can check if a value is iterable * * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isIterable(null)) // ↦ false + * console.log(Monster.Types.isIterable('hello')) // ↦ true + * console.log(Monster.Types.isIterable([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isIterable(null)) // ↦ false + * console.log(isIterable('hello')) // ↦ true + * console.log(isIterable([])) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +function isIterable(value) { + if (value === undefined) return false; + if (value === null) return false; + return typeof value?.[Symbol.iterator] === 'function'; +} + + +/** + * checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol) + * + * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isPrimitive('2')) // ↦ false * console.log(Monster.Types.isPrimitive([])) // ↦ true * </script> @@ -72,12 +110,12 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isPrimitive('2')) // ↦ true * console.log(isPrimitive([])) // ↦ false * </script> * ``` - * + * * @param {*} value * @returns {boolean} * @since 1.0.0 @@ -87,7 +125,7 @@ import {Monster} from '../namespace.js'; function isPrimitive(value) { var type; - if (value === undefined || value === null) { + if (value === undefined || value === null || value === NaN) { return true; } @@ -107,7 +145,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isBoolean('2')) // ↦ false * console.log(Monster.Types.isBoolean([])) // ↦ false * console.log(Monster.Types.isBoolean(true)) // ↦ true @@ -118,7 +156,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isBoolean('2')) // ↦ false * console.log(isBoolean([])) // ↦ false * console.log(isBoolean(2>4)) // ↦ true @@ -142,22 +180,22 @@ function isBoolean(value) { /** * checks whether the value passed is a string - * + * * you can call the method via the monster namespace `Monster.Types.isString()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isString('2')) // ↦ true * console.log(Monster.Types.isString([])) // ↦ false * </script> * ``` - * + * * Alternatively, you can also integrate this function individually. - * + * * ``` * <script type="module"> - * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isString('2')) // ↦ true * console.log(isString([])) // ↦ false * </script> @@ -183,7 +221,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isObject('2')) // ↦ false * console.log(Monster.Types.isObject([])) // ↦ false * console.log(Monster.Types.isObject({})) // ↦ true @@ -194,7 +232,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isObject('2')) // ↦ false * console.log(isObject([])) // ↦ false * </script> @@ -225,7 +263,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isArray('2')) // ↦ false * console.log(Monster.Types.isArray([])) // ↦ true * </script> @@ -235,7 +273,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isArray('2')) // ↦ false * console.log(isArray([])) // ↦ true * </script> @@ -261,7 +299,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isFunction(()=>{})) // ↦ true * console.log(Monster.Types.isFunction('2')) // ↦ false * console.log(Monster.Types.isFunction([])) // ↦ false @@ -272,7 +310,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isFunction(()=>{})) // ↦ true * console.log(isFunction('2')) // ↦ false * console.log(isFunction([])) // ↦ false @@ -297,8 +335,8 @@ function isFunction(value) { } -Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction); -export {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction} +Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable); +export {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable} </code></pre> </article> </section> diff --git a/docs/types_namespace.js.html b/docs/types_namespace.js.html index ec7831206d38d9d1dbd9f804465a726f65bd39cb..b38ae2d745eb8be309f4057d1c475f9fbf996449 100644 --- a/docs/types_namespace.js.html +++ b/docs/types_namespace.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> diff --git a/docs/types_object.js.html b/docs/types_object.js.html index 97170eb76821aa8de2d45e4c7ff5d3d6d50bdfeb..244d551b56a8033a1464a9a85799a589a8bfc365 100644 --- a/docs/types_object.js.html +++ b/docs/types_object.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -63,7 +63,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; * console.log(new Monster.Types.Object()) * console.log(new Monster.Types.Object()) * </script> @@ -73,7 +73,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; + * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; * console.log(new Object()) * console.log(new Object()) * </script> diff --git a/docs/types_observer.js.html b/docs/types_observer.js.html index b04d24a81fa3da1fccca4387387c4e09670deb53..c6f7b8841faa19e0bc696c4ae3bcec4603b4682f 100644 --- a/docs/types_observer.js.html +++ b/docs/types_observer.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -54,6 +54,8 @@ */ import {Monster} from '../namespace.js'; +import {TokenList} from '../types/tokenlist.js'; +import {isObject} from '../types/is.js'; import '../types/object.js'; /** @@ -63,8 +65,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(new Monster.Types.Observer()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; * console.log(new Monster.Types.Observer()) * </script> * ``` @@ -73,18 +74,50 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(Observer()) + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; * console.log(Observer()) * </script> * ``` * + * the update method is called with the subject object as this pointer. for this reason the callback should not + * be an arrow function, because it gets the this pointer of its own context. + * + * ``` + * <script> + * Observer(()=>{ + * // this is not subject + * }) + * + * Observer(function() { + * // this is subject + * }) + * </script> + * ``` + * + * additional arguments can be passed to the callback. to do this, simply specify them. + * + * ``` + * <script> + * Observer(function(a, b, c) { + * console.log(a, b, c); // ↦ "a", 2, true + * }, "a", 2, true) + * </script> + * ``` + * + * the callback function must have as many parameters as arguments are given. + * + * * @since 1.0.0 * @copyright schukai GmbH * @memberOf Monster/Types */ class Observer extends Monster.Types.Object { + /** + * + * @param {function} callback + * @param {*} args + */ constructor(callback, ...args) { super(); @@ -94,32 +127,56 @@ class Observer extends Monster.Types.Object { this.callback = callback; this.arguments = args; - this.tags = new Set; + this.tags = new TokenList; } + /** + * + * @param {string} tag + * @returns {Observer} + */ addTag(tag) { this.tags.add(tag); return this; } + /** + * + * @param {string} tag + * @returns {Observer} + */ removeTag(tag) { - this.tags.delete(tag); + this.tags.remove(tag); return this; } + /** + * + * @returns {Array} + */ getTags() { - return this.tags + return this.tags.entries() } + /** + * + * @param {string} tag + * @returns {boolean} + */ hasTag(tag) { - return this.tags.has(tag) + return this.tags.contains(tag) } + /** + * + * @param {object} subject + * @returns {Promise} + */ update(subject) { let self = this; return new Promise(function (resolve, reject) { - if (!(subject instanceof Object)) { + if (!isObject(subject)) { reject("subject must be an object"); } let result = self.callback.apply(subject, self.arguments); diff --git a/docs/types_observerlist.js.html b/docs/types_observerlist.js.html index a7fc8d79d487c197de917d7ab6a73b045bf38a5f..10f1fbf0ee091d356e6d74733879ee68fb187e57 100644 --- a/docs/types_observerlist.js.html +++ b/docs/types_observerlist.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -63,7 +63,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; * console.log(new Monster.Types.ObserverList()) * console.log(new Monster.Types.ObserverList()) * </script> @@ -73,7 +73,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; + * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; * console.log(ObserverList()) * console.log(ObserverList()) * </script> diff --git a/docs/types_proxyobserver.js.html b/docs/types_proxyobserver.js.html new file mode 100644 index 0000000000000000000000000000000000000000..6c1ddb3d4d16c243db75526969bbe885354bb1dc --- /dev/null +++ b/docs/types_proxyobserver.js.html @@ -0,0 +1,297 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>types/proxyobserver.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">types/proxyobserver.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; +import {validateObject} from "./validate.js"; +import {ObserverList} from "./observerlist.js"; +import {Observer} from "./observer.js"; +import {isObject, isArray} from "./is.js"; + +/** + * store proxy objects + * + * @type {WeakSet<object>} + */ +var proxySet = new WeakSet(); + +// language=JavaScript +/** + * an observer manages a callback function + * + * you can call the method via the monster namespace `new Monster.Types.Observer()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new Monster.Types.ProxyObserver()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new ProxyObserver()) + * </script> + * ``` + * + * with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. + * + * this also applies to nested objects. + * + * ```javascript + * const o = new Observer(function () { + * if (isObject(this) && this instanceof ProxyObserver) { + * // do something (this ist ProxyObserver) + * const subject = this.getSubject(); + * } + * ) + * + * let realSubject = { + * a: { + * b: { + * c: true + * }, + * d: 5 + * } + * + * + * const p = new ProxyObserver(realSubject); + * p.attachObserver(o); + * const s = p.getSubject(); + * s.a.b.c = false; + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +class ProxyObserver extends Object { + + /** + * + * @param {object} object + */ + constructor(object) { + super(); + validateObject(object); + this.realSubject = object + this.subject = new Proxy(object, getHandler.call(this)); + proxySet.add(this.subject); + this.observers = new ObserverList; + } + + /** + * get the real object + * + * changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later. + * + * @returns {object} + */ + getSubject() { + return this.subject + } + + /** + * get the proxied object + * + * @returns {object} + */ getRealSubject() { + return this.realSubject + } + + /** + * attach a new observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + attachObserver(observer) { + this.observers.attach(observer) + return this; + } + + /** + * detach a observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + detachObserver(observer) { + this.observers.detach(observer) + return this; + } + + /** + * notify all observer + * + * @returns {ProxyObserver} + */ + notifyObservers() { + this.observers.notify(this); + return this; + } + + /** + * @param {Observer} observer + * @returns {ProxyObserver} + */ + containsObserver(observer) { + return this.observers.contains(observer) + } + +} + +Monster.assignToNamespace('Monster.Types', ProxyObserver); +export {Monster, ProxyObserver} + +/** + * + * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}} + * @private + * @see {@link https://gitlab.schukai.com/-/snippets/49} + */ +function getHandler() { + + const proxy = this; + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots + const handler = { + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + get: function (target, property, receiver) { + const prop = target?.[property]; + + // return if property not found + if (prop === undefined) { + return undefined; + } + + // set value as proxy if object or array + if (isArray(prop) || isObject(prop) && !proxySet.has(prop)) { + target[property] = new Proxy(prop, handler); + proxySet.add(prop); + } + + return target[property]; + + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + set: function (target, property, value, receiver) { + target[property] = value + proxy.observers.notify(proxy); + return true; + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + deleteProperty: function (target, property) { + if (property in target) { + delete target[property]; + proxy.observers.notify(proxy); + return true; + } + return false; + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + defineProperty: function (target, property, descriptor) { + let result = Reflect.defineProperty(target, property, descriptor); + proxy.observers.notify(proxy); + return parseURLToResultingURLRecord(); + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v + setPrototypeOf: function (target, prototype) { + let result = Reflect.setPrototypeOf(object1, prototype); + proxy.observers.notify(proxy); + return result; + } + + }; + + + return handler; +} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/types_tokenlist.js.html b/docs/types_tokenlist.js.html new file mode 100644 index 0000000000000000000000000000000000000000..801687c015b72005d12a69c48be90269eaf6917f --- /dev/null +++ b/docs/types_tokenlist.js.html @@ -0,0 +1,393 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>types/tokenlist.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">types/tokenlist.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; +import {isString, isIterable} from '../types/is.js'; +import {validateString, validateFunction} from '../types/validate.js'; + +/** + * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). + * + * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. + * + * you can call the method via the monster namespace `new Monster.Types.TokenList()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new Monster.Types.TokenList("myclass row")) + * console.log(new Monster.Types.TokenList("myclass row")) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new TokenList("myclass row")) + * console.log(new TokenList("myclass row")) + * </script> + * ``` + * + * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * + * ``` + * console.log(typeof new TokenList("myclass row")[Symbol.iterator]); // "function" + * ``` + * + * + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +class TokenList extends Object { + + /** + * + * @param {array|string|iteratable} init + */ + constructor(init) { + super(); + this.tokens = new Set(); + + if (typeof init !== "undefined") { + this.add(init); + } + + } + + /** + * Iterator protocol + * + * @returns {Symbol.iterator} + */ + getIterator() { + return this[Symbol.iterator](); + } + + /** + * Iterator + * + * @returns {{next: ((function(): ({value: *, done: boolean}))|*)}} + */ + [Symbol.iterator]() { + // Use a new index for each iterator. This makes multiple + // iterations over the iterable safe for non-trivial cases, + // such as use of break or nested looping over the same iterable. + let index = 0; + let entries = this.entries() + + return { + next: () => { + if (index < entries.length) { + return {value: entries?.[index++], done: false} + } else { + return {done: true} + } + } + } + } + + /** + * Returns true if it contains token, otherwise false + * + * ``` + * new TokenList("start middle end").contains('start')); // ↦ true + * new TokenList("start middle end").contains('end')); // ↦ true + * new TokenList("start middle end").contains('xyz')); // ↦ false + * new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true + * new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + */ + contains(value) { + if (isString(value)) { + value = value.trim() + let counter = 0; + value.split(" ").forEach(token => { + if (this.tokens.has(token.trim()) === false) return false; + counter++ + }) + return counter > 0 ? true : false; + } + + if (isIterable(value)) { + let counter = 0; + for (let token of value) { + validateString(token); + if (this.tokens.has(token.trim()) === false) return false; + counter++ + } + return counter > 0 ? true : false; + } + + return false; + } + + /** + * add tokens + * + * ``` + * new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" + * new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" + * new TokenList().add(undefined); // ↦ add nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + add(value) { + if (isString(value)) { + value.split(" ").forEach(token => { + this.tokens.add(token.trim()); + }) + } else if (isIterable(value)) { + for (let token of value) { + validateString(token); + this.tokens.add(token.trim()); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + + /** + * remove all tokens + * + * @returns {TokenList} + */ + clear() { + this.tokens.clear(); + return this; + } + + /** + * Removes token + * + * ``` + * new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(undefined); // ↦ remove nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + remove(value) { + if (isString(value)) { + value.split(" ").forEach(token => { + this.tokens.delete(token.trim()); + }) + } else if (isIterable(value)) { + for (let token of value) { + validateString(token); + this.tokens.delete(token.trim()); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + + /** + * this method replaces a token with a new token. + * + * if the passed token exists, it is replaced with newToken and TokenList is returned. + * if the token does not exist, newToken is not set and TokenList is returned. + * + * @param {string} token + * @param {string} newToken + * @returns {TokenList} + */ + replace(token, newToken) { + validateString(token); + validateString(newToken); + if (!this.contains(token)) { + return this; + } + + let a = Array.from(this.tokens) + let i = a.indexOf(token); + if (i === -1) return this; + + a.splice(i, 1, newToken); + this.tokens = new Set(); + this.add(a); + + return this; + + + } + + /** + * Removes token from string. If token doesn't exist it's added. + * + * ``` + * new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" + * new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" + * new TokenList().toggle(undefined); // ↦ nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + * @throws {TypeError} unsupported value + */ + toggle(value) { + + if (isString(value)) { + value.split(" ").forEach(token => { + toggleValue.call(this, token); + }) + } else if (isIterable(value)) { + for (let token of value) { + toggleValue.call(this, token); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + + } + + /** + * returns an array with all tokens + * + * @returns {array} + */ + entries() { + return Array.from(this.tokens) + } + + /** + * executes the provided function with each value of the set + * + * @param {function} callback + * @returns {TokenList} + */ + forEach(callback) { + validateFunction(callback); + this.tokens.forEach(callback); + return this; + } + + /** + * returns the individual tokens separated by a blank character + * + * @returns {string} + */ + toString() { + return this.entries().join(' '); + } + +} + +/** + * @private + * @param token + * @returns {toggleValue} + * @throws {Error} must be called with TokenList.call + */ +function toggleValue(token) { + if (!(this instanceof TokenList)) throw Error("must be called with TokenList.call") + validateString(token); + token = token.trim(); + if (this.contains(token)) { + this.remove(token); + return this; + } + this.add(token); + return this; +} + +Monster.assignToNamespace('Monster.Types', TokenList); +export {Monster, TokenList} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/types_validate.js.html b/docs/types_validate.js.html index 3bee5c2abed73ac9954c618fbca6fe16d0d7192e..c67ae847332a75a2905cd6541b26da8d91fb4feb 100644 --- a/docs/types_validate.js.html +++ b/docs/types_validate.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -54,7 +54,7 @@ */ import {Monster} from '../namespace.js'; -import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '../types/is.js'; +import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable} from '../types/is.js'; /** * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. @@ -63,7 +63,46 @@ import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError + * console.log(Monster.Types.validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(validateIterable('2')) // ↦ TypeError + * console.log(validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * @param {*} value + * @return {undefined} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + * @throws {TypeError} value is not a primitive + * @see {@link isPrimitive} + * @see {@link Monster/Types/isPrimitive} + * @see {@link Monster/Types#isPrimitive} + */ +function validateIterable(value) { + if (!isIterable(value)) { + throw new TypeError('value is not iterable') + } +} + +/** + * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. + * + * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError * </script> @@ -73,7 +112,7 @@ import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '. * * ``` * <script type="module"> - * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validatePrimitive('2')) // ↦ undefined * console.log(validatePrimitive([])) // ↦ TypeError * </script> @@ -102,7 +141,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError @@ -113,7 +152,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateBoolean(false)) // ↦ undefined * console.log(validateBoolean('2')) // ↦ TypeError * console.log(validateBoolean([])) // ↦ TypeError @@ -141,7 +180,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateString('2')) // ↦ undefined * console.log(Monster.Types.validateString([])) // ↦ TypeError * </script> @@ -151,7 +190,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateString('2')) // ↦ undefined * console.log(validateString([])) // ↦ TypeError * </script> @@ -179,7 +218,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateObject({})) // ↦ undefined * console.log(Monster.Types.validateObject('2')) // ↦ TypeError * console.log(Monster.Types.validateObject([])) // ↦ TypeError @@ -190,7 +229,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateObject({})) // ↦ undefined * console.log(validateObject('2')) // ↦ TypeError * console.log(validateObject([])) // ↦ TypeError @@ -217,7 +256,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateArray('2')) // ↦ TypeError * console.log(Monster.Types.validateArray([])) // ↦ undefined * </script> @@ -227,7 +266,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateArray('2')) // ↦ TypeError * console.log(validateArray([])) // ↦ undefined * </script> @@ -253,7 +292,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError * console.log(Monster.Types.validateFunction([])) // ↦ TypeError @@ -264,7 +303,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateFunction(()=>{})) // ↦ undefined * console.log(validateFunction('2')) // ↦ TypeError * console.log(validateFunction([])) // ↦ TypeError @@ -284,8 +323,17 @@ function validateFunction(value) { } } -Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction); -export {Monster, validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction} +Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable); +export { + Monster, + validatePrimitive, + validateBoolean, + validateString, + validateObject, + validateArray, + validateFunction, + validateIterable +} </code></pre> </article> </section> diff --git a/docs/types_version.js.html b/docs/types_version.js.html index d1a12e8750a8974eaadbf51a3f85778540347732..b6671db26b6105f1f8f698cf0d3f9763d627c003 100644 --- a/docs/types_version.js.html +++ b/docs/types_version.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -59,7 +59,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 * </script> @@ -69,7 +69,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Version('1.2.3')) // ↦ 1.2.3 * console.log(new Version('1')) // ↦ 1.0.0 * </script> @@ -199,7 +199,7 @@ let monsterVersion; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(Monster.getVersion()) * console.log(Monster.getVersion()) * </script> @@ -209,7 +209,7 @@ let monsterVersion; * * ``` * <script type="module"> - * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(getVersion()) * console.log(getVersion()) * </script> @@ -226,7 +226,7 @@ function getVersion() { return monsterVersion; } /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.1.0') + monsterVersion = new Version('1.3.0') /**#@-*/ return monsterVersion; diff --git a/docs/util_clone.js.html b/docs/util_clone.js.html index c94f37479f8428c0052bce6cf84dfa509245df22..bf2caf49e2c3244662f775201318470f6e4e3b4c 100644 --- a/docs/util_clone.js.html +++ b/docs/util_clone.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -70,7 +70,7 @@ import {isObject, isFunction, isPrimitive, isArray} from '../types/is.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(Monster.Util.clone({})) * </script> * ``` @@ -79,7 +79,7 @@ import {isObject, isFunction, isPrimitive, isArray} from '../types/is.js'; * * ``` * <script type="module"> - * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(clone({})) * </script> * ``` diff --git a/docs/util_comparator.js.html b/docs/util_comparator.js.html new file mode 100644 index 0000000000000000000000000000000000000000..cd72a9e07ccbabd5fa21fdf7ea8cae2d8cfe8a35 --- /dev/null +++ b/docs/util_comparator.js.html @@ -0,0 +1,238 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <meta charset="utf-8"> + <title>util/comparator.js - awaken the monster in you; javascript library by schukai GmbH</title> + + <meta name="description" content="javascript library for optimal use on fast and flexible pages." /> + + + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> + <script src="scripts/nav.js" defer></script> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav > + + <input type="text" id="nav-search" placeholder="Search" /> + + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> +</nav> + +<div id="main"> + + <h1 class="page-title">util/comparator.js</h1> + + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, Object} from '../types/object.js'; +import {isFunction} from '../types/is.js'; + +/** + * the comparator allows a comparison function to be abstracted. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Monster.Util.Comparator()) + * console.log(new Monster.Util.Comparator()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Util()) + * console.log(new Util()) + * </script> + * ``` + * + * the following are some examples of the application of the class. + * + * ``` + * new Comparator().lessThanOrEqual(2, 5) // ↦ true + * new Comparator().greaterThan(4, 2) // ↦ true + * new Comparator().equal(4, 4) // ↦ true + * new Comparator().equal(4, 5) // ↦ false + * ``` + * + * you can also pass your own comparison function, and thus define the comparison function. + * + * ``` + * new Comparator(function (a, b) { + * if (a.v === b.v) return 0; + * return a.v < b.v ? -1 : 1; + * }).equal({v: 2}, {v: 2}); // ↦ true + * ``` + * + * @since 1.3.0 + * @memberOf Monster/Util + */ +class Comparator extends Object { + + /** + * create new comparator + * + * @param {function} callback + * @throw {TypeError} "unsupported type" + * @throw {TypeError} "impractical comparison" + */ + constructor(callback) { + super(); + + if (isFunction(callback)) { + this.compare = callback + } else if (callback !== undefined) { + throw new TypeError("unsupported type") + } else { + // default compare function + this.compare = function (a, b) { + + if (typeof a !== typeof b) { + throw new TypeError("impractical comparison") + } + + if (a === b) { + return 0; + } + return a < b ? -1 : 1; + }; + } + + } + + /** + * changes the order of the operators + * + * @return {Comparator} + */ + reverse() { + const original = this.compare; + this.compare = (a, b) => original(b, a); + return this; + } + + /** + * Checks if two variables are equal. + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + equal(a, b) { + return this.compare(a, b) === 0; + } + + + /** + * Checks if variable `a` is greater than `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + greaterThan(a, b) { + return this.compare(a, b) > 0; + } + + /** + * Checks if variable `a` is greater than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + greaterThanOrEqual(a, b) { + return this.greaterThan(a, b) || this.equal(a, b); + } + + /** + * Checks if variable `a` is less than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + lessThanOrEqual(a, b) { + return this.lessThan(a, b) || this.equal(a, b); + } + + /** + * Checks if variable a is less than b + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + lessThan(a, b) { + return this.compare(a, b) < 0; + } + + +} + +Monster.assignToNamespace('Monster.Util', Comparator); +export {Monster, Comparator} +</code></pre> + </article> + </section> + + + + + + +</div> + +<br class="clear"> + +<footer> +</footer> + +<script>prettyPrint();</script> +<script src="scripts/polyfill.js"></script> +<script src="scripts/linenumber.js"></script> + +<script src="scripts/search.js" defer></script> + + +<script src="scripts/collapse.js" defer></script> + + +</body> +</html> diff --git a/docs/util_freeze.js.html b/docs/util_freeze.js.html index 424a3ad5f41082089b8b876dfbffdad211b17cab..9001f62dee2503f8b109774a9fcced0df7b828fa 100644 --- a/docs/util_freeze.js.html +++ b/docs/util_freeze.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> @@ -63,7 +63,7 @@ import {validateObject} from '../types/validate.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(Monster.Util.deepFreeze({})) * </script> * ``` @@ -72,7 +72,7 @@ import {validateObject} from '../types/validate.js'; * * ``` * <script type="module"> - * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(deepFreeze({})) * </script> * ``` diff --git a/docs/util_namespace.js.html b/docs/util_namespace.js.html index b8f891e8d75efda3b1f2f1b87bd0727af4179e11..7acfbfa98129f558831587d2e909b5eb480d6865 100644 --- a/docs/util_namespace.js.html +++ b/docs/util_namespace.js.html @@ -32,7 +32,7 @@ <input type="text" id="nav-search" placeholder="Search" /> - <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3> + <h2><a href="index.html">Home</a></h2><h2><a href="https://www.schukai.com/" target="_blank" class="menu-item" id="schukai_link" >schukai GmbH</a></h2><h2><a href="https://www.npmjs.com/package/@schukai/monster" target="_blank" class="menu-item" id="npm_link" >NPM</a></h2><h3>Namespaces</h3><ul><li><a href="global.html#Monster">Monster</a><ul class='methods'><li data-type='method' style='display: none;'><a href="global.html#Monster#.assignToNamespace">assignToNamespace</a></li><li data-type='method' style='display: none;'><a href="global.html#Monster#.getVersion">getVersion</a></li></ul></li><li><a href="Monster_Constraints.html">Monster/Constraints</a></li><li><a href="Monster_Math.html">Monster/Math</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Math.html#.random">random</a></li></ul></li><li><a href="Monster_Types.html">Monster/Types</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isArray">isArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isBoolean">isBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isFunction">isFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isIterable">isIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isObject">isObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isPrimitive">isPrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.isString">isString</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateArray">validateArray</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateBoolean">validateBoolean</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateFunction">validateFunction</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateIterable">validateIterable</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateObject">validateObject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validatePrimitive">validatePrimitive</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.html#.validateString">validateString</a></li></ul></li><li><a href="Monster_Util.html">Monster/Util</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.html#.clone">clone</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.html#.deepFreeze">deepFreeze</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="Monster.Namespace.html">Namespace</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#getNamespace">getNamespace</a></li><li data-type='method' style='display: none;'><a href="Monster.Namespace.html#toString">toString</a></li></ul></li><li><a href="Monster_Constraints.AbstractConstraint.html">AbstractConstraint</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AbstractConstraint.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.AbstractOperator.html">AbstractOperator</a></li><li><a href="Monster_Constraints.AndOperator.html">AndOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.AndOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Invalid.html">Invalid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Invalid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsArray.html">IsArray</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsArray.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.IsObject.html">IsObject</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.IsObject.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.OrOperator.html">OrOperator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.OrOperator.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Constraints.Valid.html">Valid</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Constraints.Valid.html#isValid">isValid</a></li></ul></li><li><a href="Monster_Types.ID.html">ID</a></li><li><a href="Monster_Types.Object.html">Object</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Object.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Observer.html">Observer</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#addTag">addTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#getTags">getTags</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#hasTag">hasTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#removeTag">removeTag</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Observer.html#update">update</a></li></ul></li><li><a href="Monster_Types.ObserverList.html">ObserverList</a></li><li><a href="Monster_Types.ProxyObserver.html">ProxyObserver</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#attachObserver">attachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#containsObserver">containsObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#detachObserver">detachObserver</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getRealSubject">getRealSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#getSubject">getSubject</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.ProxyObserver.html#notifyObservers">notifyObservers</a></li></ul></li><li><a href="Monster_Types.TokenList.html">TokenList</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#add">add</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#clear">clear</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#contains">contains</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#entries">entries</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#forEach">forEach</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#getIterator">getIterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#remove">remove</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#replace">replace</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#Symbol.iterator">Symbol.iterator</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toggle">toggle</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.TokenList.html#toString">toString</a></li></ul></li><li><a href="Monster_Types.Version.html">Version</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#compareTo">compareTo</a></li><li data-type='method' style='display: none;'><a href="Monster_Types.Version.html#toString">toString</a></li></ul></li><li><a href="Monster_Util.Comparator.html">Comparator</a><ul class='methods'><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#equal">equal</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThan">greaterThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#greaterThanOrEqual">greaterThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThan">lessThan</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#lessThanOrEqual">lessThanOrEqual</a></li><li data-type='method' style='display: none;'><a href="Monster_Util.Comparator.html#reverse">reverse</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#proxySet">proxySet</a></li></ul> </nav> <div id="main"> diff --git a/packages/monster-dom/README.md b/packages/monster-dom/README.md index 102a881323e82e37bdff4f5bafbec997f150e3ed..688ff54eb24214f2e924da9f475cbe35625c8ff0 100644 --- a/packages/monster-dom/README.md +++ b/packages/monster-dom/README.md @@ -31,8 +31,8 @@ npm install @schukai/monster @schukai/monster-dom ``` <script type="module"> - import {Monster} from 'https://unpkg.com/@schukai/monster@1.0.15/dist/modules/monster.js'; - import {Monster} from 'https://unpkg.com/@schukai/monster-dom@1.0.15/dist/modules/monster.js'; + import {Monster} from 'https://unpkg.com/@schukai/monster@1.3.0/dist/modules/monster.js'; + import 'https://unpkg.com/@schukai/monster-dom@0.9.2/dist/modules/monster.js'; console.log(Module.getVersion()) </script> ``` @@ -40,9 +40,10 @@ npm install @schukai/monster @schukai/monster-dom nomodule for backwards compatibility ``` -<script type="module" src="module.mjs"></script> -<script nomodule src="https://unpkg.com/@schukai/monster@1.0.15/dist/monster.js"></script> -<script nomodule src="https://unpkg.com/@schukai/monster-dom@1.0.15/dist/monster.js"></script> +<script type="module" src="https://unpkg.com/@schukai/monster@1.3.0/dist/modules/monster.js"></script> +<script type="module" src="https://unpkg.com/@schukai/monster-dom@0.9.2/dist/modules/monster.js"></script> +<script nomodule src="https://unpkg.com/@schukai/monster@1.3.0/dist/monster.js"></script> +<script nomodule src="https://unpkg.com/@schukai/monster-dom@0.9.2/dist/monster.js"></script> ``` ## Documentation diff --git a/packages/monster-dom/dist/modules/monster.js b/packages/monster-dom/dist/modules/monster.js index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8728ce2e20425178d56f4c68f1d51162aed2f23c 100644 --- a/packages/monster-dom/dist/modules/monster.js +++ b/packages/monster-dom/dist/modules/monster.js @@ -0,0 +1,2 @@ +/** Monster 0.9.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ + diff --git a/packages/monster-dom/dist/monster.dev.js b/packages/monster-dom/dist/monster.dev.js new file mode 100644 index 0000000000000000000000000000000000000000..717775c5cee5e1ac21693ffc0ece54c822fb157a --- /dev/null +++ b/packages/monster-dom/dist/monster.dev.js @@ -0,0 +1,5 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ +"use strict"; + +},{}]},{},[1]) +//# sourceMappingURL=monster.dev.js.map diff --git a/packages/monster-dom/dist/monster.dev.js.map b/packages/monster-dom/dist/monster.dev.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7e672c0c870cecdeb3ca4744d1ad415af4b559d0 --- /dev/null +++ b/packages/monster-dom/dist/monster.dev.js.map @@ -0,0 +1,15 @@ +{ + "version": 3, + "sources": [ + "node_modules/browser-pack/_prelude.js", + "packages/monster-dom/source/monster.js" + ], + "names": [], + "mappings": "AAAA;ACAA;AACA", + "file": "generated.js", + "sourceRoot": "", + "sourcesContent": [ + "(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()", + "\"use strict\";\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbXX0=" + ] +} \ No newline at end of file diff --git a/packages/monster-dom/dist/monster.js b/packages/monster-dom/dist/monster.js index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2ea84b60021471972f7918618ce9a609b9636cdf 100644 --- a/packages/monster-dom/dist/monster.js +++ b/packages/monster-dom/dist/monster.js @@ -0,0 +1,2 @@ +/** Monster 0.9.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){"use strict"},{}]},{},[1]); diff --git a/packages/monster-dom/package.json b/packages/monster-dom/package.json index 7ca240ffb723ac9487d26425df652702db5e68a3..f7bc03e2c4357fedb3bca17d2829324da94b8a01 100644 --- a/packages/monster-dom/package.json +++ b/packages/monster-dom/package.json @@ -1,6 +1,6 @@ { "name": "@schukai/monster-dom", - "version": "0.9.0", + "version": "0.9.2", "description": "Monster is a simple library for creating fast, robust and lightweight websites.", "keywords": [ "framework", diff --git a/packages/monster-dom/source/.gitkeep b/packages/monster-dom/source/monster.js similarity index 100% rename from packages/monster-dom/source/.gitkeep rename to packages/monster-dom/source/monster.js diff --git a/packages/monster/CHANGELOG b/packages/monster/CHANGELOG index 4d470ab8398e1621067d4de179303918a855c1aa..f5e3cf6a15e609adb1fdc69fc6f26b5db8632d28 100644 --- a/packages/monster/CHANGELOG +++ b/packages/monster/CHANGELOG @@ -2,7 +2,31 @@ All notable changes to this project will be documented in this file. -## [1.1.0] - 202106-28 +## [1.3.0] - 2021-06-30 + +### Added + +- new class Monster.Util.Comparator +- new class Monster.Constraints.AbstractConstraint +- new class Monster.Constraints.AndOperator +- new class Monster.Constraints.OrOperator +- new class Monster.Constraints.Invalid +- new class Monster.Constraints.Valid +- new class Monster.Constraints.IsObject +- new class Monster.Constraints.IsArray + +### Changed + +- the return value of TokenList.replace() is now this +- change observer tags from `Set` to `TokenList` + +## [1.2.0] - 2021-06-30 + +### Added + +- Monster.Types.TokenList + +## [1.1.0] - 2021-06-28 ### Added diff --git a/packages/monster/README.md b/packages/monster/README.md index d9eaaeb8a51aa2ab650c777a04e88461de8b73bf..f20f855b93b019a7978d1c8dd73a85872ac1c729 100644 --- a/packages/monster/README.md +++ b/packages/monster/README.md @@ -29,7 +29,7 @@ thus supports all browsers that are compatible with ES5. ``` <script type="module"> - import {Monster} from 'https://unpkg.com/@schukai/monster@1.0.15/dist/modules/monster.js'; + import {Monster} from 'https://unpkg.com/@schukai/monster@1.3.0/dist/modules/monster.js'; console.log(Module.getVersion()) </script> ``` @@ -37,8 +37,8 @@ thus supports all browsers that are compatible with ES5. nomodule for backwards compatibility ``` -<script type="module" src="module.mjs"></script> -<script nomodule src="https://unpkg.com/@schukai/monster@1.0.15/dist/monster.js"></script> +<script type="module" src="https://unpkg.com/@schukai/monster@1.3.0/dist/modules/monster.js"></script> +<script nomodule src="https://unpkg.com/@schukai/monster@1.3.0/dist/monster.js"></script> ``` ## Documentation diff --git a/packages/monster/dist/modules/constraint/abstract.js b/packages/monster/dist/modules/constraint/abstract.js new file mode 100644 index 0000000000000000000000000000000000000000..be9c41e1aa852154a1d7674d9820a1695ef2b42d --- /dev/null +++ b/packages/monster/dist/modules/constraint/abstract.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import"../types/object.js";class AbstractConstraint extends Object{constructor(){super()}isValid(value){return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraint",AbstractConstraint);export{Monster,AbstractConstraint}; diff --git a/packages/monster/dist/modules/constraint/abstractoperator.js b/packages/monster/dist/modules/constraint/abstractoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..793668928623cdadd7354e408078731e5890f674 --- /dev/null +++ b/packages/monster/dist/modules/constraint/abstractoperator.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(operantA,operantB){super();if(!(operantA instanceof AbstractConstraint)||!(operantB instanceof AbstractConstraint)){throw new TypeError("parameters must be from type AbstractConstraint")}this.operantA=operantA;this.operantB=operantB}}Monster.assignToNamespace("Monster.Constraint",AbstractOperator);export{Monster,AbstractOperator}; diff --git a/packages/monster/dist/modules/constraint/andoperator.js b/packages/monster/dist/modules/constraint/andoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..b5e1f549cbad9b8e20d5760add4c27adf4171ebc --- /dev/null +++ b/packages/monster/dist/modules/constraint/andoperator.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(value){return Promise.all([this.operantA.isValid(value),this.operantB.isValid(value)])}}Monster.assignToNamespace("Monster.Constraint",AndOperator);export{Monster,AndOperator}; diff --git a/packages/monster/dist/modules/constraint/invalid.js b/packages/monster/dist/modules/constraint/invalid.js new file mode 100644 index 0000000000000000000000000000000000000000..5f0fb2ba0b99fed3418fd0854c40557e56d67c7c --- /dev/null +++ b/packages/monster/dist/modules/constraint/invalid.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(value){return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraint",Invalid);export{Monster,Invalid}; diff --git a/packages/monster/dist/modules/constraint/isarray.js b/packages/monster/dist/modules/constraint/isarray.js new file mode 100644 index 0000000000000000000000000000000000000000..1e56fea795c294842fe9801233d8d15fef812abd --- /dev/null +++ b/packages/monster/dist/modules/constraint/isarray.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{isArray}from"../types/is.js";class IsArray extends AbstractConstraint{isValid(value){if(isArray(value)){return Promise.resolve(value)}return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraint",IsArray);export{Monster,IsArray}; diff --git a/packages/monster/dist/modules/constraint/isobject.js b/packages/monster/dist/modules/constraint/isobject.js new file mode 100644 index 0000000000000000000000000000000000000000..a26ea656f9032cde170ea2bebd0a2dc157b7bcf9 --- /dev/null +++ b/packages/monster/dist/modules/constraint/isobject.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 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.Constraint",IsObject);export{Monster,IsObject}; diff --git a/packages/monster/dist/modules/constraint/namespace.js b/packages/monster/dist/modules/constraint/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..9ba346c266b77901e272a45fc233e5237d3095ef --- /dev/null +++ b/packages/monster/dist/modules/constraint/namespace.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict'; diff --git a/packages/monster/dist/modules/constraint/operator.js b/packages/monster/dist/modules/constraint/operator.js new file mode 100644 index 0000000000000000000000000000000000000000..2b5dcb9281a10becf9eaf1de3884204b5cbee596 --- /dev/null +++ b/packages/monster/dist/modules/constraint/operator.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class Operator extends AbstractConstraint{constructor(operantA,operantB){super();if(!(operantA instanceof AbstractConstraint)||!(operantB instanceof AbstractConstraint)){throw new TypeError("parameters must be from type AbstractConstraint")}this.operantA=operantA;this.operantB=operantB}}Monster.assignToNamespace("Monster.Constraint",Operator);export{Monster,Operator}; diff --git a/packages/monster/dist/modules/constraint/oroperator.js b/packages/monster/dist/modules/constraint/oroperator.js new file mode 100644 index 0000000000000000000000000000000000000000..d47901f67b4494575ae1696170d0e84f9556c620 --- /dev/null +++ b/packages/monster/dist/modules/constraint/oroperator.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{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.Constraint",OrOperator);export{Monster,OrOperator}; diff --git a/packages/monster/dist/modules/constraint/valid.js b/packages/monster/dist/modules/constraint/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..0797345b359b4b7d6b2f3987ad14ff623c5636bf --- /dev/null +++ b/packages/monster/dist/modules/constraint/valid.js @@ -0,0 +1,2 @@ +/** Monster 1.2.1, © 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.Constraint",Valid);export{Monster,Valid}; diff --git a/packages/monster/dist/modules/constraints/abstract.js b/packages/monster/dist/modules/constraints/abstract.js new file mode 100644 index 0000000000000000000000000000000000000000..ee9becc63938efe155364b3953639da7dd73486c --- /dev/null +++ b/packages/monster/dist/modules/constraints/abstract.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{Object}from"../types/object.js";class AbstractConstraint extends Object{constructor(){super()}isValid(value){return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint}; diff --git a/packages/monster/dist/modules/constraints/abstractoperator.js b/packages/monster/dist/modules/constraints/abstractoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..32c4e3df7f4e2bc4c0ebec16b19ede2a29d5cbda --- /dev/null +++ b/packages/monster/dist/modules/constraints/abstractoperator.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(operantA,operantB){super();if(!(operantA instanceof AbstractConstraint)||!(operantB instanceof AbstractConstraint)){throw new TypeError("parameters must be from type AbstractConstraint")}this.operantA=operantA;this.operantB=operantB}}Monster.assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator}; diff --git a/packages/monster/dist/modules/constraints/andoperator.js b/packages/monster/dist/modules/constraints/andoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..57504bcae386df36574b074bf50a2822f0481d0a --- /dev/null +++ b/packages/monster/dist/modules/constraints/andoperator.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(value){return Promise.all([this.operantA.isValid(value),this.operantB.isValid(value)])}}Monster.assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator}; diff --git a/packages/monster/dist/modules/constraints/invalid.js b/packages/monster/dist/modules/constraints/invalid.js new file mode 100644 index 0000000000000000000000000000000000000000..c13149726c4ebcaafa3a64d9a85dc7b6bf669be3 --- /dev/null +++ b/packages/monster/dist/modules/constraints/invalid.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(value){return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid}; diff --git a/packages/monster/dist/modules/constraints/isarray.js b/packages/monster/dist/modules/constraints/isarray.js new file mode 100644 index 0000000000000000000000000000000000000000..7b408ae7995060cbd9f5fcf8b4eee9ebf3064cae --- /dev/null +++ b/packages/monster/dist/modules/constraints/isarray.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,AbstractConstraint}from"./abstract.js";import{isArray}from"../types/is.js";class IsArray extends AbstractConstraint{isValid(value){if(isArray(value)){return Promise.resolve(value)}return Promise.reject(value)}}Monster.assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray}; diff --git a/packages/monster/dist/modules/constraints/isobject.js b/packages/monster/dist/modules/constraints/isobject.js new file mode 100644 index 0000000000000000000000000000000000000000..4a5d8ab925ad63a5b173dd78dae34d7bddac4c9f --- /dev/null +++ b/packages/monster/dist/modules/constraints/isobject.js @@ -0,0 +1,2 @@ +/** Monster 1.3.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}; diff --git a/packages/monster/dist/modules/constraints/namespace.js b/packages/monster/dist/modules/constraints/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..a5fe9f16ee924f70dea895bcd41d447d51b5468d --- /dev/null +++ b/packages/monster/dist/modules/constraints/namespace.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict'; diff --git a/packages/monster/dist/modules/constraints/oroperator.js b/packages/monster/dist/modules/constraints/oroperator.js new file mode 100644 index 0000000000000000000000000000000000000000..e28e451981f40980aea4a8497b15df251ded7c64 --- /dev/null +++ b/packages/monster/dist/modules/constraints/oroperator.js @@ -0,0 +1,2 @@ +/** Monster 1.3.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}; diff --git a/packages/monster/dist/modules/constraints/valid.js b/packages/monster/dist/modules/constraints/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..f873be488f86a89a1b7bad4e7cdc2aa57c791249 --- /dev/null +++ b/packages/monster/dist/modules/constraints/valid.js @@ -0,0 +1,2 @@ +/** Monster 1.3.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}; diff --git a/packages/monster/dist/modules/math/namespace.js b/packages/monster/dist/modules/math/namespace.js index bfa3a861ce384e1c458b70fb676c648f7b8908bc..a5fe9f16ee924f70dea895bcd41d447d51b5468d 100644 --- a/packages/monster/dist/modules/math/namespace.js +++ b/packages/monster/dist/modules/math/namespace.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict'; diff --git a/packages/monster/dist/modules/math/random.js b/packages/monster/dist/modules/math/random.js index 6fbd3541f738fe524b015b1d95e28ec5c0395880..c17da2d1138fb6ad51750594622b3e38fde7a0b6 100644 --- a/packages/monster/dist/modules/math/random.js +++ b/packages/monster/dist/modules/math/random.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';import{Monster}from"../namespace.js";function random(min,max){if(min===undefined){min=0}if(max===undefined){max=MAX}if(max<min){throw new Error("max must be greater than min")}return Math.round(create(min,max))}var MAX=1000000000;Math.log2=Math.log2||function(n){return Math.log(n)/Math.log(2)};function create(min,max){var crypt;if(typeof global!=="undefined"){crypt=global?.["crypto"]||global?.["msCrypto"]}else{crypt=typeof crypto!=="undefined"?crypto:undefined}if(typeof crypt==="undefined"){throw new Error("missing crypt")}let rval=0;const range=max-min;if(range<2){return min}const bitsNeeded=Math.ceil(Math.log2(range));if(bitsNeeded>53){throw new Error("we cannot generate numbers larger than 53 bits.")}const bytesNeeded=Math.ceil(bitsNeeded/8);const mask=Math.pow(2,bitsNeeded)-1;const byteArray=new Uint8Array(bytesNeeded);crypt.getRandomValues(byteArray);let p=(bytesNeeded-1)*8;for(var i=0;i<bytesNeeded;i++){rval+=byteArray[i]*Math.pow(2,p);p-=8}rval=rval&mask;if(rval>=range){return create(min,max)}return min+rval}Monster.assignToNamespace("Monster.Math",random);export{Monster,random}; diff --git a/packages/monster/dist/modules/module.js b/packages/monster/dist/modules/module.js deleted file mode 100644 index 58f7f09a13ac4be34d22de4595fe986e6e514594..0000000000000000000000000000000000000000 --- a/packages/monster/dist/modules/module.js +++ /dev/null @@ -1,2 +0,0 @@ -/** Monster 1.0.14, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict'; diff --git a/packages/monster/dist/modules/monster.js b/packages/monster/dist/modules/monster.js index dffa86d82491aa52973c342deffdc3dbb7ff8dae..8776fd17d331062ba7867c53740178cdfc82cc76 100644 --- a/packages/monster/dist/modules/monster.js +++ b/packages/monster/dist/modules/monster.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"./namespace.js";import"./types/id.js";import"./types/is.js";import"./types/object.js";import"./types/version.js";import"./types/observer.js";import"./types/observerlist.js";import"./types/validate.js";import"./math/random.js";import"./util/clone.js";import"./util/freeze.js";Monster.Util.deepFreeze(Monster);export{Monster}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"./namespace.js";import"./types/id.js";import"./types/is.js";import"./types/object.js";import"./types/observer.js";import"./types/observerlist.js";import"./types/proxyobserver.js";import"./types/version.js";import"./types/tokenlist.js";import"./types/validate.js";import"./types/version.js";import"./math/random.js";import"./util/clone.js";import"./util/comparator.js";import"./util/freeze.js";import"./constraints/abstract.js";import"./constraints/andoperator.js";import"./constraints/invalid.js";import"./constraints/isarray.js";import"./constraints/isobject.js";import"./constraints/abstractoperator.js";import"./constraints/oroperator.js";import"./constraints/valid.js";Monster.Util.deepFreeze(Monster);export{Monster}; diff --git a/packages/monster/dist/modules/namespace.js b/packages/monster/dist/modules/namespace.js index 92457d3949d2b2ae3fc2c55e54ec40ec939a9f9a..5b06f46a3d750ccaea41c574bad4eedbb00201fc 100644 --- a/packages/monster/dist/modules/namespace.js +++ b/packages/monster/dist/modules/namespace.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';class Namespace{constructor(namespace){if(namespace===undefined||typeof namespace!=="string"){throw new Error("namespace is not a string")}this.namespace=namespace}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}export const Monster=new Namespace("Monster");assignToNamespace("Monster",assignToNamespace);function assignToNamespace(ns,...obj){let current=namespaceFor(ns.split("."));for(let i=0,l=obj.length;i<l;i++){current[objectName(obj[i])]=obj[i]}}function objectName(fn){try{if(typeof fn!=="function"){throw new Error("the first argument is not a function or class.")}if(fn.hasOwnProperty("name")){return fn.name}if("function"===typeof fn.toString){let s=fn.toString();let f=s.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(f)&&typeof f[1]==="string"){return f[1]}let c=s.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(c)&&typeof c[1]==="string"){return c[1]}}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(parts){var space=Monster,ns="Monster";for(let i=0;i<parts.length;i++){if("Monster"===parts[i]){continue}ns+="."+parts[i];if(!space.hasOwnProperty(parts[i])){space[parts[i]]=new Namespace(ns)}space=space[parts[i]]}return space}export{assignToNamespace}; diff --git a/packages/monster/dist/modules/types/clone.js b/packages/monster/dist/modules/types/clone.js deleted file mode 100644 index cfea3024244178f7ca34542a560240d6459a9af8..0000000000000000000000000000000000000000 --- a/packages/monster/dist/modules/types/clone.js +++ /dev/null @@ -1,2 +0,0 @@ -/** Monster 1.0.11, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";function clone(obj){var copy;if(null===obj||"object"!==typeof obj){return obj}if(obj instanceof Date){copy=new Date;copy.setTime(obj.getTime());return copy}if(Array.isArray(obj)){copy=[];for(var i=0,len=obj.length;i<len;i++){copy[i]=clone(obj[i])}return copy}if(obj instanceof Element||obj instanceof HTMLDocument||obj instanceof DocumentFragment){return obj}if(obj instanceof Proxy){return obj}if(obj===globalContext||obj===window||obj===document||obj===navigator||obj===JSON){return obj}if(obj instanceof Object){if(typeof obj.hasOwnProperty("getClone")&&obj.getClone==="function"){return obj.getClone()}copy={};if(typeof obj.constructor==="function"&&typeof obj.constructor.call==="function"){copy=new obj.constructor}for(let key in obj){if(!obj.hasOwnProperty(key)){continue}if(Monster.Types.isPrimitive(obj[key])){copy[key]=obj[key];continue}copy[key]=clone(obj[key])}return copy}throw new Error("unable to clone obj! its type isn't supported.")}Monster.assignToNamespace("Monster.Types",clone);export{Monster,clone}; diff --git a/packages/monster/dist/modules/types/id.js b/packages/monster/dist/modules/types/id.js index 0aa02af03b59ee04dec5e3fafbd6e3359c7f44dc..89af6cbb9f88c9fac2bda74b096bf709c5334bd6 100644 --- a/packages/monster/dist/modules/types/id.js +++ b/packages/monster/dist/modules/types/id.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";import"../types/object.js";let internalCounter=0;class ID extends Monster.Types.Object{constructor(){super();internalCounter+=1;this.id=global.btoa(Monster.Math.random(1,10000)).replace(/=/g,"").replace(/^[0-9]+/,"X")+internalCounter}toString(){return this.id}}Monster.assignToNamespace("Monster.Types",ID);export{Monster,ID}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{random}from"../math/random.js";import"../types/object.js";let internalCounter=0;class ID extends Monster.Types.Object{constructor(){super();internalCounter+=1;this.id=global.btoa(random(1,10000)).replace(/=/g,"").replace(/^[0-9]+/,"X")+internalCounter}toString(){return this.id}}Monster.assignToNamespace("Monster.Types",ID);export{Monster,ID}; diff --git a/packages/monster/dist/modules/types/is.js b/packages/monster/dist/modules/types/is.js index 135469a3976a1fb0d41bd700b0dfc48f369161d1..e5f910b6e7dd5f45a33db3dd24f781fc9577c0bd 100644 --- a/packages/monster/dist/modules/types/is.js +++ b/packages/monster/dist/modules/types/is.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";function isPrimitive(value){var type;if(value===undefined||value===null){return true}type=typeof value;if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="object"){return true}return false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction);export{Monster,isPrimitive,isBoolean,isString,isObject,isArray,isFunction}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";function isIterable(value){if(value===undefined)return false;if(value===null)return false;return typeof value?.[Symbol.iterator]==="function"}function isPrimitive(value){var type;if(value===undefined||value===null||value===NaN){return true}type=typeof value;if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="object"){return true}return false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable);export{Monster,isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable}; diff --git a/packages/monster/dist/modules/types/namespace.js b/packages/monster/dist/modules/types/namespace.js index bfa3a861ce384e1c458b70fb676c648f7b8908bc..a5fe9f16ee924f70dea895bcd41d447d51b5468d 100644 --- a/packages/monster/dist/modules/types/namespace.js +++ b/packages/monster/dist/modules/types/namespace.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict'; diff --git a/packages/monster/dist/modules/types/object.js b/packages/monster/dist/modules/types/object.js index d59d3a4e07f551ab98ee201183661331ada2bf10..4d9aa844c1259ef806e960c10d0adc1ac67c95f1 100644 --- a/packages/monster/dist/modules/types/object.js +++ b/packages/monster/dist/modules/types/object.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';import{Monster}from"../namespace.js";class Object{constructor(){}toString(){return JSON.stringify(this)}}Monster.assignToNamespace("Monster.Types",Object);export{Monster,Object}; diff --git a/packages/monster/dist/modules/types/observer.js b/packages/monster/dist/modules/types/observer.js index b7267cea6a387f52facf113d739723a0fe39a46a..236e7b43fa9bdbeb389085b8d0f2f4f6f91e11e2 100644 --- a/packages/monster/dist/modules/types/observer.js +++ b/packages/monster/dist/modules/types/observer.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";import"../types/object.js";class Observer extends Monster.Types.Object{constructor(callback,...args){super();if(typeof callback!=="function"){throw new Error("observer callback must be a function")}this.callback=callback;this.arguments=args;this.tags=new Set}addTag(tag){this.tags.add(tag);return this}removeTag(tag){this.tags.delete(tag);return this}getTags(){return this.tags}hasTag(tag){return this.tags.has(tag)}update(subject){let self=this;return new Promise(function(resolve,reject){if(!(subject instanceof Object)){reject("subject must be an object")}let result=self.callback.apply(subject,self.arguments);resolve(result)})}}Monster.assignToNamespace("Monster.Types",Observer);export{Monster,Observer}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{TokenList}from"../types/tokenlist.js";import{isObject}from"../types/is.js";import"../types/object.js";class Observer extends Monster.Types.Object{constructor(callback,...args){super();if(typeof callback!=="function"){throw new Error("observer callback must be a function")}this.callback=callback;this.arguments=args;this.tags=new TokenList}addTag(tag){this.tags.add(tag);return this}removeTag(tag){this.tags.remove(tag);return this}getTags(){return this.tags.entries()}hasTag(tag){return this.tags.contains(tag)}update(subject){let self=this;return new Promise(function(resolve,reject){if(!isObject(subject)){reject("subject must be an object")}let result=self.callback.apply(subject,self.arguments);resolve(result)})}}Monster.assignToNamespace("Monster.Types",Observer);export{Monster,Observer}; diff --git a/packages/monster/dist/modules/types/observerlist.js b/packages/monster/dist/modules/types/observerlist.js index b7fbade9c9970ad3484c82f6b562588c741a6ac5..3799f4982f44d28777303ba994f87461e3ca22c2 100644 --- a/packages/monster/dist/modules/types/observerlist.js +++ b/packages/monster/dist/modules/types/observerlist.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';import{Monster}from"../namespace.js";import"../types/object.js";class ObserverList extends Monster.Types.Object{constructor(){super();this.observers=[]}attach(observer){checkIsObserver(observer);this.observers.push(observer);return this}detach(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){this.observers.splice(i,1)}}return this}contains(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){return true}}return false}notify(subject){let pomises=[];var i=0,l=this.observers.length;for(;i<l;i++){pomises.push(this.observers[i].update(subject))}return Promise.all(pomises)}}function checkIsObserver(observer){if(!(observer instanceof Monster.Types.Observer)){throw new Error("argument must be instance of observer")}return true}Monster.assignToNamespace("Monster.Types",ObserverList);export{Monster,ObserverList}; diff --git a/packages/monster/dist/modules/types/proxyobserver.js b/packages/monster/dist/modules/types/proxyobserver.js new file mode 100644 index 0000000000000000000000000000000000000000..dfd169dc1064757775c05b4bb696b6d9c9b4265f --- /dev/null +++ b/packages/monster/dist/modules/types/proxyobserver.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{Object}from"../types/object.js";import{validateObject}from"./validate.js";import{ObserverList}from"./observerlist.js";import{Observer}from"./observer.js";import{isObject,isArray}from"./is.js";var proxySet=new WeakSet;class ProxyObserver extends Object{constructor(object){super();validateObject(object);this.realSubject=object;this.subject=new Proxy(object,getHandler.call(this));proxySet.add(this.subject);this.observers=new ObserverList}getSubject(){return this.subject}getRealSubject(){return this.realSubject}attachObserver(observer){this.observers.attach(observer);return this}detachObserver(observer){this.observers.detach(observer);return this}notifyObservers(){this.observers.notify(this);return this}containsObserver(observer){return this.observers.contains(observer)}}Monster.assignToNamespace("Monster.Types",ProxyObserver);export{Monster,ProxyObserver};function getHandler(){const proxy=this;const handler={get:function(target,property,receiver){const prop=target?.[property];if(prop===undefined){return undefined}if(isArray(prop)||isObject(prop)&&!proxySet.has(prop)){target[property]=new Proxy(prop,handler);proxySet.add(prop)}return target[property]},set:function(target,property,value,receiver){target[property]=value;proxy.observers.notify(proxy);return true},deleteProperty:function(target,property){if(property in target){delete target[property];proxy.observers.notify(proxy);return true}return false},defineProperty:function(target,property,descriptor){let result=Reflect.defineProperty(target,property,descriptor);proxy.observers.notify(proxy);return parseURLToResultingURLRecord()},setPrototypeOf:function(target,prototype){let result=Reflect.setPrototypeOf(object1,prototype);proxy.observers.notify(proxy);return result}};return handler} diff --git a/packages/monster/dist/modules/types/tokenlist.js b/packages/monster/dist/modules/types/tokenlist.js new file mode 100644 index 0000000000000000000000000000000000000000..5e0b7935a0ee69cd2f3ae0db34ad4c833838e850 --- /dev/null +++ b/packages/monster/dist/modules/types/tokenlist.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{Object}from"../types/object.js";import{isString,isIterable}from"../types/is.js";import{validateString,validateFunction}from"../types/validate.js";class TokenList extends Object{constructor(init){super();this.tokens=new Set;if(typeof init!=="undefined"){this.add(init)}}getIterator(){return this[Symbol.iterator]()}[Symbol.iterator](){let index=0;let entries=this.entries();return{next:()=>{if(index<entries.length){return{value:entries?.[index++],done:false}}else{return{done:true}}}}}contains(value){if(isString(value)){value=value.trim();let counter=0;value.split(" ").forEach(token=>{if(this.tokens.has(token.trim())===false)return false;counter++});return counter>0?true:false}if(isIterable(value)){let counter=0;for(let token of value){validateString(token);if(this.tokens.has(token.trim())===false)return false;counter++}return counter>0?true:false}return false}add(value){if(isString(value)){value.split(" ").forEach(token=>{this.tokens.add(token.trim())})}else if(isIterable(value)){for(let token of value){validateString(token);this.tokens.add(token.trim())}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}clear(){this.tokens.clear();return this}remove(value){if(isString(value)){value.split(" ").forEach(token=>{this.tokens.delete(token.trim())})}else if(isIterable(value)){for(let token of value){validateString(token);this.tokens.delete(token.trim())}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}replace(token,newToken){validateString(token);validateString(newToken);if(!this.contains(token)){return this}let a=Array.from(this.tokens);let i=a.indexOf(token);if(i===-1)return this;a.splice(i,1,newToken);this.tokens=new Set;this.add(a);return this}toggle(value){if(isString(value)){value.split(" ").forEach(token=>{toggleValue.call(this,token)})}else if(isIterable(value)){for(let token of value){toggleValue.call(this,token)}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}entries(){return Array.from(this.tokens)}forEach(callback){validateFunction(callback);this.tokens.forEach(callback);return this}toString(){return this.entries().join(" ")}}function toggleValue(token){if(!(this instanceof TokenList))throw Error("must be called with TokenList.call");validateString(token);token=token.trim();if(this.contains(token)){this.remove(token);return this}this.add(token);return this}Monster.assignToNamespace("Monster.Types",TokenList);export{Monster,TokenList}; diff --git a/packages/monster/dist/modules/types/validate.js b/packages/monster/dist/modules/types/validate.js index ff66b4d25c5e8c3e8457b06f76a42495c5cb6430..eac331d3328edcc923bddde8ba49595523a95734 100644 --- a/packages/monster/dist/modules/types/validate.js +++ b/packages/monster/dist/modules/types/validate.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";import{isPrimitive,isBoolean,isString,isObject,isArray,isFunction}from"../types/is.js";function validatePrimitive(value){if(!isPrimitive(value)){throw new TypeError("value is not a primitive")}}function validateBoolean(value){if(!isBoolean(value)){throw new TypeError("value is not a boolean")}}function validateString(value){if(!isString(value)){throw new TypeError("value is not a string")}}function validateObject(value){if(!isObject(value)){throw new TypeError("value is not a object")}}function validateArray(value){if(!isArray(value)){throw new TypeError("value is not not a array")}}function validateFunction(value){if(!isFunction(value)){throw new TypeError("value is not a function")}}Monster.assignToNamespace("Monster.Types",validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction);export{Monster,validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import{isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable}from"../types/is.js";function validateIterable(value){if(!isIterable(value)){throw new TypeError("value is not iterable")}}function validatePrimitive(value){if(!isPrimitive(value)){throw new TypeError("value is not a primitive")}}function validateBoolean(value){if(!isBoolean(value)){throw new TypeError("value is not a boolean")}}function validateString(value){if(!isString(value)){throw new TypeError("value is not a string")}}function validateObject(value){if(!isObject(value)){throw new TypeError("value is not a object")}}function validateArray(value){if(!isArray(value)){throw new TypeError("value is not not a array")}}function validateFunction(value){if(!isFunction(value)){throw new TypeError("value is not a function")}}Monster.assignToNamespace("Monster.Types",validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction,validateIterable);export{Monster,validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction,validateIterable}; diff --git a/packages/monster/dist/modules/types/version.js b/packages/monster/dist/modules/types/version.js index e846fcf56671d515c03c55544d7ee6948bc0e0c6..84fc15ff5f1c223c7da5b983dcd2e0f140ca6223 100644 --- a/packages/monster/dist/modules/types/version.js +++ b/packages/monster/dist/modules/types/version.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -'use strict';import{Monster}from"../namespace.js";import"../types/object.js";class Version extends Monster.Types.Object{constructor(major,minor,patch){super();if(typeof major==="string"&&minor===undefined&&patch===undefined){let parts=major.toString().split(".");major=parseInt(parts[0]||0);minor=parseInt(parts[1]||0);patch=parseInt(parts[2]||0)}if(major===undefined){throw new Error("major version is undefined")}if(minor===undefined){minor=0}if(patch===undefined){patch=0}this.major=parseInt(major);this.minor=parseInt(minor);this.patch=parseInt(patch);if(isNaN(this.major)){throw new Error("major is not a number")}if(isNaN(this.minor)){throw new Error("minor is not a number")}if(isNaN(this.patch)){throw new Error("patch is not a number")}}toString(){return this.major+"."+this.minor+"."+this.patch}compareTo(version){if(version instanceof Version){version=version.toString()}if(typeof version!=="string"){throw new Error("type exception")}if(version===this.toString()){return 0}let a=[this.major,this.minor,this.patch];let b=version.split(".");let len=Math.max(a.length,b.length);for(let i=0;i<len;i+=1){if(a[i]&&!b[i]&&parseInt(a[i])>0||parseInt(a[i])>parseInt(b[i])){return 1}else if(b[i]&&!a[i]&&parseInt(b[i])>0||parseInt(a[i])<parseInt(b[i])){return-1}}return 0}}Monster.assignToNamespace("Monster.Types",Version);let monsterVersion;function getVersion(){if(monsterVersion instanceof Version){return monsterVersion}monsterVersion=new Version("1.1.0");return monsterVersion}Monster.assignToNamespace("Monster",getVersion);export{Monster,Version,getVersion}; +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster}from"../namespace.js";import"../types/object.js";class Version extends Monster.Types.Object{constructor(major,minor,patch){super();if(typeof major==="string"&&minor===undefined&&patch===undefined){let parts=major.toString().split(".");major=parseInt(parts[0]||0);minor=parseInt(parts[1]||0);patch=parseInt(parts[2]||0)}if(major===undefined){throw new Error("major version is undefined")}if(minor===undefined){minor=0}if(patch===undefined){patch=0}this.major=parseInt(major);this.minor=parseInt(minor);this.patch=parseInt(patch);if(isNaN(this.major)){throw new Error("major is not a number")}if(isNaN(this.minor)){throw new Error("minor is not a number")}if(isNaN(this.patch)){throw new Error("patch is not a number")}}toString(){return this.major+"."+this.minor+"."+this.patch}compareTo(version){if(version instanceof Version){version=version.toString()}if(typeof version!=="string"){throw new Error("type exception")}if(version===this.toString()){return 0}let a=[this.major,this.minor,this.patch];let b=version.split(".");let len=Math.max(a.length,b.length);for(let i=0;i<len;i+=1){if(a[i]&&!b[i]&&parseInt(a[i])>0||parseInt(a[i])>parseInt(b[i])){return 1}else if(b[i]&&!a[i]&&parseInt(b[i])>0||parseInt(a[i])<parseInt(b[i])){return-1}}return 0}}Monster.assignToNamespace("Monster.Types",Version);let monsterVersion;function getVersion(){if(monsterVersion instanceof Version){return monsterVersion}monsterVersion=new Version("1.3.0");return monsterVersion}Monster.assignToNamespace("Monster",getVersion);export{Monster,Version,getVersion}; diff --git a/packages/monster/dist/modules/util/clone.js b/packages/monster/dist/modules/util/clone.js index d9758989779e3dfe3b858b89e8791982529f2b23..4be4ed09843f43ac64a35397e9893e0ba2bf7378 100644 --- a/packages/monster/dist/modules/util/clone.js +++ b/packages/monster/dist/modules/util/clone.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';import{Monster}from"../namespace.js";import{isObject,isFunction,isPrimitive,isArray}from"../types/is.js";function clone(obj){if(null===obj){return obj}if(isPrimitive(obj)){return obj}if(isFunction(obj)){return obj}if(isArray(obj)){let copy=[];for(var i=0,len=obj.length;i<len;i++){copy[i]=clone(obj[i])}return copy}if(isObject(obj)){if(obj instanceof Date){let copy=new Date;copy.setTime(obj.getTime());return copy}if(typeof Element!=="undefined"&&obj instanceof Element)return obj;if(typeof HTMLDocument!=="undefined"&&obj instanceof HTMLDocument)return obj;if(typeof DocumentFragment!=="undefined"&&obj instanceof DocumentFragment)return obj;if(typeof globalContext!=="undefined"&&obj===globalContext)return obj;if(typeof window!=="undefined"&&obj===window)return obj;if(typeof document!=="undefined"&&obj===document)return obj;if(typeof navigator!=="undefined"&&obj===navigator)return obj;if(typeof JSON!=="undefined"&&obj===JSON)return obj;try{if(obj instanceof Proxy){return obj}}catch(e){}return cloneObject(obj)}throw new Error("unable to clone obj! its type isn't supported.")}function cloneObject(obj){var copy;if(typeof obj.hasOwnProperty("getClone")&&obj.getClone==="function"){return obj.getClone()}copy={};if(typeof obj.constructor==="function"&&typeof obj.constructor.call==="function"){copy=new obj.constructor}for(let key in obj){if(!obj.hasOwnProperty(key)){continue}if(Monster.Types.isPrimitive(obj[key])){copy[key]=obj[key];continue}copy[key]=clone(obj[key])}return copy}Monster.assignToNamespace("Monster.Util",clone);export{Monster,clone}; diff --git a/packages/monster/dist/modules/util/comparator.js b/packages/monster/dist/modules/util/comparator.js new file mode 100644 index 0000000000000000000000000000000000000000..c58e223f348eb3a2ad02a87ee43c94d740ca856b --- /dev/null +++ b/packages/monster/dist/modules/util/comparator.js @@ -0,0 +1,2 @@ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +'use strict';import{Monster,Object}from"../types/object.js";import{isFunction}from"../types/is.js";class Comparator extends Object{constructor(callback){super();if(isFunction(callback)){this.compare=callback}else if(callback!==undefined){throw new TypeError("unsupported type")}else{this.compare=function(a,b){if(typeof a!==typeof b){throw new TypeError("impractical comparison")}if(a===b){return 0}return a<b?-1:1}}}reverse(){const original=this.compare;this.compare=(a,b)=>original(b,a);return this}equal(a,b){return this.compare(a,b)===0}greaterThan(a,b){return this.compare(a,b)>0}greaterThanOrEqual(a,b){return this.greaterThan(a,b)||this.equal(a,b)}lessThanOrEqual(a,b){return this.lessThan(a,b)||this.equal(a,b)}lessThan(a,b){return this.compare(a,b)<0}}Monster.assignToNamespace("Monster.Util",Comparator);export{Monster,Comparator}; diff --git a/packages/monster/dist/modules/util/freeze.js b/packages/monster/dist/modules/util/freeze.js index 29c6bd5b958ce10e2790de907ed8e949b046471f..0aa43f294de3b4696dad33795b098b696700c641 100644 --- a/packages/monster/dist/modules/util/freeze.js +++ b/packages/monster/dist/modules/util/freeze.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict';import{Monster}from"../namespace.js";import{validateObject}from"../types/validate.js";function deepFreeze(object){validateObject(object);var propNames=Object.getOwnPropertyNames(object);for(let name of propNames){let value=object[name];object[name]=value&&typeof value==="object"?deepFreeze(value):value}return Object.freeze(object)}Monster.assignToNamespace("Monster.Util",deepFreeze);export{Monster,deepFreeze}; diff --git a/packages/monster/dist/modules/util/namespace.js b/packages/monster/dist/modules/util/namespace.js index bfa3a861ce384e1c458b70fb676c648f7b8908bc..a5fe9f16ee924f70dea895bcd41d447d51b5468d 100644 --- a/packages/monster/dist/modules/util/namespace.js +++ b/packages/monster/dist/modules/util/namespace.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ 'use strict'; diff --git a/packages/monster/dist/monster.dev.js b/packages/monster/dist/monster.dev.js index 2f21acbeff41ba10353733b77ce71d284fa8ac29..4813a0269bc28a00bf1c5426a4c58b9334f38e54 100644 --- a/packages/monster/dist/monster.dev.js +++ b/packages/monster/dist/monster.dev.js @@ -1,142 +1,97 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ -(function (global){(function (){ 'use strict'; /** * @author schukai GmbH */ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + Object.defineProperty(exports, "__esModule", { value: true }); -exports.random = random; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { return _namespace.Monster; } }); +exports.AbstractConstraint = void 0; var _namespace = require("../namespace.js"); -/** - * this function uses crypt and returns a random number. - * - * you can call the method via the monster namespace `Monster.Math.random()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; - * console.log(Monster.Math.random(1,10)) // ↦ 5 - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; - * console.log(random(1,10)) // ↦ 5 - * </script> - * ``` - * - * @param {number} min starting value of the definition set (default is 0) - * @param {number} max end value of the definition set (default is 1000000000) - * @returns {number} - * @memberOf Monster/Math - - * @since 1.0.0 - * @copyright schukai GmbH - */ -function random(min, max) { - if (min === undefined) { - min = 0; - } - - if (max === undefined) { - max = MAX; - } - - if (max < min) { - throw new Error("max must be greater than min"); - } +var _object = require("../types/object.js"); - return Math.round(create(min, max)); -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var MAX = 1000000000; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -Math.log2 = Math.log2 || function (n) { - return Math.log(n) / Math.log(2); -}; -/** - * - * @param min - * @param max - * @returns {*} - * @private - */ +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -function create(min, max) { - var crypt; +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - if (typeof global !== "undefined") { - var _global, _global2; +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - crypt = ((_global = global) === null || _global === void 0 ? void 0 : _global['crypto']) || ((_global2 = global) === null || _global2 === void 0 ? void 0 : _global2['msCrypto']); - } else { - crypt = typeof crypto !== "undefined" ? crypto : undefined; - } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - if (typeof crypt === "undefined") { - throw new Error("missing crypt"); - } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - var rval = 0; - var range = max - min; +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - if (range < 2) { - return min; - } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - var bitsNeeded = Math.ceil(Math.log2(range)); +/** + * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined. + * + * derived classes must implement the method isValid(). + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var AbstractConstraint = /*#__PURE__*/function (_Object) { + _inherits(AbstractConstraint, _Object); - if (bitsNeeded > 53) { - throw new Error("we cannot generate numbers larger than 53 bits."); - } + var _super = _createSuper(AbstractConstraint); - var bytesNeeded = Math.ceil(bitsNeeded / 8); - var mask = Math.pow(2, bitsNeeded) - 1; - var byteArray = new Uint8Array(bytesNeeded); - crypt.getRandomValues(byteArray); - var p = (bytesNeeded - 1) * 8; + /** + * + */ + function AbstractConstraint() { + _classCallCheck(this, AbstractConstraint); - for (var i = 0; i < bytesNeeded; i++) { - rval += byteArray[i] * Math.pow(2, p); - p -= 8; + return _super.call(this); } + /** + * this method must return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ - rval = rval & mask; - if (rval >= range) { - return create(min, max); - } + _createClass(AbstractConstraint, [{ + key: "isValid", + value: function isValid(value) { + return Promise.reject(value); + } + }]); - return min + rval; -} + return AbstractConstraint; +}(Object); -_namespace.Monster.assignToNamespace('Monster.Math', random); +exports.AbstractConstraint = AbstractConstraint; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +_namespace.Monster.assignToNamespace('Monster.Constraints', AbstractConstraint); -},{"../namespace.js":3}],2:[function(require,module,exports){ +},{"../namespace.js":11,"../types/object.js":14}],2:[function(require,module,exports){ +'use strict'; /** - * @license - * Copyright 2021 schukai GmbH - * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL * @author schukai GmbH */ -'use strict'; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true @@ -144,59 +99,92 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { - return _namespace.Monster; + return _abstract.Monster; } }); +exports.AbstractOperator = void 0; -var _namespace = require("./namespace.js"); +var _abstract = require("./abstract.js"); -require("./types/id.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -require("./types/is.js"); +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -require("./types/object.js"); +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -require("./types/version.js"); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -require("./types/observer.js"); +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -require("./types/observerlist.js"); +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -require("./types/validate.js"); +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -require("./math/random.js"); +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -require("./util/clone.js"); +/** + * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together. + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var AbstractOperator = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(AbstractOperator, _AbstractConstraint); -require("./util/freeze.js"); + var _super = _createSuper(AbstractOperator); -_namespace.Monster.Util.deepFreeze(_namespace.Monster); + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" + */ + function AbstractOperator(operantA, operantB) { + var _this; + + _classCallCheck(this, AbstractOperator); + + _this = _super.call(this); + + if (!(operantA instanceof _abstract.AbstractConstraint) || !(operantB instanceof _abstract.AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint"); + } + + _this.operantA = operantA; + _this.operantB = operantB; + return _this; + } + + return AbstractOperator; +}(_abstract.AbstractConstraint); -},{"./math/random.js":1,"./namespace.js":3,"./types/id.js":4,"./types/is.js":5,"./types/object.js":6,"./types/observer.js":7,"./types/observerlist.js":8,"./types/validate.js":9,"./types/version.js":10,"./util/clone.js":11,"./util/freeze.js":12}],3:[function(require,module,exports){ +exports.AbstractOperator = AbstractOperator; + +_abstract.Monster.assignToNamespace('Monster.Constraints', AbstractOperator); + +},{"./abstract.js":1}],3:[function(require,module,exports){ 'use strict'; /** - * @namespace Monster * @author schukai GmbH */ -/** - * Namespace class objects form the basic framework of the namespace administration. - * - * All functions, classes and objects of the library hang within the namespace tree. - * - * Via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. - * - * @memberOf Monster - - * @copyright schukai GmbH - * @since 1.0.0 - */ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); -exports.assignToNamespace = assignToNamespace; -exports.Monster = void 0; +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; + } +}); +exports.AndOperator = void 0; + +var _abstract = require("./abstract.js"); + +var _abstractoperator = require("./abstractoperator.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -204,161 +192,175 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Namespace = /*#__PURE__*/function () { - /** - * - * @param namespace - * @param obj - */ - function Namespace(namespace) { - _classCallCheck(this, Namespace); - - if (namespace === undefined || typeof namespace !== 'string') { - throw new Error("namespace is not a string"); - } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - this.namespace = namespace; - } - /** - * - * @returns {string} - */ +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - _createClass(Namespace, [{ - key: "getNamespace", - value: function getNamespace() { - return this.namespace; - } - /** - * - * @returns {string} - */ +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - }, { - key: "toString", - value: function toString() { - return this.getNamespace(); - } - }]); +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - return Namespace; -}(); -/** - * - * @type {Namespace} - * @global - */ +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var Monster = new Namespace("Monster"); /** + * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled. * - */ - -exports.Monster = Monster; -assignToNamespace('Monster', assignToNamespace); -/** - * To expand monster, the `Monster.assignToNamespace()` method can be used. + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` * - * you must call the method in the monster namespace. this allows you to mount your own classes, objects and functions into the namespace. - * - * To avoid confusion and so that you do not accidentally overwrite existing functions, you should use the custom namespace `X`. + * Alternatively, you can also integrate this function individually. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/namespace.js'; - * function hello() { - * console.log('Hello World!'); - * } - * Monster.assignToNamespace("Monster.X",hello) - * Monster.X.hello(); // ↦ Hello World! + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); * </script> - * * ``` * - * @param ns - * @param obj - * @memberOf Monster - + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints */ +var AndOperator = /*#__PURE__*/function (_AbstractOperator) { + _inherits(AndOperator, _AbstractOperator); -function assignToNamespace(ns) { - var current = namespaceFor(ns.split(".")); + var _super = _createSuper(AndOperator); - for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) { - current[objectName(i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1])] = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1]; + function AndOperator() { + _classCallCheck(this, AndOperator); + + return _super.apply(this, arguments); } -} + + _createClass(AndOperator, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]); + } + }]); + + return AndOperator; +}(_abstractoperator.AbstractOperator); + +exports.AndOperator = AndOperator; + +_abstract.Monster.assignToNamespace('Monster.Constraints', AndOperator); + +},{"./abstract.js":1,"./abstractoperator.js":2}],4:[function(require,module,exports){ +'use strict'; /** - * - * @param fn - * @returns {string|*} - * @private + * @author schukai GmbH */ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function objectName(fn) { - try { - if (typeof fn !== 'function') { - throw new Error("the first argument is not a function or class."); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; + } +}); +exports.Invalid = void 0; - if (fn.hasOwnProperty('name')) { - return fn.name; - } +var _abstract = require("./abstract.js"); - if ("function" === typeof fn.toString) { - var s = fn.toString(); - var f = s.match(/^\s*function\s+([^\s(]+)/); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (Array.isArray(f) && typeof f[1] === 'string') { - return f[1]; - } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - var c = s.match(/^\s*class\s+([^\s(]+)/); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - if (Array.isArray(c) && typeof c[1] === 'string') { - return c[1]; - } - } - } catch (e) { - throw new Error("exception " + e); - } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - throw new Error("the name of the class or function cannot be resolved."); -} /** + * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing. * - * @param parts - * @returns {Namespace} - * @private + * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Monster.Constraint.Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints */ +var Invalid = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(Invalid, _AbstractConstraint); + var _super = _createSuper(Invalid); -function namespaceFor(parts) { - var space = Monster, - ns = 'Monster'; - - for (var i = 0; i < parts.length; i++) { - if ("Monster" === parts[i]) { - continue; - } + function Invalid() { + _classCallCheck(this, Invalid); - ns += '.' + parts[i]; + return _super.apply(this, arguments); + } - if (!space.hasOwnProperty(parts[i])) { - space[parts[i]] = new Namespace(ns); + _createClass(Invalid, [{ + key: "isValid", + value: + /** + * this method return a rejected promise + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.reject(value); } + }]); - space = space[parts[i]]; - } + return Invalid; +}(_abstract.AbstractConstraint); - return space; -} +exports.Invalid = Invalid; -},{}],4:[function(require,module,exports){ -(function (global){(function (){ +_abstract.Monster.assignToNamespace('Monster.Constraints', Invalid); + +},{"./abstract.js":1}],5:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -372,14 +374,14 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { - return _namespace.Monster; + return _abstract.Monster; } }); -exports.ID = void 0; +exports.IsArray = void 0; -var _namespace = require("../namespace.js"); +var _abstract = require("./abstract.js"); -require("../types/object.js"); +var _is = require("../types/is.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -401,16 +403,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var internalCounter = 0; /** * - * you can call the method via the monster namespace `new Monster.Types.ID()`. + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; - * console.log(new Monster.Types.ID()) - * console.log(new Monster.Types.ID()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new Monster.Constraint.IsArray()) * </script> * ``` * @@ -418,87 +419,103 @@ var internalCounter = 0; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; - * console.log(new ID()) - * console.log(new ID()) + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new IsArray()) * </script> * ``` * - * @since 1.0.0 + * @since 1.3.0 * @copyright schukai GmbH - * @memberOf Monster/Types + * @memberOf Monster/Constraints */ +var IsArray = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(IsArray, _AbstractConstraint); -var ID = /*#__PURE__*/function (_Monster$Types$Object) { - _inherits(ID, _Monster$Types$Object); - - var _super = _createSuper(ID); - - function ID() { - var _this; + var _super = _createSuper(IsArray); - _classCallCheck(this, ID); + function IsArray() { + _classCallCheck(this, IsArray); - _this = _super.call(this); - internalCounter += 1; - _this.id = global.btoa(_namespace.Monster.Math.random(1, 10000)).replace(/=/g, '') - /** No numbers at the beginning of the ID, because of possible problems with DOM */ - .replace(/^[0-9]+/, 'X') + internalCounter; - return _this; + return _super.apply(this, arguments); } - _createClass(ID, [{ - key: "toString", - value: function toString() { - return this.id; + _createClass(IsArray, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + if ((0, _is.isArray)(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); } }]); - return ID; -}(_namespace.Monster.Types.Object); - -exports.ID = ID; + return IsArray; +}(_abstract.AbstractConstraint); -_namespace.Monster.assignToNamespace('Monster.Types', ID); +exports.IsArray = IsArray; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +_abstract.Monster.assignToNamespace('Monster.Constraints', IsArray); -},{"../namespace.js":3,"../types/object.js":6}],5:[function(require,module,exports){ +},{"../types/is.js":13,"./abstract.js":1}],6:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH */ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + Object.defineProperty(exports, "__esModule", { value: true }); -exports.isPrimitive = isPrimitive; -exports.isBoolean = isBoolean; -exports.isString = isString; -exports.isObject = isObject; -exports.isArray = isArray; -exports.isFunction = isFunction; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { - return _namespace.Monster; + return _abstract.Monster; } }); +exports.IsObject = void 0; -var _namespace = require("../namespace.js"); +var _abstract = require("./abstract.js"); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +var _is = require("../types/is.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * checks whether the value passed is a primitive (string, number, boolean or symbol) * - * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isPrimitive('2')) // ↦ false - * console.log(Monster.Types.isPrimitive([])) // ↦ true + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new Monster.Constraint.IsObject()) * </script> * ``` * @@ -506,44 +523,99 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isPrimitive('2')) // ↦ true - * console.log(isPrimitive([])) // ↦ false + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new IsObject()) * </script> * ``` - * - * @param {*} value - * @returns {boolean} - * @since 1.0.0 + * + * @since 1.3.0 * @copyright schukai GmbH - * @memberOf Monster/Types + * @memberOf Monster/Constraints */ -function isPrimitive(value) { - var type; +var IsObject = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(IsObject, _AbstractConstraint); - if (value === undefined || value === null) { - return true; + var _super = _createSuper(IsObject); + + function IsObject() { + _classCallCheck(this, IsObject); + + return _super.apply(this, arguments); } - type = _typeof(value); + _createClass(IsObject, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + if ((0, _is.isObject)(value)) { + return Promise.resolve(value); + } - if (type === 'string' || type === 'number' || type === 'boolean' || type === 'symbol') { - return true; + return Promise.reject(value); + } + }]); + + return IsObject; +}(_abstract.AbstractConstraint); + +exports.IsObject = IsObject; + +_abstract.Monster.assignToNamespace('Monster.Constraints', IsObject); + +},{"../types/is.js":13,"./abstract.js":1}],7:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstractoperator.Monster; } +}); +exports.OrOperator = void 0; + +var _abstractoperator = require("./abstractoperator.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - return false; -} /** - * checks whether the value passed is a boolean - * - * you can call the method via the monster namespace `Monster.Types.isBoolean()`. + * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isBoolean('2')) // ↦ false - * console.log(Monster.Types.isBoolean([])) // ↦ false - * console.log(Monster.Types.isBoolean(true)) // ↦ true + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); * </script> * ``` * @@ -551,77 +623,121 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isBoolean('2')) // ↦ false - * console.log(isBoolean([])) // ↦ false - * console.log(isBoolean(2>4)) // ↦ true + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); * </script> * ``` * - * @param {*} value - * @returns {boolean} - * @since 1.0.0 + * @since 1.3.0 * @copyright schukai GmbH - * @memberOf Monster/Types + * @memberOf Monster/Constraints */ +var OrOperator = /*#__PURE__*/function (_AbstractOperator) { + _inherits(OrOperator, _AbstractOperator); + var _super = _createSuper(OrOperator); -function isBoolean(value) { - if (value === true || value === false) { - return true; + function OrOperator() { + _classCallCheck(this, OrOperator); + + return _super.apply(this, arguments); } - return false; -} + _createClass(OrOperator, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + var self = this; + return new Promise(function (resolve, reject) { + var a, b; + self.operantA.isValid(value).then(function () { + resolve(); + })["catch"](function () { + a = false; + /** b has already been evaluated and was not true */ + + if (b === false) { + reject(); + } + }); + self.operantB.isValid(value).then(function () { + resolve(); + })["catch"](function () { + b = false; + /** b has already been evaluated and was not true */ + + if (a === false) { + reject(); + } + }); + }); + } + }]); + + return OrOperator; +}(_abstractoperator.AbstractOperator); + +exports.OrOperator = OrOperator; + +_abstractoperator.Monster.assignToNamespace('Monster.Constraints', OrOperator); + +},{"./abstractoperator.js":2}],8:[function(require,module,exports){ +'use strict'; /** - * checks whether the value passed is a string - * - * you can call the method via the monster namespace `Monster.Types.isString()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isString('2')) // ↦ true - * console.log(Monster.Types.isString([])) // ↦ false - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isString('2')) // ↦ true - * console.log(isString([])) // ↦ false - * </script> - * ``` - * - * @param {*} value - * @returns {boolean} - * @since 1.0.0 - * @copyright schukai GmbH - * @memberOf Monster/Types + * @author schukai GmbH */ +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function isString(value) { - if (value === undefined || typeof value !== 'string') { - return false; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; } +}); +exports.Valid = void 0; + +var _abstract = require("./abstract.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - return true; -} /** - * checks whether the value passed is a object + * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing. * - * you can call the method via the monster namespace `Monster.Types.isObject()`. + * you can call the method via the monster namespace `new Monster.Constraint.Valid()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isObject('2')) // ↦ false - * console.log(Monster.Types.isObject([])) // ↦ false - * console.log(Monster.Types.isObject({})) // ↦ true + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Monster.Constraint.Valid().then(()=>console.log(true)); * </script> * ``` * @@ -629,40 +745,76 @@ function isString(value) { * * ``` * <script type="module"> - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isObject('2')) // ↦ false - * console.log(isObject([])) // ↦ false + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Valid().then(()=>console.log(true)); * </script> * ``` * - * @param {*} value - * @returns {boolean} - * @since 1.0.0 + * @since 1.3.0 * @copyright schukai GmbH - * @memberOf Monster/Types + * @memberOf Monster/Constraints */ +var Valid = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(Valid, _AbstractConstraint); + var _super = _createSuper(Valid); -function isObject(value) { - if (isArray(value)) return false; - if (isPrimitive(value)) return false; + function Valid() { + _classCallCheck(this, Valid); - if (_typeof(value) === 'object') { - return true; + return _super.apply(this, arguments); } - return false; -} + _createClass(Valid, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.resolve(value); + } + }]); + + return Valid; +}(_abstract.AbstractConstraint); + +exports.Valid = Valid; + +_abstract.Monster.assignToNamespace('Monster.Constraints', Valid); + +},{"./abstract.js":1}],9:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; /** - * checks whether the value passed is a array + * @author schukai GmbH + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.random = random; +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); + +var _namespace = require("../namespace.js"); + +/** + * this function uses crypt and returns a random number. * - * you can call the method via the monster namespace `Monster.Types.isArray()`. + * you can call the method via the monster namespace `Monster.Math.random()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isArray('2')) // ↦ false - * console.log(Monster.Types.isArray([])) // ↦ true + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; + * console.log(Monster.Math.random(1,10)) // ↦ 5 * </script> * ``` * @@ -670,78 +822,1067 @@ function isObject(value) { * * ``` * <script type="module"> - * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isArray('2')) // ↦ false - * console.log(isArray([])) // ↦ true + * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; + * console.log(random(1,10)) // ↦ 5 * </script> * ``` * - * @param {*} value - * @returns {boolean} + * @param {number} min starting value of the definition set (default is 0) + * @param {number} max end value of the definition set (default is 1000000000) + * @returns {number} + * @memberOf Monster/Math + * @since 1.0.0 * @copyright schukai GmbH - * @memberOf Monster/Types */ +function random(min, max) { + if (min === undefined) { + min = 0; + } + if (max === undefined) { + max = MAX; + } -function isArray(value) { - if (Array.isArray(value)) { - return true; + if (max < min) { + throw new Error("max must be greater than min"); } - return false; + return Math.round(create(min, max)); } + +var MAX = 1000000000; + +Math.log2 = Math.log2 || function (n) { + return Math.log(n) / Math.log(2); +}; /** - * checks whether the value passed is a function - * - * you can call the method via the monster namespace `Monster.Types.isFunction()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(Monster.Types.isFunction(()=>{})) // ↦ true - * console.log(Monster.Types.isFunction('2')) // ↦ false - * console.log(Monster.Types.isFunction([])) // ↦ false - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; - * console.log(isFunction(()=>{})) // ↦ true - * console.log(isFunction('2')) // ↦ false - * console.log(isFunction([])) // ↦ false - * </script> - * ``` * - * @param {*} value - * @returns {boolean} - * @since 1.0.0 - * @copyright schukai GmbH - * @memberOf Monster/Types + * @param min + * @param max + * @returns {*} + * @private */ -function isFunction(value) { - if (isArray(value)) return false; - if (isPrimitive(value)) return false; +function create(min, max) { + var crypt; - if (typeof value === 'function') { - return true; + if (typeof global !== "undefined") { + var _global, _global2; + + crypt = ((_global = global) === null || _global === void 0 ? void 0 : _global['crypto']) || ((_global2 = global) === null || _global2 === void 0 ? void 0 : _global2['msCrypto']); + } else { + crypt = typeof crypto !== "undefined" ? crypto : undefined; } - return false; + if (typeof crypt === "undefined") { + throw new Error("missing crypt"); + } + + var rval = 0; + var range = max - min; + + if (range < 2) { + return min; + } + + var bitsNeeded = Math.ceil(Math.log2(range)); + + if (bitsNeeded > 53) { + throw new Error("we cannot generate numbers larger than 53 bits."); + } + + var bytesNeeded = Math.ceil(bitsNeeded / 8); + var mask = Math.pow(2, bitsNeeded) - 1; + var byteArray = new Uint8Array(bytesNeeded); + crypt.getRandomValues(byteArray); + var p = (bytesNeeded - 1) * 8; + + for (var i = 0; i < bytesNeeded; i++) { + rval += byteArray[i] * Math.pow(2, p); + p -= 8; + } + + rval = rval & mask; + + if (rval >= range) { + return create(min, max); + } + + return min + rval; } -_namespace.Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction); +_namespace.Monster.assignToNamespace('Monster.Math', random); -},{"../namespace.js":3}],6:[function(require,module,exports){ -'use strict'; +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../namespace.js":11}],10:[function(require,module,exports){ /** + * @license + * Copyright 2021 schukai GmbH + * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL * @author schukai GmbH */ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); + +var _namespace = require("./namespace.js"); + +require("./types/id.js"); + +require("./types/is.js"); + +require("./types/object.js"); + +require("./types/observer.js"); + +require("./types/observerlist.js"); + +require("./types/proxyobserver.js"); + +require("./types/version.js"); + +require("./types/tokenlist.js"); + +require("./types/validate.js"); + +require("./math/random.js"); + +require("./util/clone.js"); + +require("./util/comparator.js"); + +require("./util/freeze.js"); + +require("./constraints/abstract.js"); + +require("./constraints/andoperator.js"); + +require("./constraints/invalid.js"); + +require("./constraints/isarray.js"); + +require("./constraints/isobject.js"); + +require("./constraints/abstractoperator.js"); + +require("./constraints/oroperator.js"); + +require("./constraints/valid.js"); + +_namespace.Monster.Util.deepFreeze(_namespace.Monster); + +},{"./constraints/abstract.js":1,"./constraints/abstractoperator.js":2,"./constraints/andoperator.js":3,"./constraints/invalid.js":4,"./constraints/isarray.js":5,"./constraints/isobject.js":6,"./constraints/oroperator.js":7,"./constraints/valid.js":8,"./math/random.js":9,"./namespace.js":11,"./types/id.js":12,"./types/is.js":13,"./types/object.js":14,"./types/observer.js":15,"./types/observerlist.js":16,"./types/proxyobserver.js":17,"./types/tokenlist.js":18,"./types/validate.js":19,"./types/version.js":20,"./util/clone.js":21,"./util/comparator.js":22,"./util/freeze.js":23}],11:[function(require,module,exports){ +'use strict'; +/** + * @namespace Monster + * @author schukai GmbH + */ + +/** + * namespace class objects form the basic framework of the namespace administration. + * + * all functions, classes and objects of the library hang within the namespace tree. + * + * via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. + * + * @memberOf Monster + + * @copyright schukai GmbH + * @since 1.0.0 + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.assignToNamespace = assignToNamespace; +exports.Monster = void 0; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var Namespace = /*#__PURE__*/function () { + /** + * + * @param namespace + * @param obj + */ + function Namespace(namespace) { + _classCallCheck(this, Namespace); + + if (namespace === undefined || typeof namespace !== 'string') { + throw new Error("namespace is not a string"); + } + + this.namespace = namespace; + } + /** + * + * @returns {string} + */ + + + _createClass(Namespace, [{ + key: "getNamespace", + value: function getNamespace() { + return this.namespace; + } + /** + * + * @returns {string} + */ + + }, { + key: "toString", + value: function toString() { + return this.getNamespace(); + } + }]); + + return Namespace; +}(); +/** + * + * @type {Namespace} + * @global + */ + + +var Monster = new Namespace("Monster"); +/** + * + */ + +exports.Monster = Monster; +assignToNamespace('Monster', assignToNamespace); +/** + * To expand monster, the `Monster.assignToNamespace()` method can be used. + * + * you must call the method in the monster namespace. this allows you to mount your own classes, objects and functions into the namespace. + * + * To avoid confusion and so that you do not accidentally overwrite existing functions, you should use the custom namespace `X`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/namespace.js'; + * function hello() { + * console.log('Hello World!'); + * } + * Monster.assignToNamespace("Monster.X",hello) + * Monster.X.hello(); // ↦ Hello World! + * </script> + * + * ``` + * + * @param ns + * @param obj + * @memberOf Monster + + */ + +function assignToNamespace(ns) { + var current = namespaceFor(ns.split(".")); + + for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) { + current[objectName(i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1])] = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1]; + } +} +/** + * + * @param fn + * @returns {string|*} + * @private + */ + + +function objectName(fn) { + try { + if (typeof fn !== 'function') { + throw new Error("the first argument is not a function or class."); + } + + if (fn.hasOwnProperty('name')) { + return fn.name; + } + + if ("function" === typeof fn.toString) { + var s = fn.toString(); + var f = s.match(/^\s*function\s+([^\s(]+)/); + + if (Array.isArray(f) && typeof f[1] === 'string') { + return f[1]; + } + + var c = s.match(/^\s*class\s+([^\s(]+)/); + + if (Array.isArray(c) && typeof c[1] === 'string') { + return c[1]; + } + } + } catch (e) { + throw new Error("exception " + e); + } + + throw new Error("the name of the class or function cannot be resolved."); +} +/** + * + * @param parts + * @returns {Namespace} + * @private + */ + + +function namespaceFor(parts) { + var space = Monster, + ns = 'Monster'; + + for (var i = 0; i < parts.length; i++) { + if ("Monster" === parts[i]) { + continue; + } + + ns += '.' + parts[i]; + + if (!space.hasOwnProperty(parts[i])) { + space[parts[i]] = new Namespace(ns); + } + + space = space[parts[i]]; + } + + return space; +} + +},{}],12:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); +exports.ID = void 0; + +var _namespace = require("../namespace.js"); + +var _random = require("../math/random.js"); + +require("../types/object.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var internalCounter = 0; +/** + * id class + * + * you can call the method via the monster namespace `new Monster.Types.ID()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Monster.Types.ID()) + * console.log(new Monster.Types.ID()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new ID()) + * console.log(new ID()) + * </script> + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + +var ID = /*#__PURE__*/function (_Monster$Types$Object) { + _inherits(ID, _Monster$Types$Object); + + var _super = _createSuper(ID); + + /** + * create new object + */ + function ID() { + var _this; + + _classCallCheck(this, ID); + + _this = _super.call(this); + internalCounter += 1; + _this.id = global.btoa((0, _random.random)(1, 10000)).replace(/=/g, '') + /** No numbers at the beginning of the ID, because of possible problems with DOM */ + .replace(/^[0-9]+/, 'X') + internalCounter; + return _this; + } + + _createClass(ID, [{ + key: "toString", + value: function toString() { + return this.id; + } + }]); + + return ID; +}(_namespace.Monster.Types.Object); + +exports.ID = ID; + +_namespace.Monster.assignToNamespace('Monster.Types', ID); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../math/random.js":9,"../namespace.js":11,"../types/object.js":14}],13:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isPrimitive = isPrimitive; +exports.isBoolean = isBoolean; +exports.isString = isString; +exports.isObject = isObject; +exports.isArray = isArray; +exports.isFunction = isFunction; +exports.isIterable = isIterable; +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); + +var _namespace = require("../namespace.js"); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/** + * with this function you can check if a value is iterable + * + * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isIterable(null)) // ↦ false + * console.log(Monster.Types.isIterable('hello')) // ↦ true + * console.log(Monster.Types.isIterable([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isIterable(null)) // ↦ false + * console.log(isIterable('hello')) // ↦ true + * console.log(isIterable([])) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +function isIterable(value) { + if (value === undefined) return false; + if (value === null) return false; + return typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function'; +} +/** + * checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol) + * + * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isPrimitive('2')) // ↦ false + * console.log(Monster.Types.isPrimitive([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isPrimitive('2')) // ↦ true + * console.log(isPrimitive([])) // ↦ false + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isPrimitive(value) { + var type; + + if (value === undefined || value === null || value === NaN) { + return true; + } + + type = _typeof(value); + + if (type === 'string' || type === 'number' || type === 'boolean' || type === 'symbol') { + return true; + } + + return false; +} +/** + * checks whether the value passed is a boolean + * + * you can call the method via the monster namespace `Monster.Types.isBoolean()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isBoolean('2')) // ↦ false + * console.log(Monster.Types.isBoolean([])) // ↦ false + * console.log(Monster.Types.isBoolean(true)) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isBoolean('2')) // ↦ false + * console.log(isBoolean([])) // ↦ false + * console.log(isBoolean(2>4)) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isBoolean(value) { + if (value === true || value === false) { + return true; + } + + return false; +} +/** + * checks whether the value passed is a string + * + * you can call the method via the monster namespace `Monster.Types.isString()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isString('2')) // ↦ true + * console.log(Monster.Types.isString([])) // ↦ false + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isString('2')) // ↦ true + * console.log(isString([])) // ↦ false + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isString(value) { + if (value === undefined || typeof value !== 'string') { + return false; + } + + return true; +} +/** + * checks whether the value passed is a object + * + * you can call the method via the monster namespace `Monster.Types.isObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isObject('2')) // ↦ false + * console.log(Monster.Types.isObject([])) // ↦ false + * console.log(Monster.Types.isObject({})) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isObject('2')) // ↦ false + * console.log(isObject([])) // ↦ false + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isObject(value) { + if (isArray(value)) return false; + if (isPrimitive(value)) return false; + + if (_typeof(value) === 'object') { + return true; + } + + return false; +} +/** + * checks whether the value passed is a array + * + * you can call the method via the monster namespace `Monster.Types.isArray()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isArray('2')) // ↦ false + * console.log(Monster.Types.isArray([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isArray('2')) // ↦ false + * console.log(isArray([])) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isArray(value) { + if (Array.isArray(value)) { + return true; + } + + return false; +} +/** + * checks whether the value passed is a function + * + * you can call the method via the monster namespace `Monster.Types.isFunction()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isFunction(()=>{})) // ↦ true + * console.log(Monster.Types.isFunction('2')) // ↦ false + * console.log(Monster.Types.isFunction([])) // ↦ false + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isFunction(()=>{})) // ↦ true + * console.log(isFunction('2')) // ↦ false + * console.log(isFunction([])) // ↦ false + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + + +function isFunction(value) { + if (isArray(value)) return false; + if (isPrimitive(value)) return false; + + if (typeof value === 'function') { + return true; + } + + return false; +} + +_namespace.Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable); + +},{"../namespace.js":11}],14:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); +exports.Object = void 0; + +var _namespace = require("../namespace.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +/** + * This is the base class from which all monster classes are derived. + * + * you can call the method via the monster namespace `new Monster.Types.Object()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; + * console.log(new Monster.Types.Object()) + * console.log(new Monster.Types.Object()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; + * console.log(new Object()) + * console.log(new Object()) + * </script> + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +var _Object = /*#__PURE__*/function () { + /** + * + */ + function Object() { + _classCallCheck(this, Object); + } + /** + * + * @returns {string} + */ + + + _createClass(Object, [{ + key: "toString", + value: function toString() { + return JSON.stringify(this); + } + }]); + + return Object; +}(); + +exports.Object = _Object; + +_namespace.Monster.assignToNamespace('Monster.Types', _Object); + +},{"../namespace.js":11}],15:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); +exports.Observer = void 0; + +var _namespace = require("../namespace.js"); + +var _tokenlist = require("../types/tokenlist.js"); + +var _is = require("../types/is.js"); + +require("../types/object.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * an observer manages a callback function + * + * you can call the method via the monster namespace `new Monster.Types.Observer()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; + * console.log(new Monster.Types.Observer()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; + * console.log(Observer()) + * </script> + * ``` + * + * the update method is called with the subject object as this pointer. for this reason the callback should not + * be an arrow function, because it gets the this pointer of its own context. + * + * ``` + * <script> + * Observer(()=>{ + * // this is not subject + * }) + * + * Observer(function() { + * // this is subject + * }) + * </script> + * ``` + * + * additional arguments can be passed to the callback. to do this, simply specify them. + * + * ``` + * <script> + * Observer(function(a, b, c) { + * console.log(a, b, c); // ↦ "a", 2, true + * }, "a", 2, true) + * </script> + * ``` + * + * the callback function must have as many parameters as arguments are given. + * + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +var Observer = /*#__PURE__*/function (_Monster$Types$Object) { + _inherits(Observer, _Monster$Types$Object); + + var _super = _createSuper(Observer); + + /** + * + * @param {function} callback + * @param {*} args + */ + function Observer(callback) { + var _this; + + _classCallCheck(this, Observer); + + _this = _super.call(this); + + if (typeof callback !== 'function') { + throw new Error("observer callback must be a function"); + } + + _this.callback = callback; + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + _this.arguments = args; + _this.tags = new _tokenlist.TokenList(); + return _this; + } + /** + * + * @param {string} tag + * @returns {Observer} + */ + + + _createClass(Observer, [{ + key: "addTag", + value: function addTag(tag) { + this.tags.add(tag); + return this; + } + /** + * + * @param {string} tag + * @returns {Observer} + */ + + }, { + key: "removeTag", + value: function removeTag(tag) { + this.tags.remove(tag); + return this; + } + /** + * + * @returns {Array} + */ + + }, { + key: "getTags", + value: function getTags() { + return this.tags.entries(); + } + /** + * + * @param {string} tag + * @returns {boolean} + */ + + }, { + key: "hasTag", + value: function hasTag(tag) { + return this.tags.contains(tag); + } + /** + * + * @param {object} subject + * @returns {Promise} + */ + + }, { + key: "update", + value: function update(subject) { + var self = this; + return new Promise(function (resolve, reject) { + if (!(0, _is.isObject)(subject)) { + reject("subject must be an object"); + } + + var result = self.callback.apply(subject, self.arguments); + resolve(result); + }); + } + }]); + + return Observer; +}(_namespace.Monster.Types.Object); + +exports.Observer = Observer; + +_namespace.Monster.assignToNamespace('Monster.Types', Observer); + +},{"../namespace.js":11,"../types/is.js":13,"../types/object.js":14,"../types/tokenlist.js":18}],16:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true @@ -752,71 +1893,149 @@ Object.defineProperty(exports, "Monster", { return _namespace.Monster; } }); -exports.Object = void 0; +exports.ObserverList = void 0; var _namespace = require("../namespace.js"); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +require("../types/object.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * With the help of the ObserverList class, observer can be managed. + * + * you can call the method via the monster namespace `new Monster.Types.ObserverList()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; + * console.log(new Monster.Types.ObserverList()) + * console.log(new Monster.Types.ObserverList()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; + * console.log(ObserverList()) + * console.log(ObserverList()) + * </script> + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +var ObserverList = /*#__PURE__*/function (_Monster$Types$Object) { + _inherits(ObserverList, _Monster$Types$Object); + + var _super = _createSuper(ObserverList); + + function ObserverList() { + var _this; + + _classCallCheck(this, ObserverList); + + _this = _super.call(this); + _this.observers = []; + return _this; + } + + _createClass(ObserverList, [{ + key: "attach", + value: function attach(observer) { + checkIsObserver(observer); + this.observers.push(observer); + return this; + } + }, { + key: "detach", + value: function detach(observer) { + checkIsObserver(observer); + var i = 0, + l = this.observers.length; + + for (; i < l; i++) { + if (this.observers[i] === observer) { + this.observers.splice(i, 1); + } + } + + return this; + } + }, { + key: "contains", + value: function contains(observer) { + checkIsObserver(observer); + var i = 0, + l = this.observers.length; + + for (; i < l; i++) { + if (this.observers[i] === observer) { + return true; + } + } + + return false; + } + }, { + key: "notify", + value: function notify(subject) { + var pomises = []; + var i = 0, + l = this.observers.length; -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + for (; i < l; i++) { + pomises.push(this.observers[i].update(subject)); + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + return Promise.all(pomises); + } + }]); + return ObserverList; +}(_namespace.Monster.Types.Object); /** - * This is the base class from which all monster classes are derived. - * - * you can call the method via the monster namespace `new Monster.Types.Object()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; - * console.log(new Monster.Types.Object()) - * console.log(new Monster.Types.Object()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; - * console.log(new Object()) - * console.log(new Object()) - * </script> - * ``` - * - * @since 1.0.0 - * @copyright schukai GmbH - * @memberOf Monster/Types + * + * @param {Monster.Types.Observer} observer + * @returns {boolean} + * @private */ -var _Object = /*#__PURE__*/function () { - /** - * - */ - function Object() { - _classCallCheck(this, Object); - } - /** - * - * @returns {string} - */ - _createClass(Object, [{ - key: "toString", - value: function toString() { - return JSON.stringify(this); - } - }]); +exports.ObserverList = ObserverList; - return Object; -}(); +function checkIsObserver(observer) { + if (!(observer instanceof _namespace.Monster.Types.Observer)) { + throw new Error("argument must be instance of observer"); + } -exports.Object = _Object; + return true; +} -_namespace.Monster.assignToNamespace('Monster.Types', _Object); +_namespace.Monster.assignToNamespace('Monster.Types', ObserverList); -},{"../namespace.js":3}],7:[function(require,module,exports){ +},{"../namespace.js":11,"../types/object.js":14}],17:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -833,11 +2052,19 @@ Object.defineProperty(exports, "Monster", { return _namespace.Monster; } }); -exports.Observer = void 0; +exports.ProxyObserver = void 0; var _namespace = require("../namespace.js"); -require("../types/object.js"); +var _object = require("../types/object.js"); + +var _validate = require("./validate.js"); + +var _observerlist = require("./observerlist.js"); + +var _observer = require("./observer.js"); + +var _is = require("./is.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -859,6 +2086,13 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +/** + * store proxy objects + * + * @type {WeakSet<object>} + */ +var proxySet = new WeakSet(); // language=JavaScript + /** * an observer manages a callback function * @@ -866,9 +2100,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(new Monster.Types.Observer()) - * console.log(new Monster.Types.Observer()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new Monster.Types.ProxyObserver()) * </script> * ``` * @@ -876,88 +2109,206 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(Observer()) - * console.log(Observer()) + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new ProxyObserver()) * </script> * ``` * + * with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. + * + * this also applies to nested objects. + * + * ```javascript + * const o = new Observer(function () { + * if (isObject(this) && this instanceof ProxyObserver) { + * // do something (this ist ProxyObserver) + * const subject = this.getSubject(); + * } + * ) + * + * let realSubject = { + * a: { + * b: { + * c: true + * }, + * d: 5 + * } + * + * + * const p = new ProxyObserver(realSubject); + * p.attachObserver(o); + * const s = p.getSubject(); + * s.a.b.c = false; + * ``` + * * @since 1.0.0 * @copyright schukai GmbH * @memberOf Monster/Types */ -var Observer = /*#__PURE__*/function (_Monster$Types$Object) { - _inherits(Observer, _Monster$Types$Object); - var _super = _createSuper(Observer); +var ProxyObserver = /*#__PURE__*/function (_Object) { + _inherits(ProxyObserver, _Object); - function Observer(callback) { + var _super = _createSuper(ProxyObserver); + + /** + * + * @param {object} object + */ + function ProxyObserver(object) { var _this; - _classCallCheck(this, Observer); + _classCallCheck(this, ProxyObserver); _this = _super.call(this); + (0, _validate.validateObject)(object); + _this.realSubject = object; + _this.subject = new Proxy(object, getHandler.call(_assertThisInitialized(_this))); + proxySet.add(_this.subject); + _this.observers = new _observerlist.ObserverList(); + return _this; + } + /** + * get the real object + * + * changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later. + * + * @returns {object} + */ - if (typeof callback !== 'function') { - throw new Error("observer callback must be a function"); - } - - _this.callback = callback; - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; + _createClass(ProxyObserver, [{ + key: "getSubject", + value: function getSubject() { + return this.subject; } + /** + * get the proxied object + * + * @returns {object} + */ - _this.arguments = args; - _this.tags = new Set(); - return _this; - } - - _createClass(Observer, [{ - key: "addTag", - value: function addTag(tag) { - this.tags.add(tag); - return this; + }, { + key: "getRealSubject", + value: function getRealSubject() { + return this.realSubject; } + /** + * attach a new observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + }, { - key: "removeTag", - value: function removeTag(tag) { - this.tags["delete"](tag); + key: "attachObserver", + value: function attachObserver(observer) { + this.observers.attach(observer); return this; } + /** + * detach a observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + }, { - key: "getTags", - value: function getTags() { - return this.tags; + key: "detachObserver", + value: function detachObserver(observer) { + this.observers.detach(observer); + return this; } + /** + * notify all observer + * + * @returns {ProxyObserver} + */ + }, { - key: "hasTag", - value: function hasTag(tag) { - return this.tags.has(tag); + key: "notifyObservers", + value: function notifyObservers() { + this.observers.notify(this); + return this; } - }, { - key: "update", - value: function update(subject) { - var self = this; - return new Promise(function (resolve, reject) { - if (!(subject instanceof Object)) { - reject("subject must be an object"); - } + /** + * @param {Observer} observer + * @returns {ProxyObserver} + */ - var result = self.callback.apply(subject, self.arguments); - resolve(result); - }); + }, { + key: "containsObserver", + value: function containsObserver(observer) { + return this.observers.contains(observer); } }]); - return Observer; -}(_namespace.Monster.Types.Object); + return ProxyObserver; +}(Object); -exports.Observer = Observer; +exports.ProxyObserver = ProxyObserver; -_namespace.Monster.assignToNamespace('Monster.Types', Observer); +_namespace.Monster.assignToNamespace('Monster.Types', ProxyObserver); + +/** + * + * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}} + * @private + * @see {@link https://gitlab.schukai.com/-/snippets/49} + */ +function getHandler() { + var proxy = this; // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots -},{"../namespace.js":3,"../types/object.js":6}],8:[function(require,module,exports){ + var handler = { + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + get: function get(target, property, receiver) { + var prop = target === null || target === void 0 ? void 0 : target[property]; // return if property not found + + if (prop === undefined) { + return undefined; + } // set value as proxy if object or array + + + if ((0, _is.isArray)(prop) || (0, _is.isObject)(prop) && !proxySet.has(prop)) { + target[property] = new Proxy(prop, handler); + proxySet.add(prop); + } + + return target[property]; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + set: function set(target, property, value, receiver) { + target[property] = value; + proxy.observers.notify(proxy); + return true; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + deleteProperty: function deleteProperty(target, property) { + if (property in target) { + delete target[property]; + proxy.observers.notify(proxy); + return true; + } + + return false; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + defineProperty: function defineProperty(target, property, descriptor) { + var result = Reflect.defineProperty(target, property, descriptor); + proxy.observers.notify(proxy); + return parseURLToResultingURLRecord(); + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v + setPrototypeOf: function setPrototypeOf(target, prototype) { + var result = Reflect.setPrototypeOf(object1, prototype); + proxy.observers.notify(proxy); + return result; + } + }; + return handler; +} + +},{"../namespace.js":11,"../types/object.js":14,"./is.js":13,"./observer.js":15,"./observerlist.js":16,"./validate.js":19}],18:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -974,11 +2325,21 @@ Object.defineProperty(exports, "Monster", { return _namespace.Monster; } }); -exports.ObserverList = void 0; +exports.TokenList = void 0; var _namespace = require("../namespace.js"); -require("../types/object.js"); +var _object = require("../types/object.js"); + +var _is = require("../types/is.js"); + +var _validate = require("../types/validate.js"); + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -1001,15 +2362,17 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * With the help of the ObserverList class, observer can be managed. + * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). * - * you can call the method via the monster namespace `new Monster.Types.ObserverList()`. + * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. + * + * you can call the method via the monster namespace `new Monster.Types.TokenList()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; - * console.log(new Monster.Types.ObserverList()) - * console.log(new Monster.Types.ObserverList()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new Monster.Types.TokenList("myclass row")) + * console.log(new Monster.Types.TokenList("myclass row")) * </script> * ``` * @@ -1017,106 +2380,380 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; - * console.log(ObserverList()) - * console.log(ObserverList()) + * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new TokenList("myclass row")) + * console.log(new TokenList("myclass row")) * </script> * ``` * - * @since 1.0.0 + * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * + * ``` + * console.log(typeof new TokenList("myclass row")[Symbol.iterator]); // "function" + * ``` + * + * + * @since 1.2.0 * @copyright schukai GmbH * @memberOf Monster/Types */ -var ObserverList = /*#__PURE__*/function (_Monster$Types$Object) { - _inherits(ObserverList, _Monster$Types$Object); +var TokenList = /*#__PURE__*/function (_Object) { + _inherits(TokenList, _Object); - var _super = _createSuper(ObserverList); + var _super = _createSuper(TokenList); - function ObserverList() { + /** + * + * @param {array|string|iteratable} init + */ + function TokenList(init) { var _this; - _classCallCheck(this, ObserverList); + _classCallCheck(this, TokenList); + + _this = _super.call(this); + _this.tokens = new Set(); + + if (typeof init !== "undefined") { + _this.add(init); + } + + return _this; + } + /** + * Iterator protocol + * + * @returns {Symbol.iterator} + */ + + + _createClass(TokenList, [{ + key: "getIterator", + value: function getIterator() { + return this[Symbol.iterator](); + } + /** + * Iterator + * + * @returns {{next: ((function(): ({value: *, done: boolean}))|*)}} + */ + + }, { + key: Symbol.iterator, + value: function value() { + // Use a new index for each iterator. This makes multiple + // iterations over the iterable safe for non-trivial cases, + // such as use of break or nested looping over the same iterable. + var index = 0; + var entries = this.entries(); + return { + next: function next() { + if (index < entries.length) { + return { + value: entries === null || entries === void 0 ? void 0 : entries[index++], + done: false + }; + } else { + return { + done: true + }; + } + } + }; + } + /** + * Returns true if it contains token, otherwise false + * + * ``` + * new TokenList("start middle end").contains('start')); // ↦ true + * new TokenList("start middle end").contains('end')); // ↦ true + * new TokenList("start middle end").contains('xyz')); // ↦ false + * new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true + * new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + */ + + }, { + key: "contains", + value: function contains(value) { + var _this2 = this; + + if ((0, _is.isString)(value)) { + value = value.trim(); + var counter = 0; + value.split(" ").forEach(function (token) { + if (_this2.tokens.has(token.trim()) === false) return false; + counter++; + }); + return counter > 0 ? true : false; + } + + if ((0, _is.isIterable)(value)) { + var _counter = 0; + + var _iterator = _createForOfIteratorHelper(value), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var token = _step.value; + (0, _validate.validateString)(token); + if (this.tokens.has(token.trim()) === false) return false; + _counter++; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return _counter > 0 ? true : false; + } + + return false; + } + /** + * add tokens + * + * ``` + * new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" + * new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" + * new TokenList().add(undefined); // ↦ add nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ - _this = _super.call(this); - _this.observers = []; - return _this; - } + }, { + key: "add", + value: function add(value) { + var _this3 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + _this3.tokens.add(token.trim()); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator2 = _createForOfIteratorHelper(value), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var token = _step2.value; + (0, _validate.validateString)(token); + this.tokens.add(token.trim()); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } - _createClass(ObserverList, [{ - key: "attach", - value: function attach(observer) { - checkIsObserver(observer); - this.observers.push(observer); return this; } + /** + * remove all tokens + * + * @returns {TokenList} + */ + }, { - key: "detach", - value: function detach(observer) { - checkIsObserver(observer); - var i = 0, - l = this.observers.length; + key: "clear", + value: function clear() { + this.tokens.clear(); + return this; + } + /** + * Removes token + * + * ``` + * new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(undefined); // ↦ remove nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ - for (; i < l; i++) { - if (this.observers[i] === observer) { - this.observers.splice(i, 1); + }, { + key: "remove", + value: function remove(value) { + var _this4 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + _this4.tokens["delete"](token.trim()); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator3 = _createForOfIteratorHelper(value), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var token = _step3.value; + (0, _validate.validateString)(token); + this.tokens["delete"](token.trim()); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); } return this; } + /** + * this method replaces a token with a new token. + * + * if the passed token exists, it is replaced with newToken and TokenList is returned. + * if the token does not exist, newToken is not set and TokenList is returned. + * + * @param {string} token + * @param {string} newToken + * @returns {TokenList} + */ + }, { - key: "contains", - value: function contains(observer) { - checkIsObserver(observer); - var i = 0, - l = this.observers.length; + key: "replace", + value: function replace(token, newToken) { + (0, _validate.validateString)(token); + (0, _validate.validateString)(newToken); - for (; i < l; i++) { - if (this.observers[i] === observer) { - return true; + if (!this.contains(token)) { + return this; + } + + var a = Array.from(this.tokens); + var i = a.indexOf(token); + if (i === -1) return this; + a.splice(i, 1, newToken); + this.tokens = new Set(); + this.add(a); + return this; + } + /** + * Removes token from string. If token doesn't exist it's added. + * + * ``` + * new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" + * new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" + * new TokenList().toggle(undefined); // ↦ nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + * @throws {TypeError} unsupported value + */ + + }, { + key: "toggle", + value: function toggle(value) { + var _this5 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + toggleValue.call(_this5, token); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator4 = _createForOfIteratorHelper(value), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var token = _step4.value; + toggleValue.call(this, token); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); } - return false; + return this; } + /** + * returns an array with all tokens + * + * @returns {array} + */ + }, { - key: "notify", - value: function notify(subject) { - var pomises = []; - var i = 0, - l = this.observers.length; + key: "entries", + value: function entries() { + return Array.from(this.tokens); + } + /** + * executes the provided function with each value of the set + * + * @param {function} callback + * @returns {TokenList} + */ - for (; i < l; i++) { - pomises.push(this.observers[i].update(subject)); - } + }, { + key: "forEach", + value: function forEach(callback) { + (0, _validate.validateFunction)(callback); + this.tokens.forEach(callback); + return this; + } + /** + * returns the individual tokens separated by a blank character + * + * @returns {string} + */ - return Promise.all(pomises); + }, { + key: "toString", + value: function toString() { + return this.entries().join(' '); } }]); - return ObserverList; -}(_namespace.Monster.Types.Object); + return TokenList; +}(Object); /** - * - * @param {Monster.Types.Observer} observer - * @returns {boolean} * @private + * @param token + * @returns {toggleValue} + * @throws {Error} must be called with TokenList.call */ -exports.ObserverList = ObserverList; +exports.TokenList = TokenList; -function checkIsObserver(observer) { - if (!(observer instanceof _namespace.Monster.Types.Observer)) { - throw new Error("argument must be instance of observer"); +function toggleValue(token) { + if (!(this instanceof TokenList)) throw Error("must be called with TokenList.call"); + (0, _validate.validateString)(token); + token = token.trim(); + + if (this.contains(token)) { + this.remove(token); + return this; } - return true; + this.add(token); + return this; } -_namespace.Monster.assignToNamespace('Monster.Types', ObserverList); +_namespace.Monster.assignToNamespace('Monster.Types', TokenList); -},{"../namespace.js":3,"../types/object.js":6}],9:[function(require,module,exports){ +},{"../namespace.js":11,"../types/is.js":13,"../types/object.js":14,"../types/validate.js":19}],19:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -1131,6 +2768,7 @@ exports.validateString = validateString; exports.validateObject = validateObject; exports.validateArray = validateArray; exports.validateFunction = validateFunction; +exports.validateIterable = validateIterable; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { @@ -1149,7 +2787,45 @@ var _is = require("../types/is.js"); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError + * console.log(Monster.Types.validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(validateIterable('2')) // ↦ TypeError + * console.log(validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * @param {*} value + * @return {undefined} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + * @throws {TypeError} value is not a primitive + * @see {@link isPrimitive} + * @see {@link Monster/Types/isPrimitive} + * @see {@link Monster/Types#isPrimitive} + */ +function validateIterable(value) { + if (!(0, _is.isIterable)(value)) { + throw new TypeError('value is not iterable'); + } +} +/** + * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. + * + * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError * </script> @@ -1159,7 +2835,7 @@ var _is = require("../types/is.js"); * * ``` * <script type="module"> - * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validatePrimitive('2')) // ↦ undefined * console.log(validatePrimitive([])) // ↦ TypeError * </script> @@ -1175,6 +2851,8 @@ var _is = require("../types/is.js"); * @see {@link Monster/Types/isPrimitive} * @see {@link Monster/Types#isPrimitive} */ + + function validatePrimitive(value) { if (!(0, _is.isPrimitive)(value)) { throw new TypeError('value is not a primitive'); @@ -1187,7 +2865,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError @@ -1198,7 +2876,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateBoolean(false)) // ↦ undefined * console.log(validateBoolean('2')) // ↦ TypeError * console.log(validateBoolean([])) // ↦ TypeError @@ -1227,7 +2905,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateString('2')) // ↦ undefined * console.log(Monster.Types.validateString([])) // ↦ TypeError * </script> @@ -1237,7 +2915,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateString('2')) // ↦ undefined * console.log(validateString([])) // ↦ TypeError * </script> @@ -1265,7 +2943,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateObject({})) // ↦ undefined * console.log(Monster.Types.validateObject('2')) // ↦ TypeError * console.log(Monster.Types.validateObject([])) // ↦ TypeError @@ -1276,7 +2954,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateObject({})) // ↦ undefined * console.log(validateObject('2')) // ↦ TypeError * console.log(validateObject([])) // ↦ TypeError @@ -1304,7 +2982,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateArray('2')) // ↦ TypeError * console.log(Monster.Types.validateArray([])) // ↦ undefined * </script> @@ -1314,7 +2992,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateArray('2')) // ↦ TypeError * console.log(validateArray([])) // ↦ undefined * </script> @@ -1341,7 +3019,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError * console.log(Monster.Types.validateFunction([])) // ↦ TypeError @@ -1352,7 +3030,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateFunction(()=>{})) // ↦ undefined * console.log(validateFunction('2')) // ↦ TypeError * console.log(validateFunction([])) // ↦ TypeError @@ -1374,9 +3052,9 @@ function validateFunction(value) { } } -_namespace.Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction); +_namespace.Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable); -},{"../namespace.js":3,"../types/is.js":5}],10:[function(require,module,exports){ +},{"../namespace.js":11,"../types/is.js":13}],20:[function(require,module,exports){ 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -1424,7 +3102,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 * </script> @@ -1434,7 +3112,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Version('1.2.3')) // ↦ 1.2.3 * console.log(new Version('1')) // ↦ 1.0.0 * </script> @@ -1577,7 +3255,7 @@ var monsterVersion; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(Monster.getVersion()) * console.log(Monster.getVersion()) * </script> @@ -1587,7 +3265,7 @@ var monsterVersion; * * ``` * <script type="module"> - * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(getVersion()) * console.log(getVersion()) * </script> @@ -1607,7 +3285,7 @@ function getVersion() { /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.1.0'); + monsterVersion = new Version('1.3.0'); /**#@-*/ return monsterVersion; @@ -1615,7 +3293,7 @@ function getVersion() { _namespace.Monster.assignToNamespace('Monster', getVersion); -},{"../namespace.js":3,"../types/object.js":6}],11:[function(require,module,exports){ +},{"../namespace.js":11,"../types/object.js":14}],21:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -1651,7 +3329,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(Monster.Util.clone({})) * </script> * ``` @@ -1660,7 +3338,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(clone({})) * </script> * ``` @@ -1776,7 +3454,229 @@ function cloneObject(obj) { _namespace.Monster.assignToNamespace('Monster.Util', clone); -},{"../namespace.js":3,"../types/is.js":5}],12:[function(require,module,exports){ +},{"../namespace.js":11,"../types/is.js":13}],22:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _object.Monster; + } +}); +exports.Comparator = void 0; + +var _object = require("../types/object.js"); + +var _is = require("../types/is.js"); + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * the comparator allows a comparison function to be abstracted. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Monster.Util.Comparator()) + * console.log(new Monster.Util.Comparator()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Util()) + * console.log(new Util()) + * </script> + * ``` + * + * the following are some examples of the application of the class. + * + * ``` + * new Comparator().lessThanOrEqual(2, 5) // ↦ true + * new Comparator().greaterThan(4, 2) // ↦ true + * new Comparator().equal(4, 4) // ↦ true + * new Comparator().equal(4, 5) // ↦ false + * ``` + * + * you can also pass your own comparison function, and thus define the comparison function. + * + * ``` + * new Comparator(function (a, b) { + * if (a.v === b.v) return 0; + * return a.v < b.v ? -1 : 1; + * }).equal({v: 2}, {v: 2}); // ↦ true + * ``` + * + * @since 1.3.0 + * @memberOf Monster/Util + */ +var Comparator = /*#__PURE__*/function (_Object) { + _inherits(Comparator, _Object); + + var _super = _createSuper(Comparator); + + /** + * create new comparator + * + * @param {function} callback + * @throw {TypeError} "unsupported type" + * @throw {TypeError} "impractical comparison" + */ + function Comparator(callback) { + var _this; + + _classCallCheck(this, Comparator); + + _this = _super.call(this); + + if ((0, _is.isFunction)(callback)) { + _this.compare = callback; + } else if (callback !== undefined) { + throw new TypeError("unsupported type"); + } else { + // default compare function + _this.compare = function (a, b) { + if (_typeof(a) !== _typeof(b)) { + throw new TypeError("impractical comparison"); + } + + if (a === b) { + return 0; + } + + return a < b ? -1 : 1; + }; + } + + return _this; + } + /** + * changes the order of the operators + * + * @return {Comparator} + */ + + + _createClass(Comparator, [{ + key: "reverse", + value: function reverse() { + var original = this.compare; + + this.compare = function (a, b) { + return original(b, a); + }; + + return this; + } + /** + * Checks if two variables are equal. + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "equal", + value: function equal(a, b) { + return this.compare(a, b) === 0; + } + /** + * Checks if variable `a` is greater than `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "greaterThan", + value: function greaterThan(a, b) { + return this.compare(a, b) > 0; + } + /** + * Checks if variable `a` is greater than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "greaterThanOrEqual", + value: function greaterThanOrEqual(a, b) { + return this.greaterThan(a, b) || this.equal(a, b); + } + /** + * Checks if variable `a` is less than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "lessThanOrEqual", + value: function lessThanOrEqual(a, b) { + return this.lessThan(a, b) || this.equal(a, b); + } + /** + * Checks if variable a is less than b + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "lessThan", + value: function lessThan(a, b) { + return this.compare(a, b) < 0; + } + }]); + + return Comparator; +}(Object); + +exports.Comparator = Comparator; + +_object.Monster.assignToNamespace('Monster.Util', Comparator); + +},{"../types/is.js":13,"../types/object.js":14}],23:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -1812,7 +3712,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(Monster.Util.deepFreeze({})) * </script> * ``` @@ -1821,7 +3721,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len * * ``` * <script type="module"> - * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(deepFreeze({})) * </script> * ``` @@ -1858,5 +3758,5 @@ function deepFreeze(object) { _namespace.Monster.assignToNamespace('Monster.Util', deepFreeze); -},{"../namespace.js":3,"../types/validate.js":9}]},{},[2]) +},{"../namespace.js":11,"../types/validate.js":19}]},{},[10]) //# sourceMappingURL=monster.dev.js.map diff --git a/packages/monster/dist/monster.dev.js.map b/packages/monster/dist/monster.dev.js.map index fe22e25d4a964ad6210818197fb7166d94becdbe..42f6229989e0b833816951d632c1383ba977143e 100644 --- a/packages/monster/dist/monster.dev.js.map +++ b/packages/monster/dist/monster.dev.js.map @@ -2,6 +2,14 @@ "version": 3, "sources": [ "node_modules/browser-pack/_prelude.js", + "packages/monster/source/constraints/abstract.js", + "packages/monster/source/constraints/abstractoperator.js", + "packages/monster/source/constraints/andoperator.js", + "packages/monster/source/constraints/invalid.js", + "packages/monster/source/constraints/isarray.js", + "packages/monster/source/constraints/isobject.js", + "packages/monster/source/constraints/oroperator.js", + "packages/monster/source/constraints/valid.js", "packages/monster/source/math/random.js", "packages/monster/source/monster.js", "packages/monster/source/namespace.js", @@ -10,28 +18,42 @@ "packages/monster/source/types/object.js", "packages/monster/source/types/observer.js", "packages/monster/source/types/observerlist.js", + "packages/monster/source/types/proxyobserver.js", + "packages/monster/source/types/tokenlist.js", "packages/monster/source/types/validate.js", "packages/monster/source/types/version.js", "packages/monster/source/util/clone.js", + "packages/monster/source/util/comparator.js", "packages/monster/source/util/freeze.js" ], "names": [], - "mappings": "AAAA;;ACAA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,MAAT,CAAgB,GAAhB,EAAqB,GAArB,EAA0B;AAEtB,MAAI,GAAG,KAAK,SAAZ,EAAuB;AACnB,IAAA,GAAG,GAAG,CAAN;AACH;;AACD,MAAI,GAAG,KAAK,SAAZ,EAAuB;AACnB,IAAA,GAAG,GAAG,GAAN;AACH;;AAED,MAAI,GAAG,GAAG,GAAV,EAAe;AACX,UAAM,IAAI,KAAJ,CAAU,8BAAV,CAAN;AACH;;AAED,SAAO,IAAI,CAAC,KAAL,CAAW,MAAM,CAAC,GAAD,EAAM,GAAN,CAAjB,CAAP;AAEH;;AAED,IAAI,GAAG,GAAG,UAAV;;AAEA,IAAI,CAAC,IAAL,GAAY,IAAI,CAAC,IAAL,IAAa,UAAU,CAAV,EAAa;AAClC,SAAO,IAAI,CAAC,GAAL,CAAS,CAAT,IAAc,IAAI,CAAC,GAAL,CAAS,CAAT,CAArB;AACH,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,MAAT,CAAgB,GAAhB,EAAqB,GAArB,EAA0B;AACtB,MAAI,KAAJ;;AAEA,MAAI,OAAO,MAAP,KAAkB,WAAtB,EAAmC;AAAA;;AAC/B,IAAA,KAAK,GAAG,YAAA,MAAM,UAAN,0CAAS,QAAT,mBAAsB,MAAtB,6CAAsB,SAAS,UAAT,CAAtB,CAAR;AACH,GAFD,MAEO;AACH,IAAA,KAAK,GAAG,OAAO,MAAP,KAAkB,WAAlB,GAAgC,MAAhC,GAAyC,SAAjD;AACH;;AAED,MAAI,OAAO,KAAP,KAAiB,WAArB,EAAkC;AAC9B,UAAM,IAAI,KAAJ,CAAU,eAAV,CAAN;AACH;;AAED,MAAI,IAAI,GAAG,CAAX;AACA,MAAM,KAAK,GAAG,GAAG,GAAG,GAApB;;AACA,MAAI,KAAK,GAAG,CAAZ,EAAe;AACX,WAAO,GAAP;AACH;;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAL,CAAU,IAAI,CAAC,IAAL,CAAU,KAAV,CAAV,CAAnB;;AACA,MAAI,UAAU,GAAG,EAAjB,EAAqB;AACjB,UAAO,IAAI,KAAJ,CAAU,iDAAV,CAAP;AACH;;AACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAL,CAAU,UAAU,GAAG,CAAvB,CAApB;AACA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,UAAZ,IAA0B,CAAvC;AAEA,MAAM,SAAS,GAAG,IAAI,UAAJ,CAAe,WAAf,CAAlB;AACA,EAAA,KAAK,CAAC,eAAN,CAAsB,SAAtB;AAEA,MAAI,CAAC,GAAG,CAAC,WAAW,GAAG,CAAf,IAAoB,CAA5B;;AACA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,WAApB,EAAiC,CAAC,EAAlC,EAAsC;AAClC,IAAA,IAAI,IAAI,SAAS,CAAC,CAAD,CAAT,GAAe,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAZ,CAAvB;AACA,IAAA,CAAC,IAAI,CAAL;AACH;;AAED,EAAA,IAAI,GAAG,IAAI,GAAG,IAAd;;AAEA,MAAI,IAAI,IAAI,KAAZ,EAAmB;AACf,WAAO,MAAM,CAAC,GAAD,EAAM,GAAN,CAAb;AACH;;AAED,SAAO,GAAG,GAAG,IAAb;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,MAA1C;;;;;ACjHA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,mBAAQ,IAAR,CAAa,UAAb,CAAwB,kBAAxB;;;ACrBA;AAEA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;IACM,S;AAEF;AACJ;AACA;AACA;AACA;AACI,qBAAY,SAAZ,EAAuB;AAAA;;AACnB,QAAI,SAAS,KAAK,SAAd,IAA2B,OAAO,SAAP,KAAqB,QAApD,EAA8D;AAC1D,YAAM,IAAI,KAAJ,CAAU,2BAAV,CAAN;AACH;;AACD,SAAK,SAAL,GAAiB,SAAjB;AACH;AAED;AACJ;AACA;AACA;;;;;WACI,wBAAe;AACX,aAAO,KAAK,SAAZ;AACH;AAED;AACJ;AACA;AACA;;;;WACI,oBAAW;AACP,aAAO,KAAK,YAAL,EAAP;AACH;;;;;AAGL;AACA;AACA;AACA;AACA;;;AACO,IAAM,OAAO,GAAG,IAAI,SAAJ,CAAc,SAAd,CAAhB;AAGP;AACA;AACA;;;AACA,iBAAiB,CAAC,SAAD,EAAY,iBAAZ,CAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS,iBAAT,CAA2B,EAA3B,EAAuC;AACnC,MAAI,OAAO,GAAG,YAAY,CAAC,EAAE,CAAC,KAAH,CAAS,GAAT,CAAD,CAA1B;;AAEA,OAAK,IAAI,CAAC,GAAG,CAAR,EAAW,CAAC,mDAAjB,EAAgC,CAAC,GAAG,CAApC,EAAuC,CAAC,EAAxC,EAA4C;AACxC,IAAA,OAAO,CAAC,UAAU,CAAK,CAAL,gCAAK,CAAL,6BAAK,CAAL,MAAX,CAAP,GAAkC,CAAlC,gCAAkC,CAAlC,6BAAkC,CAAlC;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,UAAT,CAAoB,EAApB,EAAwB;AACpB,MAAI;AAEA,QAAI,OAAO,EAAP,KAAc,UAAlB,EAA8B;AAC1B,YAAO,IAAI,KAAJ,CAAU,gDAAV,CAAP;AACH;;AAED,QAAI,EAAE,CAAC,cAAH,CAAkB,MAAlB,CAAJ,EAA+B;AAC3B,aAAO,EAAE,CAAC,IAAV;AACH;;AAED,QAAI,eAAe,OAAO,EAAE,CAAC,QAA7B,EAAuC;AACnC,UAAI,CAAC,GAAG,EAAE,CAAC,QAAH,EAAR;AACA,UAAI,CAAC,GAAG,CAAC,CAAC,KAAF,CAAQ,0BAAR,CAAR;;AACA,UAAI,KAAK,CAAC,OAAN,CAAc,CAAd,KAAoB,OAAO,CAAC,CAAC,CAAD,CAAR,KAAgB,QAAxC,EAAkD;AAC9C,eAAO,CAAC,CAAC,CAAD,CAAR;AACH;;AACD,UAAI,CAAC,GAAG,CAAC,CAAC,KAAF,CAAQ,uBAAR,CAAR;;AACA,UAAI,KAAK,CAAC,OAAN,CAAc,CAAd,KAAoB,OAAO,CAAC,CAAC,CAAD,CAAR,KAAgB,QAAxC,EAAkD;AAC9C,eAAO,CAAC,CAAC,CAAD,CAAR;AACH;AACJ;AAEJ,GAtBD,CAsBE,OAAO,CAAP,EAAU;AACR,UAAM,IAAI,KAAJ,CAAU,eAAe,CAAzB,CAAN;AACH;;AAED,QAAO,IAAI,KAAJ,CAAU,uDAAV,CAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,YAAT,CAAsB,KAAtB,EAA6B;AACzB,MAAI,KAAK,GAAG,OAAZ;AAAA,MAAqB,EAAE,GAAG,SAA1B;;AAEA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,KAAK,CAAC,MAA1B,EAAkC,CAAC,EAAnC,EAAuC;AAEnC,QAAI,cAAc,KAAK,CAAC,CAAD,CAAvB,EAA4B;AACxB;AACH;;AAED,IAAA,EAAE,IAAI,MAAM,KAAK,CAAC,CAAD,CAAjB;;AAEA,QAAI,CAAC,KAAK,CAAC,cAAN,CAAqB,KAAK,CAAC,CAAD,CAA1B,CAAL,EAAqC;AACjC,MAAA,KAAK,CAAC,KAAK,CAAC,CAAD,CAAN,CAAL,GAAkB,IAAI,SAAJ,CAAc,EAAd,CAAlB;AACH;;AAED,IAAA,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAD,CAAN,CAAb;AACH;;AAED,SAAO,KAAP;AACH;;;;AC7JD;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,eAAe,GAAG,CAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACM,E;;;;;AAEF,gBAAc;AAAA;;AAAA;;AACV;AAEA,IAAA,eAAe,IAAI,CAAnB;AAEA,UAAK,EAAL,GAAU,MAAM,CAAC,IAAP,CAAY,mBAAQ,IAAR,CAAa,MAAb,CAAoB,CAApB,EAAuB,KAAvB,CAAZ,EACL,OADK,CACG,IADH,EACS,EADT;AAEN;AAFM,KAGL,OAHK,CAGG,SAHH,EAGc,GAHd,IAGqB,eAH/B;AALU;AASb;;;;WAED,oBAAW;AACP,aAAO,KAAK,EAAZ;AACH;;;;EAfY,mBAAQ,KAAR,CAAc,M;;;;AAmB/B,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,EAA3C;;;;;ACxDA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AAEA;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,WAAT,CAAqB,KAArB,EAA4B;AACxB,MAAI,IAAJ;;AAEA,MAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;AACvC,WAAO,IAAP;AACH;;AAED,EAAA,IAAI,WAAU,KAAV,CAAJ;;AAEA,MAAI,IAAI,KAAK,QAAT,IAAqB,IAAI,KAAK,QAA9B,IAA0C,IAAI,KAAK,SAAnD,IAAgE,IAAI,KAAK,QAA7E,EAAuF;AACnF,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,SAAT,CAAmB,KAAnB,EAA0B;AAEtB,MAAI,KAAK,KAAK,IAAV,IAAkB,KAAK,KAAK,KAAhC,EAAuC;AACnC,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,QAAT,CAAkB,KAAlB,EAAyB;AACrB,MAAI,KAAK,KAAK,SAAV,IAAuB,OAAO,KAAP,KAAiB,QAA5C,EAAsD;AAClD,WAAO,KAAP;AACH;;AACD,SAAO,IAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,QAAT,CAAkB,KAAlB,EAAyB;AAErB,MAAI,OAAO,CAAC,KAAD,CAAX,EAAoB,OAAO,KAAP;AACpB,MAAI,WAAW,CAAC,KAAD,CAAf,EAAwB,OAAO,KAAP;;AAExB,MAAI,QAAO,KAAP,MAAiB,QAArB,EAA+B;AAC3B,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,OAAT,CAAiB,KAAjB,EAAwB;AACpB,MAAI,KAAK,CAAC,OAAN,CAAc,KAAd,CAAJ,EAA0B;AACtB,WAAO,IAAP;AACH;;AACD,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,UAAT,CAAoB,KAApB,EAA2B;AACvB,MAAI,OAAO,CAAC,KAAD,CAAX,EAAoB,OAAO,KAAP;AACpB,MAAI,WAAW,CAAC,KAAD,CAAf,EAAwB,OAAO,KAAP;;AAExB,MAAI,OAAO,KAAP,KAAiB,UAArB,EAAiC;AAC7B,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,WAA3C,EAAwD,SAAxD,EAAmE,QAAnE,EAA6E,QAA7E,EAAuF,OAAvF,EAAgG,UAAhG;;;AC1PA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;AAEF;AACJ;AACA;AACI,oBAAc;AAAA;AACb;AAED;AACJ;AACA;AACA;;;;;WACI,oBAAW;AACP,aAAO,IAAI,CAAC,SAAL,CAAe,IAAf,CAAP;AACH;;;;;;;;AAKL,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,OAA3C;;;ACvDA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,Q;;;;;AAEF,oBAAY,QAAZ,EAA+B;AAAA;;AAAA;;AAC3B;;AAEA,QAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAChC,YAAM,IAAI,KAAJ,CAAU,sCAAV,CAAN;AACH;;AAED,UAAK,QAAL,GAAgB,QAAhB;;AAP2B,sCAAN,IAAM;AAAN,MAAA,IAAM;AAAA;;AAQ3B,UAAK,SAAL,GAAiB,IAAjB;AACA,UAAK,IAAL,GAAY,IAAI,GAAJ,EAAZ;AAT2B;AAU9B;;;;WAED,gBAAO,GAAP,EAAY;AACR,WAAK,IAAL,CAAU,GAAV,CAAc,GAAd;AACA,aAAO,IAAP;AACH;;;WAED,mBAAU,GAAV,EAAe;AACX,WAAK,IAAL,WAAiB,GAAjB;AACA,aAAO,IAAP;AACH;;;WAED,mBAAU;AACN,aAAO,KAAK,IAAZ;AACH;;;WAED,gBAAO,GAAP,EAAY;AACR,aAAO,KAAK,IAAL,CAAU,GAAV,CAAc,GAAd,CAAP;AACH;;;WAED,gBAAO,OAAP,EAAgB;AACZ,UAAI,IAAI,GAAG,IAAX;AAEA,aAAO,IAAI,OAAJ,CAAY,UAAU,OAAV,EAAmB,MAAnB,EAA2B;AAC1C,YAAI,EAAE,OAAO,YAAY,MAArB,CAAJ,EAAkC;AAC9B,UAAA,MAAM,CAAC,2BAAD,CAAN;AACH;;AACD,YAAI,MAAM,GAAG,IAAI,CAAC,QAAL,CAAc,KAAd,CAAoB,OAApB,EAA6B,IAAI,CAAC,SAAlC,CAAb;AACA,QAAA,OAAO,CAAC,MAAD,CAAP;AAEH,OAPM,CAAP;AASH;;;;EA5CkB,mBAAQ,KAAR,CAAc,M;;;;AAgDrC,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,QAA3C;;;ACpFA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,Y;;;;;AAEF,0BAAc;AAAA;;AAAA;;AACV;AACA,UAAK,SAAL,GAAiB,EAAjB;AAFU;AAGb;;;;WAED,gBAAO,QAAP,EAAiB;AACb,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,WAAK,SAAL,CAAe,IAAf,CAAoB,QAApB;AACA,aAAO,IAAP;AACH;;;WAED,gBAAO,QAAP,EAAiB;AACb,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,YAAI,KAAK,SAAL,CAAe,CAAf,MAAsB,QAA1B,EAAoC;AAChC,eAAK,SAAL,CAAe,MAAf,CAAsB,CAAtB,EAAyB,CAAzB;AACH;AACJ;;AAED,aAAO,IAAP;AACH;;;WAED,kBAAS,QAAT,EAAmB;AACf,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,YAAI,KAAK,SAAL,CAAe,CAAf,MAAsB,QAA1B,EAAoC;AAChC,iBAAO,IAAP;AACH;AACJ;;AACD,aAAO,KAAP;AACH;;;WAED,gBAAO,OAAP,EAAgB;AAEZ,UAAI,OAAO,GAAG,EAAd;AAEA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,QAAA,OAAO,CAAC,IAAR,CAAa,KAAK,SAAL,CAAe,CAAf,EAAkB,MAAlB,CAAyB,OAAzB,CAAb;AACH;;AAED,aAAO,OAAO,CAAC,GAAR,CAAY,OAAZ,CAAP;AACH;;;;EA9CsB,mBAAQ,KAAR,CAAc,M;AAkDzC;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAAS,eAAT,CAAyB,QAAzB,EAAmC;AAC/B,MAAI,EAAE,QAAQ,YAAY,mBAAQ,KAAR,CAAc,QAApC,CAAJ,EAAmD;AAC/C,UAAM,IAAI,KAAJ,CAAU,uCAAV,CAAN;AACH;;AACD,SAAO,IAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,YAA3C;;;ACnGA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAT,CAA2B,KAA3B,EAAkC;AAC9B,MAAI,CAAC,qBAAY,KAAZ,CAAL,EAAyB;AACrB,UAAM,IAAI,SAAJ,CAAc,0BAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,eAAT,CAAyB,KAAzB,EAAgC;AAC5B,MAAI,CAAC,mBAAU,KAAV,CAAL,EAAuB;AACnB,UAAM,IAAI,SAAJ,CAAc,wBAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,cAAT,CAAwB,KAAxB,EAA+B;AAC3B,MAAI,CAAC,kBAAS,KAAT,CAAL,EAAsB;AAClB,UAAM,IAAI,SAAJ,CAAc,uBAAd,CAAN;AACH;AACJ;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,cAAT,CAAwB,KAAxB,EAA+B;AAC3B,MAAI,CAAC,kBAAS,KAAT,CAAL,EAAsB;AAClB,UAAM,IAAI,SAAJ,CAAc,uBAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,aAAT,CAAuB,KAAvB,EAA8B;AAC1B,MAAI,CAAC,iBAAQ,KAAR,CAAL,EAAqB;AACjB,UAAM,IAAI,SAAJ,CAAc,0BAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,gBAAT,CAA0B,KAA1B,EAAiC;AAC7B,MAAI,CAAC,oBAAW,KAAX,CAAL,EAAwB;AACpB,UAAM,IAAI,SAAJ,CAAc,yBAAd,CAAN;AACH;AACJ;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,iBAA3C,EAA8D,eAA9D,EAA+E,cAA/E,EAA+F,cAA/F,EAA+G,aAA/G,EAA8H,gBAA9H;;;AC7OA;;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,mBAAY,KAAZ,EAAmB,KAAnB,EAA0B,KAA1B,EAAiC;AAAA;;AAAA;;AAC7B;;AAEA,QAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,KAAK,KAAK,SAAvC,IAAoD,KAAK,KAAK,SAAlE,EAA6E;AAEzE,UAAI,KAAK,GAAG,KAAK,CAAC,QAAN,GAAiB,KAAjB,CAAuB,GAAvB,CAAZ;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,YAAO,IAAI,KAAJ,CAAU,4BAAV,CAAP;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,MAAA,KAAK,GAAG,CAAR;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,MAAA,KAAK,GAAG,CAAR;AACH;;AAED,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;AACA,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;AACA,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;;AAEA,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AAED,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AAED,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AArC4B;AAuChC;AAED;AACJ;AACA;AACA;;;;;WACI,oBAAW;AACP,aAAO,KAAK,KAAL,GAAa,GAAb,GAAmB,KAAK,KAAxB,GAAgC,GAAhC,GAAsC,KAAK,KAAlD;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,mBAAU,OAAV,EAAmB;AAEf,UAAI,OAAO,YAAY,OAAvB,EAAgC;AAC5B,QAAA,OAAO,GAAG,OAAO,CAAC,QAAR,EAAV;AACH;;AAED,UAAI,OAAO,OAAP,KAAmB,QAAvB,EAAiC;AAC7B,cAAO,IAAI,KAAJ,CAAU,gBAAV,CAAP;AACH;;AAED,UAAI,OAAO,KAAK,KAAK,QAAL,EAAhB,EAAiC;AAC7B,eAAO,CAAP;AACH;;AAED,UAAI,CAAC,GAAG,CAAC,KAAK,KAAN,EAAa,KAAK,KAAlB,EAAyB,KAAK,KAA9B,CAAR;AACA,UAAI,CAAC,GAAG,OAAO,CAAC,KAAR,CAAc,GAAd,CAAR;AACA,UAAI,GAAG,GAAG,IAAI,CAAC,GAAL,CAAS,CAAC,CAAC,MAAX,EAAmB,CAAC,CAAC,MAArB,CAAV;;AAEA,WAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,GAApB,EAAyB,CAAC,IAAI,CAA9B,EAAiC;AAC7B,YAAK,CAAC,CAAC,CAAD,CAAD,IAAQ,CAAC,CAAC,CAAC,CAAD,CAAV,IAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,CAAnC,IAA0C,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAvE,EAAgF;AAC5E,iBAAO,CAAP;AACH,SAFD,MAEO,IAAK,CAAC,CAAC,CAAD,CAAD,IAAQ,CAAC,CAAC,CAAC,CAAD,CAAV,IAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,CAAnC,IAA0C,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAvE,EAAgF;AACnF,iBAAO,CAAC,CAAR;AACH;AACJ;;AAED,aAAO,CAAP;AACH;;;;EA9FiB,mBAAQ,KAAR,CAAc,M;;;;AAkGpC,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,OAA3C;;AAGA,IAAI,cAAJ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS,UAAT,GAAsB;AAClB,MAAI,cAAc,YAAY,OAA9B,EAAuC;AACnC,WAAO,cAAP;AACH;AACD;;;AACA,EAAA,cAAc,GAAG,IAAI,OAAJ,CAAY,OAAZ,CAAjB;AACA;;AACA,SAAO,cAAP;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,SAA1B,EAAqC,UAArC;;;ACzLA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AACA;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,KAAT,CAAe,GAAf,EAAoB;AAEhB;AACA,MAAI,SAAS,GAAb,EAAkB;AACd,WAAO,GAAP;AACH,GALe,CAOhB;;;AACA,MAAI,qBAAY,GAAZ,CAAJ,EAAsB;AAClB,WAAO,GAAP;AACH,GAVe,CAYhB;;;AACA,MAAI,oBAAW,GAAX,CAAJ,EAAqB;AACjB,WAAO,GAAP;AACH,GAfe,CAiBhB;;;AACA,MAAI,iBAAQ,GAAR,CAAJ,EAAkB;AACd,QAAI,IAAI,GAAG,EAAX;;AACA,SAAK,IAAI,CAAC,GAAG,CAAR,EAAW,GAAG,GAAG,GAAG,CAAC,MAA1B,EAAkC,CAAC,GAAG,GAAtC,EAA2C,CAAC,EAA5C,EAAgD;AAC5C,MAAA,IAAI,CAAC,CAAD,CAAJ,GAAU,KAAK,CAAC,GAAG,CAAC,CAAD,CAAJ,CAAf;AACH;;AAED,WAAO,IAAP;AACH;;AAED,MAAI,kBAAS,GAAT,CAAJ,EAAmB;AAGf;AACA,QAAI,GAAG,YAAY,IAAnB,EAAyB;AACrB,UAAI,KAAI,GAAG,IAAI,IAAJ,EAAX;;AACA,MAAA,KAAI,CAAC,OAAL,CAAa,GAAG,CAAC,OAAJ,EAAb;;AACA,aAAO,KAAP;AACH;AAED;;;AACA,QAAI,OAAO,OAAP,KAAmB,WAAnB,IAAkC,GAAG,YAAY,OAArD,EAA8D,OAAO,GAAP;AAC9D,QAAI,OAAO,YAAP,KAAwB,WAAxB,IAAuC,GAAG,YAAY,YAA1D,EAAwE,OAAO,GAAP;AACxE,QAAI,OAAO,gBAAP,KAA4B,WAA5B,IAA2C,GAAG,YAAY,gBAA9D,EAAgF,OAAO,GAAP;AAEhF;;AACA,QAAI,OAAO,aAAP,KAAyB,WAAzB,IAAwC,GAAG,KAAK,aAApD,EAAmE,OAAO,GAAP;AACnE,QAAI,OAAO,MAAP,KAAkB,WAAlB,IAAiC,GAAG,KAAK,MAA7C,EAAqD,OAAO,GAAP;AACrD,QAAI,OAAO,QAAP,KAAoB,WAApB,IAAmC,GAAG,KAAK,QAA/C,EAAyD,OAAO,GAAP;AACzD,QAAI,OAAO,SAAP,KAAqB,WAArB,IAAoC,GAAG,KAAK,SAAhD,EAA2D,OAAO,GAAP;AAC3D,QAAI,OAAO,IAAP,KAAgB,WAAhB,IAA+B,GAAG,KAAK,IAA3C,EAAiD,OAAO,GAAP,CApBlC,CAsBf;;AACA,QAAI;AACA;AACA,UAAI,GAAG,YAAY,KAAnB,EAA0B;AACtB,eAAO,GAAP;AACH;AACJ,KALD,CAKE,OAAO,CAAP,EAAU,CACX;;AAED,WAAO,WAAW,CAAC,GAAD,CAAlB;AAEH;;AAED,QAAM,IAAI,KAAJ,CAAU,gDAAV,CAAN;AACH;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,WAAT,CAAqB,GAArB,EAA0B;AACtB,MAAI,IAAJ;AAEA;;AACA,MAAI,QAAO,GAAG,CAAC,cAAJ,CAAmB,UAAnB,CAAP,KAAyC,GAAG,CAAC,QAAJ,KAAiB,UAA9D,EAA0E;AACtE,WAAO,GAAG,CAAC,QAAJ,EAAP;AACH;;AAED,EAAA,IAAI,GAAG,EAAP;;AACA,MAAI,OAAO,GAAG,CAAC,WAAX,KAA2B,UAA3B,IACA,OAAO,GAAG,CAAC,WAAJ,CAAgB,IAAvB,KAAgC,UADpC,EACgD;AAC5C,IAAA,IAAI,GAAG,IAAI,GAAG,CAAC,WAAR,EAAP;AACH;;AAED,OAAK,IAAI,GAAT,IAAgB,GAAhB,EAAqB;AAEjB,QAAI,CAAC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAL,EAA8B;AAC1B;AACH;;AAED,QAAI,mBAAQ,KAAR,CAAc,WAAd,CAA0B,GAAG,CAAC,GAAD,CAA7B,CAAJ,EAAyC;AACrC,MAAA,IAAI,CAAC,GAAD,CAAJ,GAAY,GAAG,CAAC,GAAD,CAAf;AACA;AACH;;AAED,IAAA,IAAI,CAAC,GAAD,CAAJ,GAAY,KAAK,CAAC,GAAG,CAAC,GAAD,CAAJ,CAAjB;AACH;;AAED,SAAO,IAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,KAA1C;;;ACpJA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAT,CAAoB,MAApB,EAA4B;AAExB,gCAAe,MAAf,EAFwB,CAIxB;;AACA,MAAI,SAAS,GAAG,MAAM,CAAC,mBAAP,CAA2B,MAA3B,CAAhB,CALwB,CAOxB;;AAPwB,6CAQP,SARO;AAAA;;AAAA;AAQxB,wDAA4B;AAAA,UAAnB,IAAmB;AACxB,UAAI,KAAK,GAAG,MAAM,CAAC,IAAD,CAAlB;AAEA,MAAA,MAAM,CAAC,IAAD,CAAN,GAAe,KAAK,IAAI,QAAO,KAAP,MAAiB,QAA1B,GACX,UAAU,CAAC,KAAD,CADC,GACS,KADxB;AAEH;AAbuB;AAAA;AAAA;AAAA;AAAA;;AAexB,SAAO,MAAM,CAAC,MAAP,CAAc,MAAd,CAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,UAA1C", + "mappings": "AAAA;ACAA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,kB;;;;;AAEF;AACJ;AACA;AACI,gCAAc;AAAA;;AAAA;AAEb;AAED;AACJ;AACA;AACA;AACA;AACA;;;;;WACI,iBAAQ,KAAR,EAAe;AACX,aAAO,OAAO,CAAC,MAAR,CAAe,KAAf,CAAP;AACH;;;;EAjB4B,M;;;;AAoBjC,mBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,kBAAjD;;;ACvCA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,gB;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,4BAAY,QAAZ,EAAsB,QAAtB,EAAgC;AAAA;;AAAA;;AAC5B;;AAEA,QAAI,EAAE,QAAQ,YAAY,4BAAtB,KAA6C,EAAE,QAAQ,YAAY,4BAAtB,CAAjD,EAA4F;AACxF,YAAM,IAAI,SAAJ,CAAc,iDAAd,CAAN;AACH;;AAED,UAAK,QAAL,GAAgB,QAAhB;AACA,UAAK,QAAL,GAAgB,QAAhB;AAR4B;AAU/B;;;EAlB0B,4B;;;;AAuB/B,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,gBAAjD;;;ACtCA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,W;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,aAAO,OAAO,CAAC,GAAR,CAAY,CAAC,KAAK,QAAL,CAAc,OAAd,CAAsB,KAAtB,CAAD,EAA+B,KAAK,QAAL,CAAc,OAAd,CAAsB,KAAtB,CAA/B,CAAZ,CAAP;AACH;;;;EAVqB,kC;;;;AAc1B,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,WAAjD;;;AC/CA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,aAAO,OAAO,CAAC,MAAR,CAAe,KAAf,CAAP;AACH;;;;EAViB,4B;;;;AActB,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,OAAjD;;;AC/CA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,UAAG,iBAAQ,KAAR,CAAH,EAAmB;AACf,eAAO,OAAO,CAAC,OAAR,CAAgB,KAAhB,CAAP;AACH;;AAED,aAAO,OAAO,CAAC,MAAR,CAAe,KAAf,CAAP;AACH;;;;EAdiB,4B;;;;AAkBtB,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,OAAjD;;;ACpDA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,Q;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,UAAI,kBAAS,KAAT,CAAJ,EAAqB;AACjB,eAAO,OAAO,CAAC,OAAR,CAAgB,KAAhB,CAAP;AACH;;AAED,aAAO,OAAO,CAAC,MAAR,CAAe,KAAf,CAAP;AACH;;;;EAdkB,4B;;;;AAkBvB,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,QAAjD;;;ACpDA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,U;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,UAAI,IAAI,GAAG,IAAX;AAEA,aAAO,IAAI,OAAJ,CAAY,UAAU,OAAV,EAAmB,MAAnB,EAA2B;AAC1C,YAAI,CAAJ,EAAO,CAAP;AAEA,QAAA,IAAI,CAAC,QAAL,CAAc,OAAd,CAAsB,KAAtB,EACK,IADL,CACU,YAAY;AACd,UAAA,OAAO;AACV,SAHL,WAGa,YAAY;AACrB,UAAA,CAAC,GAAG,KAAJ;AACA;;AACA,cAAI,CAAC,KAAK,KAAV,EAAiB;AACb,YAAA,MAAM;AACT;AACJ,SATD;AAWA,QAAA,IAAI,CAAC,QAAL,CAAc,OAAd,CAAsB,KAAtB,EACK,IADL,CACU,YAAY;AACd,UAAA,OAAO;AACV,SAHL,WAGa,YAAY;AACrB,UAAA,CAAC,GAAG,KAAJ;AACA;;AACA,cAAI,CAAC,KAAK,KAAV,EAAiB;AACb,YAAA,MAAM;AACT;AACJ,SATD;AAUH,OAxBM,CAAP;AAyBH;;;;EApCoB,kC;;;;AAyCzB,0BAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,UAAjD;;;ACzEA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,K;;;;;;;;;;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACI,qBAAQ,KAAR,EAAe;AACX,aAAO,OAAO,CAAC,OAAR,CAAgB,KAAhB,CAAP;AACH;;;;EAVe,4B;;;;AAcpB,kBAAQ,iBAAR,CAA0B,qBAA1B,EAAiD,KAAjD;;;;AC/CA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,MAAT,CAAgB,GAAhB,EAAqB,GAArB,EAA0B;AAEtB,MAAI,GAAG,KAAK,SAAZ,EAAuB;AACnB,IAAA,GAAG,GAAG,CAAN;AACH;;AACD,MAAI,GAAG,KAAK,SAAZ,EAAuB;AACnB,IAAA,GAAG,GAAG,GAAN;AACH;;AAED,MAAI,GAAG,GAAG,GAAV,EAAe;AACX,UAAM,IAAI,KAAJ,CAAU,8BAAV,CAAN;AACH;;AAED,SAAO,IAAI,CAAC,KAAL,CAAW,MAAM,CAAC,GAAD,EAAM,GAAN,CAAjB,CAAP;AAEH;;AAED,IAAI,GAAG,GAAG,UAAV;;AAEA,IAAI,CAAC,IAAL,GAAY,IAAI,CAAC,IAAL,IAAa,UAAU,CAAV,EAAa;AAClC,SAAO,IAAI,CAAC,GAAL,CAAS,CAAT,IAAc,IAAI,CAAC,GAAL,CAAS,CAAT,CAArB;AACH,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,MAAT,CAAgB,GAAhB,EAAqB,GAArB,EAA0B;AACtB,MAAI,KAAJ;;AAEA,MAAI,OAAO,MAAP,KAAkB,WAAtB,EAAmC;AAAA;;AAC/B,IAAA,KAAK,GAAG,YAAA,MAAM,UAAN,0CAAS,QAAT,mBAAsB,MAAtB,6CAAsB,SAAS,UAAT,CAAtB,CAAR;AACH,GAFD,MAEO;AACH,IAAA,KAAK,GAAG,OAAO,MAAP,KAAkB,WAAlB,GAAgC,MAAhC,GAAyC,SAAjD;AACH;;AAED,MAAI,OAAO,KAAP,KAAiB,WAArB,EAAkC;AAC9B,UAAM,IAAI,KAAJ,CAAU,eAAV,CAAN;AACH;;AAED,MAAI,IAAI,GAAG,CAAX;AACA,MAAM,KAAK,GAAG,GAAG,GAAG,GAApB;;AACA,MAAI,KAAK,GAAG,CAAZ,EAAe;AACX,WAAO,GAAP;AACH;;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAL,CAAU,IAAI,CAAC,IAAL,CAAU,KAAV,CAAV,CAAnB;;AACA,MAAI,UAAU,GAAG,EAAjB,EAAqB;AACjB,UAAO,IAAI,KAAJ,CAAU,iDAAV,CAAP;AACH;;AACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAL,CAAU,UAAU,GAAG,CAAvB,CAApB;AACA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,UAAZ,IAA0B,CAAvC;AAEA,MAAM,SAAS,GAAG,IAAI,UAAJ,CAAe,WAAf,CAAlB;AACA,EAAA,KAAK,CAAC,eAAN,CAAsB,SAAtB;AAEA,MAAI,CAAC,GAAG,CAAC,WAAW,GAAG,CAAf,IAAoB,CAA5B;;AACA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,WAApB,EAAiC,CAAC,EAAlC,EAAsC;AAClC,IAAA,IAAI,IAAI,SAAS,CAAC,CAAD,CAAT,GAAe,IAAI,CAAC,GAAL,CAAS,CAAT,EAAY,CAAZ,CAAvB;AACA,IAAA,CAAC,IAAI,CAAL;AACH;;AAED,EAAA,IAAI,GAAG,IAAI,GAAG,IAAd;;AAEA,MAAI,IAAI,IAAI,KAAZ,EAAmB;AACf,WAAO,MAAM,CAAC,GAAD,EAAM,GAAN,CAAb;AACH;;AAED,SAAO,GAAG,GAAG,IAAb;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,MAA1C;;;;;ACjHA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,mBAAQ,IAAR,CAAa,UAAb,CAAwB,kBAAxB;;;ACjCA;AAEA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;IACM,S;AAEF;AACJ;AACA;AACA;AACA;AACI,qBAAY,SAAZ,EAAuB;AAAA;;AACnB,QAAI,SAAS,KAAK,SAAd,IAA2B,OAAO,SAAP,KAAqB,QAApD,EAA8D;AAC1D,YAAM,IAAI,KAAJ,CAAU,2BAAV,CAAN;AACH;;AACD,SAAK,SAAL,GAAiB,SAAjB;AACH;AAED;AACJ;AACA;AACA;;;;;WACI,wBAAe;AACX,aAAO,KAAK,SAAZ;AACH;AAED;AACJ;AACA;AACA;;;;WACI,oBAAW;AACP,aAAO,KAAK,YAAL,EAAP;AACH;;;;;AAGL;AACA;AACA;AACA;AACA;;;AACO,IAAM,OAAO,GAAG,IAAI,SAAJ,CAAc,SAAd,CAAhB;AAGP;AACA;AACA;;;AACA,iBAAiB,CAAC,SAAD,EAAY,iBAAZ,CAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS,iBAAT,CAA2B,EAA3B,EAAuC;AACnC,MAAI,OAAO,GAAG,YAAY,CAAC,EAAE,CAAC,KAAH,CAAS,GAAT,CAAD,CAA1B;;AAEA,OAAK,IAAI,CAAC,GAAG,CAAR,EAAW,CAAC,mDAAjB,EAAgC,CAAC,GAAG,CAApC,EAAuC,CAAC,EAAxC,EAA4C;AACxC,IAAA,OAAO,CAAC,UAAU,CAAK,CAAL,gCAAK,CAAL,6BAAK,CAAL,MAAX,CAAP,GAAkC,CAAlC,gCAAkC,CAAlC,6BAAkC,CAAlC;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,UAAT,CAAoB,EAApB,EAAwB;AACpB,MAAI;AAEA,QAAI,OAAO,EAAP,KAAc,UAAlB,EAA8B;AAC1B,YAAO,IAAI,KAAJ,CAAU,gDAAV,CAAP;AACH;;AAED,QAAI,EAAE,CAAC,cAAH,CAAkB,MAAlB,CAAJ,EAA+B;AAC3B,aAAO,EAAE,CAAC,IAAV;AACH;;AAED,QAAI,eAAe,OAAO,EAAE,CAAC,QAA7B,EAAuC;AACnC,UAAI,CAAC,GAAG,EAAE,CAAC,QAAH,EAAR;AACA,UAAI,CAAC,GAAG,CAAC,CAAC,KAAF,CAAQ,0BAAR,CAAR;;AACA,UAAI,KAAK,CAAC,OAAN,CAAc,CAAd,KAAoB,OAAO,CAAC,CAAC,CAAD,CAAR,KAAgB,QAAxC,EAAkD;AAC9C,eAAO,CAAC,CAAC,CAAD,CAAR;AACH;;AACD,UAAI,CAAC,GAAG,CAAC,CAAC,KAAF,CAAQ,uBAAR,CAAR;;AACA,UAAI,KAAK,CAAC,OAAN,CAAc,CAAd,KAAoB,OAAO,CAAC,CAAC,CAAD,CAAR,KAAgB,QAAxC,EAAkD;AAC9C,eAAO,CAAC,CAAC,CAAD,CAAR;AACH;AACJ;AAEJ,GAtBD,CAsBE,OAAO,CAAP,EAAU;AACR,UAAM,IAAI,KAAJ,CAAU,eAAe,CAAzB,CAAN;AACH;;AAED,QAAO,IAAI,KAAJ,CAAU,uDAAV,CAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,YAAT,CAAsB,KAAtB,EAA6B;AACzB,MAAI,KAAK,GAAG,OAAZ;AAAA,MAAqB,EAAE,GAAG,SAA1B;;AAEA,OAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,KAAK,CAAC,MAA1B,EAAkC,CAAC,EAAnC,EAAuC;AAEnC,QAAI,cAAc,KAAK,CAAC,CAAD,CAAvB,EAA4B;AACxB;AACH;;AAED,IAAA,EAAE,IAAI,MAAM,KAAK,CAAC,CAAD,CAAjB;;AAEA,QAAI,CAAC,KAAK,CAAC,cAAN,CAAqB,KAAK,CAAC,CAAD,CAA1B,CAAL,EAAqC;AACjC,MAAA,KAAK,CAAC,KAAK,CAAC,CAAD,CAAN,CAAL,GAAkB,IAAI,SAAJ,CAAc,EAAd,CAAlB;AACH;;AAED,IAAA,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAD,CAAN,CAAb;AACH;;AAED,SAAO,KAAP;AACH;;;;AC7JD;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,eAAe,GAAG,CAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACM,E;;;;;AAEF;AACJ;AACA;AACI,gBAAc;AAAA;;AAAA;;AACV;AAEA,IAAA,eAAe,IAAI,CAAnB;AAEA,UAAK,EAAL,GAAU,MAAM,CAAC,IAAP,CAAY,oBAAO,CAAP,EAAU,KAAV,CAAZ,EACL,OADK,CACG,IADH,EACS,EADT;AAEN;AAFM,KAGL,OAHK,CAGG,SAHH,EAGc,GAHd,IAGqB,eAH/B;AALU;AASb;;;;WAED,oBAAW;AACP,aAAO,KAAK,EAAZ;AACH;;;;EAlBY,mBAAQ,KAAR,CAAc,M;;;;AAsB/B,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,EAA3C;;;;;AC7DA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;AAEA;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAT,CAAoB,KAApB,EAA2B;AACvB,MAAI,KAAK,KAAK,SAAd,EAAyB,OAAO,KAAP;AACzB,MAAI,KAAK,KAAK,IAAd,EAAoB,OAAO,KAAP;AACpB,SAAO,QAAO,KAAP,aAAO,KAAP,uBAAO,KAAK,CAAG,MAAM,CAAC,QAAV,CAAZ,MAAoC,UAA3C;AACH;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,WAAT,CAAqB,KAArB,EAA4B;AACxB,MAAI,IAAJ;;AAEA,MAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAAjC,IAAyC,KAAK,KAAK,GAAvD,EAA4D;AACxD,WAAO,IAAP;AACH;;AAED,EAAA,IAAI,WAAU,KAAV,CAAJ;;AAEA,MAAI,IAAI,KAAK,QAAT,IAAqB,IAAI,KAAK,QAA9B,IAA0C,IAAI,KAAK,SAAnD,IAAgE,IAAI,KAAK,QAA7E,EAAuF;AACnF,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,SAAT,CAAmB,KAAnB,EAA0B;AAEtB,MAAI,KAAK,KAAK,IAAV,IAAkB,KAAK,KAAK,KAAhC,EAAuC;AACnC,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,QAAT,CAAkB,KAAlB,EAAyB;AACrB,MAAI,KAAK,KAAK,SAAV,IAAuB,OAAO,KAAP,KAAiB,QAA5C,EAAsD;AAClD,WAAO,KAAP;AACH;;AACD,SAAO,IAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,QAAT,CAAkB,KAAlB,EAAyB;AAErB,MAAI,OAAO,CAAC,KAAD,CAAX,EAAoB,OAAO,KAAP;AACpB,MAAI,WAAW,CAAC,KAAD,CAAf,EAAwB,OAAO,KAAP;;AAExB,MAAI,QAAO,KAAP,MAAiB,QAArB,EAA+B;AAC3B,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,OAAT,CAAiB,KAAjB,EAAwB;AACpB,MAAI,KAAK,CAAC,OAAN,CAAc,KAAd,CAAJ,EAA0B;AACtB,WAAO,IAAP;AACH;;AACD,SAAO,KAAP;AACH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,UAAT,CAAoB,KAApB,EAA2B;AACvB,MAAI,OAAO,CAAC,KAAD,CAAX,EAAoB,OAAO,KAAP;AACpB,MAAI,WAAW,CAAC,KAAD,CAAf,EAAwB,OAAO,KAAP;;AAExB,MAAI,OAAO,KAAP,KAAiB,UAArB,EAAiC;AAC7B,WAAO,IAAP;AACH;;AAED,SAAO,KAAP;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,WAA3C,EAAwD,SAAxD,EAAmE,QAAnE,EAA6E,QAA7E,EAAuF,OAAvF,EAAgG,UAAhG,EAA4G,UAA5G;;;AChSA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;AAEF;AACJ;AACA;AACI,oBAAc;AAAA;AACb;AAED;AACJ;AACA;AACA;;;;;WACI,oBAAW;AACP,aAAO,IAAI,CAAC,SAAL,CAAe,IAAf,CAAP;AACH;;;;;;;;AAKL,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,OAA3C;;;ACvDA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,Q;;;;;AAEF;AACJ;AACA;AACA;AACA;AACI,oBAAY,QAAZ,EAA+B;AAAA;;AAAA;;AAC3B;;AAEA,QAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAChC,YAAM,IAAI,KAAJ,CAAU,sCAAV,CAAN;AACH;;AAED,UAAK,QAAL,GAAgB,QAAhB;;AAP2B,sCAAN,IAAM;AAAN,MAAA,IAAM;AAAA;;AAQ3B,UAAK,SAAL,GAAiB,IAAjB;AACA,UAAK,IAAL,GAAY,IAAI,oBAAJ,EAAZ;AAT2B;AAU9B;AAED;AACJ;AACA;AACA;AACA;;;;;WACI,gBAAO,GAAP,EAAY;AACR,WAAK,IAAL,CAAU,GAAV,CAAc,GAAd;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,mBAAU,GAAV,EAAe;AACX,WAAK,IAAL,CAAU,MAAV,CAAiB,GAAjB;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;;;;WACI,mBAAU;AACN,aAAO,KAAK,IAAL,CAAU,OAAV,EAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,gBAAO,GAAP,EAAY;AACR,aAAO,KAAK,IAAL,CAAU,QAAV,CAAmB,GAAnB,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,gBAAO,OAAP,EAAgB;AACZ,UAAI,IAAI,GAAG,IAAX;AAEA,aAAO,IAAI,OAAJ,CAAY,UAAU,OAAV,EAAmB,MAAnB,EAA2B;AAC1C,YAAI,CAAC,kBAAS,OAAT,CAAL,EAAwB;AACpB,UAAA,MAAM,CAAC,2BAAD,CAAN;AACH;;AACD,YAAI,MAAM,GAAG,IAAI,CAAC,QAAL,CAAc,KAAd,CAAoB,OAApB,EAA6B,IAAI,CAAC,SAAlC,CAAb;AACA,QAAA,OAAO,CAAC,MAAD,CAAP;AAEH,OAPM,CAAP;AASH;;;;EAzEkB,mBAAQ,KAAR,CAAc,M;;;;AA6ErC,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,QAA3C;;;AC7IA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,Y;;;;;AAEF,0BAAc;AAAA;;AAAA;;AACV;AACA,UAAK,SAAL,GAAiB,EAAjB;AAFU;AAGb;;;;WAED,gBAAO,QAAP,EAAiB;AACb,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,WAAK,SAAL,CAAe,IAAf,CAAoB,QAApB;AACA,aAAO,IAAP;AACH;;;WAED,gBAAO,QAAP,EAAiB;AACb,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,YAAI,KAAK,SAAL,CAAe,CAAf,MAAsB,QAA1B,EAAoC;AAChC,eAAK,SAAL,CAAe,MAAf,CAAsB,CAAtB,EAAyB,CAAzB;AACH;AACJ;;AAED,aAAO,IAAP;AACH;;;WAED,kBAAS,QAAT,EAAmB;AACf,MAAA,eAAe,CAAC,QAAD,CAAf;AACA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,YAAI,KAAK,SAAL,CAAe,CAAf,MAAsB,QAA1B,EAAoC;AAChC,iBAAO,IAAP;AACH;AACJ;;AACD,aAAO,KAAP;AACH;;;WAED,gBAAO,OAAP,EAAgB;AAEZ,UAAI,OAAO,GAAG,EAAd;AAEA,UAAI,CAAC,GAAG,CAAR;AAAA,UAAW,CAAC,GAAG,KAAK,SAAL,CAAe,MAA9B;;AACA,aAAO,CAAC,GAAG,CAAX,EAAc,CAAC,EAAf,EAAmB;AACf,QAAA,OAAO,CAAC,IAAR,CAAa,KAAK,SAAL,CAAe,CAAf,EAAkB,MAAlB,CAAyB,OAAzB,CAAb;AACH;;AAED,aAAO,OAAO,CAAC,GAAR,CAAY,OAAZ,CAAP;AACH;;;;EA9CsB,mBAAQ,KAAR,CAAc,M;AAkDzC;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAAS,eAAT,CAAyB,QAAzB,EAAmC;AAC/B,MAAI,EAAE,QAAQ,YAAY,mBAAQ,KAAR,CAAc,QAApC,CAAJ,EAAmD;AAC/C,UAAM,IAAI,KAAJ,CAAU,uCAAV,CAAN;AACH;;AACD,SAAO,IAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,YAA3C;;;ACnGA;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,GAAG,IAAI,OAAJ,EAAf,C,CAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACM,a;;;;;AAEF;AACJ;AACA;AACA;AACI,yBAAY,MAAZ,EAAoB;AAAA;;AAAA;;AAChB;AACA,kCAAe,MAAf;AACA,UAAK,WAAL,GAAmB,MAAnB;AACA,UAAK,OAAL,GAAe,IAAI,KAAJ,CAAU,MAAV,EAAkB,UAAU,CAAC,IAAX,+BAAlB,CAAf;AACA,IAAA,QAAQ,CAAC,GAAT,CAAa,MAAK,OAAlB;AACA,UAAK,SAAL,GAAiB,IAAI,0BAAJ,EAAjB;AANgB;AAOnB;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;;WACI,sBAAa;AACT,aAAO,KAAK,OAAZ;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WAAW,0BAAiB;AACpB,aAAO,KAAK,WAAZ;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,wBAAe,QAAf,EAAyB;AACrB,WAAK,SAAL,CAAe,MAAf,CAAsB,QAAtB;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,wBAAe,QAAf,EAAyB;AACrB,WAAK,SAAL,CAAe,MAAf,CAAsB,QAAtB;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,2BAAkB;AACd,WAAK,SAAL,CAAe,MAAf,CAAsB,IAAtB;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;;;;WACI,0BAAiB,QAAjB,EAA2B;AACvB,aAAO,KAAK,SAAL,CAAe,QAAf,CAAwB,QAAxB,CAAP;AACH;;;;EAxEuB,M;;;;AA4E5B,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,aAA3C;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAT,GAAsB;AAElB,MAAM,KAAK,GAAG,IAAd,CAFkB,CAIlB;;AACA,MAAM,OAAO,GAAG;AAEZ;AACA,IAAA,GAAG,EAAE,aAAU,MAAV,EAAkB,QAAlB,EAA4B,QAA5B,EAAsC;AACvC,UAAM,IAAI,GAAG,MAAH,aAAG,MAAH,uBAAG,MAAM,CAAG,QAAH,CAAnB,CADuC,CAGvC;;AACA,UAAI,IAAI,KAAK,SAAb,EAAwB;AACpB,eAAO,SAAP;AACH,OANsC,CAQvC;;;AACA,UAAI,iBAAQ,IAAR,KAAiB,kBAAS,IAAT,KAAkB,CAAC,QAAQ,CAAC,GAAT,CAAa,IAAb,CAAxC,EAA4D;AACxD,QAAA,MAAM,CAAC,QAAD,CAAN,GAAmB,IAAI,KAAJ,CAAU,IAAV,EAAgB,OAAhB,CAAnB;AACA,QAAA,QAAQ,CAAC,GAAT,CAAa,IAAb;AACH;;AAED,aAAO,MAAM,CAAC,QAAD,CAAb;AAEH,KAnBW;AAqBZ;AACA,IAAA,GAAG,EAAE,aAAU,MAAV,EAAkB,QAAlB,EAA4B,KAA5B,EAAmC,QAAnC,EAA6C;AAC9C,MAAA,MAAM,CAAC,QAAD,CAAN,GAAmB,KAAnB;AACA,MAAA,KAAK,CAAC,SAAN,CAAgB,MAAhB,CAAuB,KAAvB;AACA,aAAO,IAAP;AACH,KA1BW;AA4BZ;AACA,IAAA,cAAc,EAAE,wBAAU,MAAV,EAAkB,QAAlB,EAA4B;AACxC,UAAI,QAAQ,IAAI,MAAhB,EAAwB;AACpB,eAAO,MAAM,CAAC,QAAD,CAAb;AACA,QAAA,KAAK,CAAC,SAAN,CAAgB,MAAhB,CAAuB,KAAvB;AACA,eAAO,IAAP;AACH;;AACD,aAAO,KAAP;AACH,KApCW;AAsCZ;AACA,IAAA,cAAc,EAAE,wBAAU,MAAV,EAAkB,QAAlB,EAA4B,UAA5B,EAAwC;AACpD,UAAI,MAAM,GAAG,OAAO,CAAC,cAAR,CAAuB,MAAvB,EAA+B,QAA/B,EAAyC,UAAzC,CAAb;AACA,MAAA,KAAK,CAAC,SAAN,CAAgB,MAAhB,CAAuB,KAAvB;AACA,aAAO,4BAA4B,EAAnC;AACH,KA3CW;AA6CZ;AACA,IAAA,cAAc,EAAE,wBAAU,MAAV,EAAkB,SAAlB,EAA6B;AACzC,UAAI,MAAM,GAAG,OAAO,CAAC,cAAR,CAAuB,OAAvB,EAAgC,SAAhC,CAAb;AACA,MAAA,KAAK,CAAC,SAAN,CAAgB,MAAhB,CAAuB,KAAvB;AACA,aAAO,MAAP;AACH;AAlDW,GAAhB;AAuDA,SAAO,OAAP;AACH;;;AC3ND;AAEA;AACA;AACA;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,S;;;;;AAEF;AACJ;AACA;AACA;AACI,qBAAY,IAAZ,EAAkB;AAAA;;AAAA;;AACd;AACA,UAAK,MAAL,GAAc,IAAI,GAAJ,EAAd;;AAEA,QAAI,OAAO,IAAP,KAAgB,WAApB,EAAiC;AAC7B,YAAK,GAAL,CAAS,IAAT;AACH;;AANa;AAQjB;AAED;AACJ;AACA;AACA;AACA;;;;;WACI,uBAAc;AACV,aAAO,KAAK,MAAM,CAAC,QAAZ,GAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;SACK,MAAM,CAAC,Q;WAAR,iBAAoB;AAChB;AACA;AACA;AACA,UAAI,KAAK,GAAG,CAAZ;AACA,UAAI,OAAO,GAAG,KAAK,OAAL,EAAd;AAEA,aAAO;AACH,QAAA,IAAI,EAAE,gBAAM;AACR,cAAI,KAAK,GAAG,OAAO,CAAC,MAApB,EAA4B;AACxB,mBAAO;AAAC,cAAA,KAAK,EAAE,OAAF,aAAE,OAAF,uBAAE,OAAO,CAAG,KAAK,EAAR,CAAf;AAA4B,cAAA,IAAI,EAAE;AAAlC,aAAP;AACH,WAFD,MAEO;AACH,mBAAO;AAAC,cAAA,IAAI,EAAE;AAAP,aAAP;AACH;AACJ;AAPE,OAAP;AASH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,kBAAS,KAAT,EAAgB;AAAA;;AACZ,UAAI,kBAAS,KAAT,CAAJ,EAAqB;AACjB,QAAA,KAAK,GAAG,KAAK,CAAC,IAAN,EAAR;AACA,YAAI,OAAO,GAAG,CAAd;AACA,QAAA,KAAK,CAAC,KAAN,CAAY,GAAZ,EAAiB,OAAjB,CAAyB,UAAA,KAAK,EAAI;AAC9B,cAAI,MAAI,CAAC,MAAL,CAAY,GAAZ,CAAgB,KAAK,CAAC,IAAN,EAAhB,MAAkC,KAAtC,EAA6C,OAAO,KAAP;AAC7C,UAAA,OAAO;AACV,SAHD;AAIA,eAAO,OAAO,GAAG,CAAV,GAAc,IAAd,GAAqB,KAA5B;AACH;;AAED,UAAI,oBAAW,KAAX,CAAJ,EAAuB;AACnB,YAAI,QAAO,GAAG,CAAd;;AADmB,mDAED,KAFC;AAAA;;AAAA;AAEnB,8DAAyB;AAAA,gBAAhB,KAAgB;AACrB,0CAAe,KAAf;AACA,gBAAI,KAAK,MAAL,CAAY,GAAZ,CAAgB,KAAK,CAAC,IAAN,EAAhB,MAAkC,KAAtC,EAA6C,OAAO,KAAP;AAC7C,YAAA,QAAO;AACV;AANkB;AAAA;AAAA;AAAA;AAAA;;AAOnB,eAAO,QAAO,GAAG,CAAV,GAAc,IAAd,GAAqB,KAA5B;AACH;;AAED,aAAO,KAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,aAAI,KAAJ,EAAW;AAAA;;AACP,UAAI,kBAAS,KAAT,CAAJ,EAAqB;AACjB,QAAA,KAAK,CAAC,KAAN,CAAY,GAAZ,EAAiB,OAAjB,CAAyB,UAAA,KAAK,EAAI;AAC9B,UAAA,MAAI,CAAC,MAAL,CAAY,GAAZ,CAAgB,KAAK,CAAC,IAAN,EAAhB;AACH,SAFD;AAGH,OAJD,MAIO,IAAI,oBAAW,KAAX,CAAJ,EAAuB;AAAA,oDACR,KADQ;AAAA;;AAAA;AAC1B,iEAAyB;AAAA,gBAAhB,KAAgB;AACrB,0CAAe,KAAf;AACA,iBAAK,MAAL,CAAY,GAAZ,CAAgB,KAAK,CAAC,IAAN,EAAhB;AACH;AAJyB;AAAA;AAAA;AAAA;AAAA;AAK7B,OALM,MAKA,IAAI,OAAO,KAAP,KAAiB,WAArB,EAAkC;AACrC,cAAM,IAAI,SAAJ,CAAc,mBAAd,CAAN;AACH;;AAED,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,iBAAQ;AACJ,WAAK,MAAL,CAAY,KAAZ;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,gBAAO,KAAP,EAAc;AAAA;;AACV,UAAI,kBAAS,KAAT,CAAJ,EAAqB;AACjB,QAAA,KAAK,CAAC,KAAN,CAAY,GAAZ,EAAiB,OAAjB,CAAyB,UAAA,KAAK,EAAI;AAC9B,UAAA,MAAI,CAAC,MAAL,WAAmB,KAAK,CAAC,IAAN,EAAnB;AACH,SAFD;AAGH,OAJD,MAIO,IAAI,oBAAW,KAAX,CAAJ,EAAuB;AAAA,oDACR,KADQ;AAAA;;AAAA;AAC1B,iEAAyB;AAAA,gBAAhB,KAAgB;AACrB,0CAAe,KAAf;AACA,iBAAK,MAAL,WAAmB,KAAK,CAAC,IAAN,EAAnB;AACH;AAJyB;AAAA;AAAA;AAAA;AAAA;AAK7B,OALM,MAKA,IAAI,OAAO,KAAP,KAAiB,WAArB,EAAkC;AACrC,cAAM,IAAI,SAAJ,CAAc,mBAAd,CAAN;AACH;;AAED,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,iBAAQ,KAAR,EAAe,QAAf,EAAyB;AACrB,oCAAe,KAAf;AACA,oCAAe,QAAf;;AACA,UAAI,CAAC,KAAK,QAAL,CAAc,KAAd,CAAL,EAA2B;AACvB,eAAO,IAAP;AACH;;AAED,UAAI,CAAC,GAAG,KAAK,CAAC,IAAN,CAAW,KAAK,MAAhB,CAAR;AACA,UAAI,CAAC,GAAG,CAAC,CAAC,OAAF,CAAU,KAAV,CAAR;AACA,UAAI,CAAC,KAAK,CAAC,CAAX,EAAc,OAAO,IAAP;AAEd,MAAA,CAAC,CAAC,MAAF,CAAS,CAAT,EAAY,CAAZ,EAAe,QAAf;AACA,WAAK,MAAL,GAAc,IAAI,GAAJ,EAAd;AACA,WAAK,GAAL,CAAS,CAAT;AAEA,aAAO,IAAP;AAGH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,gBAAO,KAAP,EAAc;AAAA;;AAEV,UAAI,kBAAS,KAAT,CAAJ,EAAqB;AACjB,QAAA,KAAK,CAAC,KAAN,CAAY,GAAZ,EAAiB,OAAjB,CAAyB,UAAA,KAAK,EAAI;AAC9B,UAAA,WAAW,CAAC,IAAZ,CAAiB,MAAjB,EAAuB,KAAvB;AACH,SAFD;AAGH,OAJD,MAIO,IAAI,oBAAW,KAAX,CAAJ,EAAuB;AAAA,oDACR,KADQ;AAAA;;AAAA;AAC1B,iEAAyB;AAAA,gBAAhB,KAAgB;AACrB,YAAA,WAAW,CAAC,IAAZ,CAAiB,IAAjB,EAAuB,KAAvB;AACH;AAHyB;AAAA;AAAA;AAAA;AAAA;AAI7B,OAJM,MAIA,IAAI,OAAO,KAAP,KAAiB,WAArB,EAAkC;AACrC,cAAM,IAAI,SAAJ,CAAc,mBAAd,CAAN;AACH;;AAED,aAAO,IAAP;AAEH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,mBAAU;AACN,aAAO,KAAK,CAAC,IAAN,CAAW,KAAK,MAAhB,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,iBAAQ,QAAR,EAAkB;AACd,sCAAiB,QAAjB;AACA,WAAK,MAAL,CAAY,OAAZ,CAAoB,QAApB;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;;;;WACI,oBAAW;AACP,aAAO,KAAK,OAAL,GAAe,IAAf,CAAoB,GAApB,CAAP;AACH;;;;EArPmB,M;AAyPxB;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAAS,WAAT,CAAqB,KAArB,EAA4B;AACxB,MAAI,EAAE,gBAAgB,SAAlB,CAAJ,EAAkC,MAAM,KAAK,CAAC,oCAAD,CAAX;AAClC,gCAAe,KAAf;AACA,EAAA,KAAK,GAAG,KAAK,CAAC,IAAN,EAAR;;AACA,MAAI,KAAK,QAAL,CAAc,KAAd,CAAJ,EAA0B;AACtB,SAAK,MAAL,CAAY,KAAZ;AACA,WAAO,IAAP;AACH;;AACD,OAAK,GAAL,CAAS,KAAT;AACA,SAAO,IAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,SAA3C;;;AC1TA;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAT,CAA0B,KAA1B,EAAiC;AAC7B,MAAI,CAAC,oBAAW,KAAX,CAAL,EAAwB;AACpB,UAAM,IAAI,SAAJ,CAAc,uBAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,iBAAT,CAA2B,KAA3B,EAAkC;AAC9B,MAAI,CAAC,qBAAY,KAAZ,CAAL,EAAyB;AACrB,UAAM,IAAI,SAAJ,CAAc,0BAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,eAAT,CAAyB,KAAzB,EAAgC;AAC5B,MAAI,CAAC,mBAAU,KAAV,CAAL,EAAuB;AACnB,UAAM,IAAI,SAAJ,CAAc,wBAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,cAAT,CAAwB,KAAxB,EAA+B;AAC3B,MAAI,CAAC,kBAAS,KAAT,CAAL,EAAsB;AAClB,UAAM,IAAI,SAAJ,CAAc,uBAAd,CAAN;AACH;AACJ;AAGD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,cAAT,CAAwB,KAAxB,EAA+B;AAC3B,MAAI,CAAC,kBAAS,KAAT,CAAL,EAAsB;AAClB,UAAM,IAAI,SAAJ,CAAc,uBAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,aAAT,CAAuB,KAAvB,EAA8B;AAC1B,MAAI,CAAC,iBAAQ,KAAR,CAAL,EAAqB;AACjB,UAAM,IAAI,SAAJ,CAAc,0BAAd,CAAN;AACH;AACJ;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,gBAAT,CAA0B,KAA1B,EAAiC;AAC7B,MAAI,CAAC,oBAAW,KAAX,CAAL,EAAwB;AACpB,UAAM,IAAI,SAAJ,CAAc,yBAAd,CAAN;AACH;AACJ;;AAED,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,iBAA3C,EAA8D,eAA9D,EAA+E,cAA/E,EAA+F,cAA/F,EAA+G,aAA/G,EAA8H,gBAA9H,EAAgJ,gBAAhJ;;;ACpRA;;;;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,O;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,mBAAY,KAAZ,EAAmB,KAAnB,EAA0B,KAA1B,EAAiC;AAAA;;AAAA;;AAC7B;;AAEA,QAAI,OAAO,KAAP,KAAiB,QAAjB,IAA6B,KAAK,KAAK,SAAvC,IAAoD,KAAK,KAAK,SAAlE,EAA6E;AAEzE,UAAI,KAAK,GAAG,KAAK,CAAC,QAAN,GAAiB,KAAjB,CAAuB,GAAvB,CAAZ;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACA,MAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAD,CAAL,IAAY,CAAb,CAAhB;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,YAAO,IAAI,KAAJ,CAAU,4BAAV,CAAP;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,MAAA,KAAK,GAAG,CAAR;AACH;;AAED,QAAI,KAAK,KAAK,SAAd,EAAyB;AACrB,MAAA,KAAK,GAAG,CAAR;AACH;;AAED,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;AACA,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;AACA,UAAK,KAAL,GAAa,QAAQ,CAAC,KAAD,CAArB;;AAEA,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AAED,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AAED,QAAI,KAAK,CAAC,MAAK,KAAN,CAAT,EAAuB;AACnB,YAAO,IAAI,KAAJ,CAAU,uBAAV,CAAP;AACH;;AArC4B;AAuChC;AAED;AACJ;AACA;AACA;;;;;WACI,oBAAW;AACP,aAAO,KAAK,KAAL,GAAa,GAAb,GAAmB,KAAK,KAAxB,GAAgC,GAAhC,GAAsC,KAAK,KAAlD;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,mBAAU,OAAV,EAAmB;AAEf,UAAI,OAAO,YAAY,OAAvB,EAAgC;AAC5B,QAAA,OAAO,GAAG,OAAO,CAAC,QAAR,EAAV;AACH;;AAED,UAAI,OAAO,OAAP,KAAmB,QAAvB,EAAiC;AAC7B,cAAO,IAAI,KAAJ,CAAU,gBAAV,CAAP;AACH;;AAED,UAAI,OAAO,KAAK,KAAK,QAAL,EAAhB,EAAiC;AAC7B,eAAO,CAAP;AACH;;AAED,UAAI,CAAC,GAAG,CAAC,KAAK,KAAN,EAAa,KAAK,KAAlB,EAAyB,KAAK,KAA9B,CAAR;AACA,UAAI,CAAC,GAAG,OAAO,CAAC,KAAR,CAAc,GAAd,CAAR;AACA,UAAI,GAAG,GAAG,IAAI,CAAC,GAAL,CAAS,CAAC,CAAC,MAAX,EAAmB,CAAC,CAAC,MAArB,CAAV;;AAEA,WAAK,IAAI,CAAC,GAAG,CAAb,EAAgB,CAAC,GAAG,GAApB,EAAyB,CAAC,IAAI,CAA9B,EAAiC;AAC7B,YAAK,CAAC,CAAC,CAAD,CAAD,IAAQ,CAAC,CAAC,CAAC,CAAD,CAAV,IAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,CAAnC,IAA0C,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAvE,EAAgF;AAC5E,iBAAO,CAAP;AACH,SAFD,MAEO,IAAK,CAAC,CAAC,CAAD,CAAD,IAAQ,CAAC,CAAC,CAAC,CAAD,CAAV,IAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,CAAnC,IAA0C,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAR,GAAiB,QAAQ,CAAC,CAAC,CAAC,CAAD,CAAF,CAAvE,EAAgF;AACnF,iBAAO,CAAC,CAAR;AACH;AACJ;;AAED,aAAO,CAAP;AACH;;;;EA9FiB,mBAAQ,KAAR,CAAc,M;;;;AAkGpC,mBAAQ,iBAAR,CAA0B,eAA1B,EAA2C,OAA3C;;AAGA,IAAI,cAAJ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS,UAAT,GAAsB;AAClB,MAAI,cAAc,YAAY,OAA9B,EAAuC;AACnC,WAAO,cAAP;AACH;AACD;;;AACA,EAAA,cAAc,GAAG,IAAI,OAAJ,CAAY,OAAZ,CAAjB;AACA;;AACA,SAAO,cAAP;AAEH;;AAED,mBAAQ,iBAAR,CAA0B,SAA1B,EAAqC,UAArC;;;ACzLA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AACA;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,KAAT,CAAe,GAAf,EAAoB;AAEhB;AACA,MAAI,SAAS,GAAb,EAAkB;AACd,WAAO,GAAP;AACH,GALe,CAOhB;;;AACA,MAAI,qBAAY,GAAZ,CAAJ,EAAsB;AAClB,WAAO,GAAP;AACH,GAVe,CAYhB;;;AACA,MAAI,oBAAW,GAAX,CAAJ,EAAqB;AACjB,WAAO,GAAP;AACH,GAfe,CAiBhB;;;AACA,MAAI,iBAAQ,GAAR,CAAJ,EAAkB;AACd,QAAI,IAAI,GAAG,EAAX;;AACA,SAAK,IAAI,CAAC,GAAG,CAAR,EAAW,GAAG,GAAG,GAAG,CAAC,MAA1B,EAAkC,CAAC,GAAG,GAAtC,EAA2C,CAAC,EAA5C,EAAgD;AAC5C,MAAA,IAAI,CAAC,CAAD,CAAJ,GAAU,KAAK,CAAC,GAAG,CAAC,CAAD,CAAJ,CAAf;AACH;;AAED,WAAO,IAAP;AACH;;AAED,MAAI,kBAAS,GAAT,CAAJ,EAAmB;AAGf;AACA,QAAI,GAAG,YAAY,IAAnB,EAAyB;AACrB,UAAI,KAAI,GAAG,IAAI,IAAJ,EAAX;;AACA,MAAA,KAAI,CAAC,OAAL,CAAa,GAAG,CAAC,OAAJ,EAAb;;AACA,aAAO,KAAP;AACH;AAED;;;AACA,QAAI,OAAO,OAAP,KAAmB,WAAnB,IAAkC,GAAG,YAAY,OAArD,EAA8D,OAAO,GAAP;AAC9D,QAAI,OAAO,YAAP,KAAwB,WAAxB,IAAuC,GAAG,YAAY,YAA1D,EAAwE,OAAO,GAAP;AACxE,QAAI,OAAO,gBAAP,KAA4B,WAA5B,IAA2C,GAAG,YAAY,gBAA9D,EAAgF,OAAO,GAAP;AAEhF;;AACA,QAAI,OAAO,aAAP,KAAyB,WAAzB,IAAwC,GAAG,KAAK,aAApD,EAAmE,OAAO,GAAP;AACnE,QAAI,OAAO,MAAP,KAAkB,WAAlB,IAAiC,GAAG,KAAK,MAA7C,EAAqD,OAAO,GAAP;AACrD,QAAI,OAAO,QAAP,KAAoB,WAApB,IAAmC,GAAG,KAAK,QAA/C,EAAyD,OAAO,GAAP;AACzD,QAAI,OAAO,SAAP,KAAqB,WAArB,IAAoC,GAAG,KAAK,SAAhD,EAA2D,OAAO,GAAP;AAC3D,QAAI,OAAO,IAAP,KAAgB,WAAhB,IAA+B,GAAG,KAAK,IAA3C,EAAiD,OAAO,GAAP,CApBlC,CAsBf;;AACA,QAAI;AACA;AACA,UAAI,GAAG,YAAY,KAAnB,EAA0B;AACtB,eAAO,GAAP;AACH;AACJ,KALD,CAKE,OAAO,CAAP,EAAU,CACX;;AAED,WAAO,WAAW,CAAC,GAAD,CAAlB;AAEH;;AAED,QAAM,IAAI,KAAJ,CAAU,gDAAV,CAAN;AACH;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS,WAAT,CAAqB,GAArB,EAA0B;AACtB,MAAI,IAAJ;AAEA;;AACA,MAAI,QAAO,GAAG,CAAC,cAAJ,CAAmB,UAAnB,CAAP,KAAyC,GAAG,CAAC,QAAJ,KAAiB,UAA9D,EAA0E;AACtE,WAAO,GAAG,CAAC,QAAJ,EAAP;AACH;;AAED,EAAA,IAAI,GAAG,EAAP;;AACA,MAAI,OAAO,GAAG,CAAC,WAAX,KAA2B,UAA3B,IACA,OAAO,GAAG,CAAC,WAAJ,CAAgB,IAAvB,KAAgC,UADpC,EACgD;AAC5C,IAAA,IAAI,GAAG,IAAI,GAAG,CAAC,WAAR,EAAP;AACH;;AAED,OAAK,IAAI,GAAT,IAAgB,GAAhB,EAAqB;AAEjB,QAAI,CAAC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAL,EAA8B;AAC1B;AACH;;AAED,QAAI,mBAAQ,KAAR,CAAc,WAAd,CAA0B,GAAG,CAAC,GAAD,CAA7B,CAAJ,EAAyC;AACrC,MAAA,IAAI,CAAC,GAAD,CAAJ,GAAY,GAAG,CAAC,GAAD,CAAf;AACA;AACH;;AAED,IAAA,IAAI,CAAC,GAAD,CAAJ,GAAY,KAAK,CAAC,GAAG,CAAC,GAAD,CAAJ,CAAjB;AACH;;AAED,SAAO,IAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,KAA1C;;;ACpJA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACM,U;;;;;AAEF;AACJ;AACA;AACA;AACA;AACA;AACA;AACI,sBAAY,QAAZ,EAAsB;AAAA;;AAAA;;AAClB;;AAEA,QAAI,oBAAW,QAAX,CAAJ,EAA0B;AACtB,YAAK,OAAL,GAAe,QAAf;AACH,KAFD,MAEO,IAAI,QAAQ,KAAK,SAAjB,EAA4B;AAC/B,YAAM,IAAI,SAAJ,CAAc,kBAAd,CAAN;AACH,KAFM,MAEA;AACH;AACA,YAAK,OAAL,GAAe,UAAU,CAAV,EAAa,CAAb,EAAgB;AAE3B,YAAI,QAAO,CAAP,cAAoB,CAApB,CAAJ,EAA2B;AACvB,gBAAM,IAAI,SAAJ,CAAc,wBAAd,CAAN;AACH;;AAED,YAAI,CAAC,KAAK,CAAV,EAAa;AACT,iBAAO,CAAP;AACH;;AACD,eAAO,CAAC,GAAG,CAAJ,GAAQ,CAAC,CAAT,GAAa,CAApB;AACH,OAVD;AAWH;;AApBiB;AAsBrB;AAED;AACJ;AACA;AACA;AACA;;;;;WACI,mBAAU;AACN,UAAM,QAAQ,GAAG,KAAK,OAAtB;;AACA,WAAK,OAAL,GAAe,UAAC,CAAD,EAAI,CAAJ;AAAA,eAAU,QAAQ,CAAC,CAAD,EAAI,CAAJ,CAAlB;AAAA,OAAf;;AACA,aAAO,IAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,eAAM,CAAN,EAAS,CAAT,EAAY;AACR,aAAO,KAAK,OAAL,CAAa,CAAb,EAAgB,CAAhB,MAAuB,CAA9B;AACH;AAGD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,qBAAY,CAAZ,EAAe,CAAf,EAAkB;AACd,aAAO,KAAK,OAAL,CAAa,CAAb,EAAgB,CAAhB,IAAqB,CAA5B;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,4BAAmB,CAAnB,EAAsB,CAAtB,EAAyB;AACrB,aAAO,KAAK,WAAL,CAAiB,CAAjB,EAAoB,CAApB,KAA0B,KAAK,KAAL,CAAW,CAAX,EAAc,CAAd,CAAjC;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,yBAAgB,CAAhB,EAAmB,CAAnB,EAAsB;AAClB,aAAO,KAAK,QAAL,CAAc,CAAd,EAAiB,CAAjB,KAAuB,KAAK,KAAL,CAAW,CAAX,EAAc,CAAd,CAA9B;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,kBAAS,CAAT,EAAY,CAAZ,EAAe;AACX,aAAO,KAAK,OAAL,CAAa,CAAb,EAAgB,CAAhB,IAAqB,CAA5B;AACH;;;;EAvGoB,M;;;;AA4GzB,gBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,UAA1C;;;AC/JA;AAEA;AACA;AACA;;;;;;;;;;;;;AAEA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAT,CAAoB,MAApB,EAA4B;AAExB,gCAAe,MAAf,EAFwB,CAIxB;;AACA,MAAI,SAAS,GAAG,MAAM,CAAC,mBAAP,CAA2B,MAA3B,CAAhB,CALwB,CAOxB;;AAPwB,6CAQP,SARO;AAAA;;AAAA;AAQxB,wDAA4B;AAAA,UAAnB,IAAmB;AACxB,UAAI,KAAK,GAAG,MAAM,CAAC,IAAD,CAAlB;AAEA,MAAA,MAAM,CAAC,IAAD,CAAN,GAAe,KAAK,IAAI,QAAO,KAAP,MAAiB,QAA1B,GACX,UAAU,CAAC,KAAD,CADC,GACS,KADxB;AAEH;AAbuB;AAAA;AAAA;AAAA;AAAA;;AAexB,SAAO,MAAM,CAAC,MAAP,CAAc,MAAd,CAAP;AACH;;AAED,mBAAQ,iBAAR,CAA0B,cAA1B,EAA0C,UAA1C", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ "(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n\n/**\n * this function uses crypt and returns a random number.\n *\n * you can call the method via the monster namespace `Monster.Math.random()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js';\n * console.log(Monster.Math.random(1,10)) // ↦ 5\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js';\n * console.log(random(1,10)) // ↦ 5\n * </script>\n * ```\n *\n * @param {number} min starting value of the definition set (default is 0)\n * @param {number} max end value of the definition set (default is 1000000000)\n * @returns {number}\n * @memberOf Monster/Math\n\n * @since 1.0.0\n * @copyright schukai GmbH\n */\nfunction random(min, max) {\n\n if (min === undefined) {\n min = 0;\n }\n if (max === undefined) {\n max = MAX;\n }\n\n if (max < min) {\n throw new Error(\"max must be greater than min\");\n }\n\n return Math.round(create(min, max));\n\n}\n\nvar MAX = 1000000000;\n\nMath.log2 = Math.log2 || function (n) {\n return Math.log(n) / Math.log(2);\n};\n\n/**\n *\n * @param min\n * @param max\n * @returns {*}\n * @private\n */\nfunction create(min, max) {\n var crypt;\n\n if (typeof global !== \"undefined\") {\n crypt = global?.['crypto'] || global?.['msCrypto'];\n } else {\n crypt = typeof crypto !== \"undefined\" ? crypto : undefined;\n }\n\n if (typeof crypt === \"undefined\") {\n throw new Error(\"missing crypt\")\n }\n\n let rval = 0;\n const range = max - min;\n if (range < 2) {\n return min;\n }\n\n const bitsNeeded = Math.ceil(Math.log2(range));\n if (bitsNeeded > 53) {\n throw new Error(\"we cannot generate numbers larger than 53 bits.\");\n }\n const bytesNeeded = Math.ceil(bitsNeeded / 8);\n const mask = Math.pow(2, bitsNeeded) - 1;\n\n const byteArray = new Uint8Array(bytesNeeded);\n crypt.getRandomValues(byteArray);\n\n let p = (bytesNeeded - 1) * 8;\n for (var i = 0; i < bytesNeeded; i++) {\n rval += byteArray[i] * Math.pow(2, p);\n p -= 8;\n }\n\n rval = rval & mask;\n\n if (rval >= range) {\n return create(min, max);\n }\n\n return min + rval;\n\n}\n\nMonster.assignToNamespace('Monster.Math', random);\nexport {Monster, random}\n\n\n\n\n", - "/**\n * @license\n * Copyright 2021 schukai GmbH\n * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL\n * @author schukai GmbH\n */\n\n'use strict';\n\nimport {Monster} from './namespace.js';\nimport './types/id.js';\nimport './types/is.js';\nimport './types/object.js';\nimport './types/version.js';\nimport './types/observer.js';\nimport './types/observerlist.js';\nimport './types/validate.js';\nimport './math/random.js';\nimport './util/clone.js';\nimport './util/freeze.js';\n\nMonster.Util.deepFreeze(Monster);\nexport {Monster};", - "'use strict';\n\n/**\n * @namespace Monster\n * @author schukai GmbH\n */\n\n\n/**\n * Namespace class objects form the basic framework of the namespace administration.\n *\n * All functions, classes and objects of the library hang within the namespace tree.\n *\n * Via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace.\n *\n * @memberOf Monster\n \n * @copyright schukai GmbH\n * @since 1.0.0\n */\nclass Namespace {\n\n /**\n *\n * @param namespace\n * @param obj\n */\n constructor(namespace) {\n if (namespace === undefined || typeof namespace !== 'string') {\n throw new Error(\"namespace is not a string\")\n }\n this.namespace = namespace;\n }\n\n /**\n *\n * @returns {string}\n */\n getNamespace() {\n return this.namespace;\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return this.getNamespace();\n }\n}\n\n/**\n *\n * @type {Namespace}\n * @global\n */\nexport const Monster = new Namespace(\"Monster\");\n\n\n/**\n *\n */\nassignToNamespace('Monster', assignToNamespace);\n\n/**\n * To expand monster, the `Monster.assignToNamespace()` method can be used. \n *\n * you must call the method in the monster namespace. this allows you to mount your own classes, objects and functions into the namespace.\n * \n * To avoid confusion and so that you do not accidentally overwrite existing functions, you should use the custom namespace `X`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/namespace.js';\n * function hello() {\n * console.log('Hello World!');\n * }\n * Monster.assignToNamespace(\"Monster.X\",hello)\n * Monster.X.hello(); // ↦ Hello World!\n * </script>\n * \n * ```\n *\n * @param ns\n * @param obj\n * @memberOf Monster\n \n */\nfunction assignToNamespace(ns, ...obj) {\n let current = namespaceFor(ns.split(\".\"));\n\n for (let i = 0, l = obj.length; i < l; i++) {\n current[objectName(obj[i])] = obj[i];\n }\n}\n\n/**\n *\n * @param fn\n * @returns {string|*}\n * @private\n */\nfunction objectName(fn) {\n try {\n\n if (typeof fn !== 'function') {\n throw new Error(\"the first argument is not a function or class.\");\n }\n\n if (fn.hasOwnProperty('name')) {\n return fn.name;\n }\n\n if (\"function\" === typeof fn.toString) {\n let s = fn.toString();\n let f = s.match(/^\\s*function\\s+([^\\s(]+)/);\n if (Array.isArray(f) && typeof f[1] === 'string') {\n return f[1];\n }\n let c = s.match(/^\\s*class\\s+([^\\s(]+)/);\n if (Array.isArray(c) && typeof c[1] === 'string') {\n return c[1];\n }\n }\n\n } catch (e) {\n throw new Error(\"exception \" + e);\n }\n\n throw new Error(\"the name of the class or function cannot be resolved.\");\n}\n\n/**\n *\n * @param parts\n * @returns {Namespace}\n * @private\n */\nfunction namespaceFor(parts) {\n var space = Monster, ns = 'Monster';\n\n for (let i = 0; i < parts.length; i++) {\n\n if (\"Monster\" === parts[i]) {\n continue;\n }\n\n ns += '.' + parts[i];\n\n if (!space.hasOwnProperty(parts[i])) {\n space[parts[i]] = new Namespace(ns);\n }\n\n space = space[parts[i]];\n }\n\n return space;\n}\n\n\nexport {assignToNamespace}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\nlet internalCounter = 0;\n\n/**\n *\n * you can call the method via the monster namespace `new Monster.Types.ID()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js';\n * console.log(new Monster.Types.ID())\n * console.log(new Monster.Types.ID())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js';\n * console.log(new ID())\n * console.log(new ID())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass ID extends Monster.Types.Object {\n\n constructor() {\n super();\n\n internalCounter += 1;\n\n this.id = global.btoa(Monster.Math.random(1, 10000))\n .replace(/=/g, '')\n /** No numbers at the beginning of the ID, because of possible problems with DOM */\n .replace(/^[0-9]+/, 'X') + internalCounter;\n }\n\n toString() {\n return this.id;\n }\n\n}\n\nMonster.assignToNamespace('Monster.Types', ID);\nexport {Monster, ID}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n/**\n * checks whether the value passed is a primitive (string, number, boolean or symbol)\n *\n * you can call the method via the monster namespace `Monster.Types.isPrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isPrimitive('2')) // ↦ false\n * console.log(Monster.Types.isPrimitive([])) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isPrimitive('2')) // ↦ true\n * console.log(isPrimitive([])) // ↦ false\n * </script>\n * ```\n * \n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isPrimitive(value) {\n var type;\n\n if (value === undefined || value === null) {\n return true;\n }\n\n type = typeof value;\n\n if (type === 'string' || type === 'number' || type === 'boolean' || type === 'symbol') {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a boolean\n *\n * you can call the method via the monster namespace `Monster.Types.isBoolean()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isBoolean('2')) // ↦ false\n * console.log(Monster.Types.isBoolean([])) // ↦ false\n * console.log(Monster.Types.isBoolean(true)) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isBoolean('2')) // ↦ false\n * console.log(isBoolean([])) // ↦ false\n * console.log(isBoolean(2>4)) // ↦ true\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isBoolean(value) {\n\n if (value === true || value === false) {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a string\n * \n * you can call the method via the monster namespace `Monster.Types.isString()`.\n * \n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isString('2')) // ↦ true\n * console.log(Monster.Types.isString([])) // ↦ false\n * </script>\n * ```\n * \n * Alternatively, you can also integrate this function individually.\n * \n * ```\n * <script type=\"module\">\n * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isString('2')) // ↦ true\n * console.log(isString([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isString(value) {\n if (value === undefined || typeof value !== 'string') {\n return false;\n }\n return true;\n}\n\n/**\n * checks whether the value passed is a object\n *\n * you can call the method via the monster namespace `Monster.Types.isObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isObject('2')) // ↦ false\n * console.log(Monster.Types.isObject([])) // ↦ false\n * console.log(Monster.Types.isObject({})) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isObject('2')) // ↦ false\n * console.log(isObject([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isObject(value) {\n\n if (isArray(value)) return false;\n if (isPrimitive(value)) return false;\n\n if (typeof value === 'object') {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a array\n *\n * you can call the method via the monster namespace `Monster.Types.isArray()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isArray('2')) // ↦ false\n * console.log(Monster.Types.isArray([])) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isArray('2')) // ↦ false\n * console.log(isArray([])) // ↦ true\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isArray(value) {\n if (Array.isArray(value)) {\n return true;\n }\n return false;\n}\n\n/**\n * checks whether the value passed is a function\n *\n * you can call the method via the monster namespace `Monster.Types.isFunction()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isFunction(()=>{})) // ↦ true\n * console.log(Monster.Types.isFunction('2')) // ↦ false\n * console.log(Monster.Types.isFunction([])) // ↦ false\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js';\n * console.log(isFunction(()=>{})) // ↦ true\n * console.log(isFunction('2')) // ↦ false\n * console.log(isFunction([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isFunction(value) {\n if (isArray(value)) return false;\n if (isPrimitive(value)) return false;\n\n if (typeof value === 'function') {\n return true;\n }\n\n return false;\n\n}\n\nMonster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction);\nexport {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n\n/**\n * This is the base class from which all monster classes are derived.\n *\n * you can call the method via the monster namespace `new Monster.Types.Object()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js';\n * console.log(new Monster.Types.Object())\n * console.log(new Monster.Types.Object())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js';\n * console.log(new Object())\n * console.log(new Object())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Object {\n\n /**\n *\n */\n constructor() {\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this);\n };\n\n\n}\n\nMonster.assignToNamespace('Monster.Types', Object);\nexport {Monster, Object}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\n/**\n * an observer manages a callback function\n *\n * you can call the method via the monster namespace `new Monster.Types.Observer()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js';\n * console.log(new Monster.Types.Observer())\n * console.log(new Monster.Types.Observer())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js';\n * console.log(Observer())\n * console.log(Observer())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Observer extends Monster.Types.Object {\n\n constructor(callback, ...args) {\n super();\n\n if (typeof callback !== 'function') {\n throw new Error(\"observer callback must be a function\")\n }\n\n this.callback = callback;\n this.arguments = args;\n this.tags = new Set;\n }\n\n addTag(tag) {\n this.tags.add(tag);\n return this;\n }\n\n removeTag(tag) {\n this.tags.delete(tag);\n return this;\n }\n\n getTags() {\n return this.tags\n }\n\n hasTag(tag) {\n return this.tags.has(tag)\n }\n\n update(subject) {\n let self = this;\n\n return new Promise(function (resolve, reject) {\n if (!(subject instanceof Object)) {\n reject(\"subject must be an object\");\n }\n let result = self.callback.apply(subject, self.arguments);\n resolve(result);\n\n });\n\n };\n\n}\n\nMonster.assignToNamespace('Monster.Types', Observer);\nexport {Monster, Observer}\n\n\n\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\n/**\n * With the help of the ObserverList class, observer can be managed.\n *\n * you can call the method via the monster namespace `new Monster.Types.ObserverList()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js';\n * console.log(new Monster.Types.ObserverList()) \n * console.log(new Monster.Types.ObserverList()) \n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js';\n * console.log(ObserverList())\n * console.log(ObserverList())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass ObserverList extends Monster.Types.Object {\n\n constructor() {\n super();\n this.observers = [];\n }\n\n attach(observer) {\n checkIsObserver(observer);\n this.observers.push(observer);\n return this;\n };\n\n detach(observer) {\n checkIsObserver(observer);\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n if (this.observers[i] === observer) {\n this.observers.splice(i, 1);\n }\n }\n\n return this;\n };\n\n contains(observer) {\n checkIsObserver(observer);\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n if (this.observers[i] === observer) {\n return true;\n }\n }\n return false;\n };\n\n notify(subject) {\n\n let pomises = []\n\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n pomises.push(this.observers[i].update(subject));\n }\n\n return Promise.all(pomises);\n };\n\n}\n\n/**\n * \n * @param {Monster.Types.Observer} observer\n * @returns {boolean}\n * @private\n */\nfunction checkIsObserver(observer) {\n if (!(observer instanceof Monster.Types.Observer)) {\n throw new Error(\"argument must be instance of observer\")\n }\n return true;\n}\n\nMonster.assignToNamespace('Monster.Types', ObserverList);\nexport {Monster, ObserverList}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '../types/is.js';\n\n/**\n * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined\n * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validatePrimitive('2')) // ↦ undefined\n * console.log(validatePrimitive([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a primitive\n * @see {@link isPrimitive}\n * @see {@link Monster/Types/isPrimitive}\n * @see {@link Monster/Types#isPrimitive}\n */\nfunction validatePrimitive(value) {\n if (!isPrimitive(value)) {\n throw new TypeError('value is not a primitive')\n }\n}\n\n/**\n * this method checks if the type matches the boolean type. this function is identical to isBoolean() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateBoolean()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined\n * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError\n * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validateBoolean(false)) // ↦ undefined\n * console.log(validateBoolean('2')) // ↦ TypeError\n * console.log(validateBoolean([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n\n * @throws {TypeError} value is not primitive\n */\nfunction validateBoolean(value) {\n if (!isBoolean(value)) {\n throw new TypeError('value is not a boolean')\n }\n}\n\n/**\n * this method checks if the type matches the string type. this function is identical to isString() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateString()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateString('2')) // ↦ undefined\n * console.log(Monster.Types.validateString([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validateString('2')) // ↦ undefined\n * console.log(validateString([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n\n * @throws {TypeError} value is not a string\n */\nfunction validateString(value) {\n if (!isString(value)) {\n throw new TypeError('value is not a string')\n }\n}\n\n\n/**\n * this method checks if the type matches the object type. this function is identical to isObject() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateObject({})) // ↦ undefined\n * console.log(Monster.Types.validateObject('2')) // ↦ TypeError\n * console.log(Monster.Types.validateObject([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validateObject({})) // ↦ undefined\n * console.log(validateObject('2')) // ↦ TypeError\n * console.log(validateObject([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a object\n */\nfunction validateObject(value) {\n if (!isObject(value)) {\n throw new TypeError('value is not a object')\n }\n}\n\n/**\n * this method checks if the type matches the array type. this function is identical to isArray() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateArray()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateArray('2')) // ↦ TypeError\n * console.log(Monster.Types.validateArray([])) // ↦ undefined\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validateArray('2')) // ↦ TypeError\n * console.log(validateArray([])) // ↦ undefined\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a array\n */\nfunction validateArray(value) {\n if (!isArray(value)) {\n throw new TypeError('value is not not a array')\n }\n}\n\n/**\n * this method checks if the type matches the function type. this function is identical to isFunction() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateFunction()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined\n * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError\n * console.log(Monster.Types.validateFunction([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js';\n * console.log(validateFunction(()=>{})) // ↦ undefined\n * console.log(validateFunction('2')) // ↦ TypeError\n * console.log(validateFunction([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a function\n */\nfunction validateFunction(value) {\n if (!isFunction(value)) {\n throw new TypeError('value is not a function')\n }\n}\n\nMonster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction);\nexport {Monster, validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction}\n", - "'use strict';\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\n/**\n * the version object contains a sematic version number\n *\n * you can create the object via the monster namespace `new Monster.Types.Version()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js';\n * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3\n * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this class individually.\n *\n * ```\n * <script type=\"module\">\n * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js';\n * console.log(new Version('1.2.3')) // ↦ 1.2.3\n * console.log(new Version('1')) // ↦ 1.0.0\n * </script>\n * ```\n *\n * some examples\n *\n * ```\n * new Monster.Types.Version('1.0.0') // 1.0.0\n * new Monster.Types.Version(1) // 1.0.0\n * new Monster.Types.Version(1, 0, 0) // 1.0.0\n * new Monster.Types.Version('1.2.3', 4, 5) // 1.4.5\n * ```\n *\n * @since 1.0.0\n * @author schukai GmbH\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Version extends Monster.Types.Object {\n\n /**\n *\n * @param major\n * @param minor\n * @param patch\n * @throws major is not a number\n * @throws minor is not a number\n * @throws patch is not a number\n */\n constructor(major, minor, patch) {\n super();\n\n if (typeof major === 'string' && minor === undefined && patch === undefined) {\n\n let parts = major.toString().split('.');\n major = parseInt(parts[0] || 0);\n minor = parseInt(parts[1] || 0);\n patch = parseInt(parts[2] || 0);\n }\n\n if (major === undefined) {\n throw new Error(\"major version is undefined\");\n }\n\n if (minor === undefined) {\n minor = 0;\n }\n\n if (patch === undefined) {\n patch = 0;\n }\n\n this.major = parseInt(major);\n this.minor = parseInt(minor);\n this.patch = parseInt(patch);\n\n if (isNaN(this.major)) {\n throw new Error(\"major is not a number\");\n }\n\n if (isNaN(this.minor)) {\n throw new Error(\"minor is not a number\");\n }\n\n if (isNaN(this.patch)) {\n throw new Error(\"patch is not a number\");\n }\n\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return this.major + '.' + this.minor + '.' + this.patch;\n }\n\n /**\n * returns 0 if equal, -1 if the object version is less and 1 if greater\n * then the compared version\n *\n * @param {string|Version} version Version to compare\n * @returns {number}\n */\n compareTo(version) {\n\n if (version instanceof Version) {\n version = version.toString();\n }\n\n if (typeof version !== 'string') {\n throw new Error(\"type exception\");\n }\n\n if (version === this.toString()) {\n return 0;\n }\n\n let a = [this.major, this.minor, this.patch];\n let b = version.split('.');\n let len = Math.max(a.length, b.length);\n\n for (let i = 0; i < len; i += 1) {\n if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {\n return 1;\n } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {\n return -1;\n }\n }\n\n return 0;\n };\n\n}\n\nMonster.assignToNamespace('Monster.Types', Version);\n\n\nlet monsterVersion;\n\n/**\n * Version of monster\n *\n * you can call the method via the monster namespace `Monster.getVersion()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js';\n * console.log(Monster.getVersion())\n * console.log(Monster.getVersion())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js';\n * console.log(getVersion())\n * console.log(getVersion())\n * </script>\n * ```\n *\n * @returns {Monster.Types.Version}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @author schukai GmbH\n * @memberOf Monster\n */\nfunction getVersion() {\n if (monsterVersion instanceof Version) {\n return monsterVersion;\n }\n /**#@+ dont touch, replaced by make with package.json version */\n monsterVersion = new Version('1.1.0')\n /**#@-*/\n return monsterVersion;\n\n}\n\nMonster.assignToNamespace('Monster', getVersion);\nexport {Monster, Version, getVersion}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {isObject, isFunction, isPrimitive, isArray} from '../types/is.js';\n\n\n/**\n * with this function, objects can be cloned.\n * the entire object tree is run through.\n *\n * Proxy, Element, HTMLDocument and DocumentFragment instances are not cloned.\n * Global objects such as windows are also not cloned,\n *\n * If an object has a method `getClone()`, this method is used to create the clone.\n *\n * you can call the method via the monster namespace `Monster.Util.clone()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js';\n * console.log(Monster.Util.clone({}))\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js';\n * console.log(clone({}))\n * </script>\n * ```\n *\n *\n * @param {*} obj object to be cloned\n * @returns {*}\n *\n * @since 1.0.0\n * @memberOf Monster/Util\n * @copyright schukai GmbH\n * @throws {Error} unable to clone obj! its type isn't supported.\n */\nfunction clone(obj) {\n\n // typeof null results in 'object'. https://2ality.com/2013/10/typeof-null.html\n if (null === obj) {\n return obj;\n }\n\n // Handle the two simple types, null and undefined\n if (isPrimitive(obj)) {\n return obj;\n }\n \n // Handle the two simple types, null and undefined\n if (isFunction(obj)) {\n return obj;\n }\n\n // Handle Array\n if (isArray(obj)) {\n let copy = [];\n for (var i = 0, len = obj.length; i < len; i++) {\n copy[i] = clone(obj[i]);\n }\n\n return copy;\n }\n\n if (isObject(obj)) {\n\n\n // Handle Date\n if (obj instanceof Date) {\n let copy = new Date();\n copy.setTime(obj.getTime());\n return copy;\n }\n\n /** Do not clone DOM nodes */\n if (typeof Element !== 'undefined' && obj instanceof Element) return obj;\n if (typeof HTMLDocument !== 'undefined' && obj instanceof HTMLDocument) return obj;\n if (typeof DocumentFragment !== 'undefined' && obj instanceof DocumentFragment) return obj;\n\n /** Do not clone global objects */\n if (typeof globalContext !== 'undefined' && obj === globalContext) return obj;\n if (typeof window !== 'undefined' && obj === window) return obj;\n if (typeof document !== 'undefined' && obj === document) return obj;\n if (typeof navigator !== 'undefined' && obj === navigator) return obj;\n if (typeof JSON !== 'undefined' && obj === JSON) return obj;\n\n // Handle Proxy-Object\n try {\n // try/catch because possible: TypeError: Function has non-object prototype 'undefined' in instanceof check\n if (obj instanceof Proxy) {\n return obj;\n }\n } catch (e) {\n }\n\n return cloneObject(obj)\n\n }\n\n throw new Error(\"unable to clone obj! its type isn't supported.\");\n}\n\n/**\n *\n * @param {object} obj\n * @returns {object}\n * @private\n */\nfunction cloneObject(obj) {\n var copy;\n\n /** Object has clone method */\n if (typeof obj.hasOwnProperty('getClone') && obj.getClone === 'function') {\n return obj.getClone();\n }\n\n copy = {};\n if (typeof obj.constructor === 'function' &&\n typeof obj.constructor.call === 'function') {\n copy = new obj.constructor();\n }\n\n for (let key in obj) {\n\n if (!obj.hasOwnProperty(key)) {\n continue;\n }\n\n if (Monster.Types.isPrimitive(obj[key])) {\n copy[key] = obj[key];\n continue;\n }\n\n copy[key] = clone(obj[key]);\n }\n\n return copy;\n}\n\nMonster.assignToNamespace('Monster.Util', clone);\nexport {Monster, clone}\n", - "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {validateObject} from '../types/validate.js';\n\n/**\n * deep freeze a object\n *\n * you can call the method via the monster namespace `Monster.Util.deepFreeze()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js';\n * console.log(Monster.Util.deepFreeze({})) \n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js';\n * console.log(deepFreeze({})) \n * </script>\n * ```\n *\n * @param {object} obj object to be freeze\n * @since 1.0.0\n * @returns {object}\n * @memberOf Monster/Util\n * @copyright schukai GmbH\n * @throws {TypeError} value is not a object\n */\nfunction deepFreeze(object) {\n \n validateObject(object)\n\n // Retrieve the defined property names of the object\n var propNames = Object.getOwnPropertyNames(object);\n\n // Freeze properties before freezing yourself\n for (let name of propNames) {\n let value = object[name];\n\n object[name] = value && typeof value === \"object\" ?\n deepFreeze(value) : value;\n }\n\n return Object.freeze(object);\n}\n\nMonster.assignToNamespace('Monster.Util', deepFreeze);\nexport {Monster, deepFreeze}\n" + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {Object} from '../types/object.js';\n\n\n/**\n * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined.\n *\n * derived classes must implement the method isValid().\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass AbstractConstraint extends Object {\n\n /**\n *\n */\n constructor() {\n super();\n }\n\n /**\n * this method must return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n return Promise.reject(value);\n }\n}\n\nMonster.assignToNamespace('Monster.Constraints', AbstractConstraint);\nexport {Monster, AbstractConstraint}", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\n\n/**\n * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.\n * \n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass AbstractOperator extends AbstractConstraint {\n\n /**\n *\n * @param {AbstractConstraint} operantA\n * @param {AbstractConstraint} operantB\n * @throws {TypeError} \"parameters must be from type AbstractConstraint\"\n */\n constructor(operantA, operantB) {\n super();\n\n if (!(operantA instanceof AbstractConstraint) || !(operantB instanceof AbstractConstraint)) {\n throw new TypeError(\"parameters must be from type AbstractConstraint\")\n }\n\n this.operantA = operantA;\n this.operantB = operantB;\n\n }\n\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', AbstractOperator);\nexport {Monster, AbstractOperator}", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\nimport {AbstractOperator} from \"./abstractoperator.js\";\n\n/**\n * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js';\n * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false));\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js';\n * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js';\n * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false));\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass AndOperator extends AbstractOperator {\n\n /**\n * this method return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]);\n }\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', AndOperator);\nexport {Monster, AndOperator}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\n\n/**\n * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing.\n *\n * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js';\n * new Monster.Constraint.Invalid().catch(()=>console.log(true));\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js';\n * new Invalid().catch(()=>console.log(true));\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass Invalid extends AbstractConstraint {\n\n /**\n * this method return a rejected promise\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n return Promise.reject(value);\n }\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', Invalid);\nexport {Monster, Invalid}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\nimport {isArray} from \"../types/is.js\";\n\n/**\n *\n *\n * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js';\n * console.log(new Monster.Constraint.IsArray())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js';\n * console.log(new IsArray())\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass IsArray extends AbstractConstraint {\n\n /**\n * this method return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n if(isArray(value)) {\n return Promise.resolve(value);\n }\n\n return Promise.reject(value);\n }\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', IsArray);\nexport {Monster, IsArray}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\nimport {isObject} from \"../types/is.js\";\n\n/**\n *\n *\n * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js';\n * console.log(new Monster.Constraint.IsObject())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js';\n * console.log(new IsObject())\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass IsObject extends AbstractConstraint {\n\n /**\n * this method return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n if (isObject(value)) {\n return Promise.resolve(value);\n }\n\n return Promise.reject(value);\n }\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', IsObject);\nexport {Monster, IsObject}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractOperator} from \"./abstractoperator.js\";\n\n/**\n * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js';\n * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false));\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js';\n * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js';\n * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false));\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass OrOperator extends AbstractOperator {\n\n /**\n * this method return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n var self = this;\n\n return new Promise(function (resolve, reject) {\n let a, b;\n\n self.operantA.isValid(value)\n .then(function () {\n resolve();\n }).catch(function () {\n a = false;\n /** b has already been evaluated and was not true */\n if (b === false) {\n reject();\n }\n });\n\n self.operantB.isValid(value)\n .then(function () {\n resolve();\n }).catch(function () {\n b = false;\n /** b has already been evaluated and was not true */\n if (a === false) {\n reject();\n }\n });\n });\n }\n\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', OrOperator);\nexport {Monster, OrOperator}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, AbstractConstraint} from \"./abstract.js\";\n\n/**\n * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing.\n *\n * you can call the method via the monster namespace `new Monster.Constraint.Valid()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js';\n * new Monster.Constraint.Valid().then(()=>console.log(true));\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js';\n * new Valid().then(()=>console.log(true));\n * </script>\n * ```\n *\n * @since 1.3.0\n * @copyright schukai GmbH\n * @memberOf Monster/Constraints\n */\nclass Valid extends AbstractConstraint {\n\n /**\n * this method return a promise containing the result of the check.\n *\n * @param {*} value\n * @returns {Promise}\n */\n isValid(value) {\n return Promise.resolve(value);\n }\n\n}\n\nMonster.assignToNamespace('Monster.Constraints', Valid);\nexport {Monster, Valid}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n\n/**\n * this function uses crypt and returns a random number.\n *\n * you can call the method via the monster namespace `Monster.Math.random()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js';\n * console.log(Monster.Math.random(1,10)) // ↦ 5\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js';\n * console.log(random(1,10)) // ↦ 5\n * </script>\n * ```\n *\n * @param {number} min starting value of the definition set (default is 0)\n * @param {number} max end value of the definition set (default is 1000000000)\n * @returns {number}\n * @memberOf Monster/Math\n\n * @since 1.0.0\n * @copyright schukai GmbH\n */\nfunction random(min, max) {\n\n if (min === undefined) {\n min = 0;\n }\n if (max === undefined) {\n max = MAX;\n }\n\n if (max < min) {\n throw new Error(\"max must be greater than min\");\n }\n\n return Math.round(create(min, max));\n\n}\n\nvar MAX = 1000000000;\n\nMath.log2 = Math.log2 || function (n) {\n return Math.log(n) / Math.log(2);\n};\n\n/**\n *\n * @param min\n * @param max\n * @returns {*}\n * @private\n */\nfunction create(min, max) {\n var crypt;\n\n if (typeof global !== \"undefined\") {\n crypt = global?.['crypto'] || global?.['msCrypto'];\n } else {\n crypt = typeof crypto !== \"undefined\" ? crypto : undefined;\n }\n\n if (typeof crypt === \"undefined\") {\n throw new Error(\"missing crypt\")\n }\n\n let rval = 0;\n const range = max - min;\n if (range < 2) {\n return min;\n }\n\n const bitsNeeded = Math.ceil(Math.log2(range));\n if (bitsNeeded > 53) {\n throw new Error(\"we cannot generate numbers larger than 53 bits.\");\n }\n const bytesNeeded = Math.ceil(bitsNeeded / 8);\n const mask = Math.pow(2, bitsNeeded) - 1;\n\n const byteArray = new Uint8Array(bytesNeeded);\n crypt.getRandomValues(byteArray);\n\n let p = (bytesNeeded - 1) * 8;\n for (var i = 0; i < bytesNeeded; i++) {\n rval += byteArray[i] * Math.pow(2, p);\n p -= 8;\n }\n\n rval = rval & mask;\n\n if (rval >= range) {\n return create(min, max);\n }\n\n return min + rval;\n\n}\n\nMonster.assignToNamespace('Monster.Math', random);\nexport {Monster, random}\n\n\n\n\n", + "/**\n * @license\n * Copyright 2021 schukai GmbH\n * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL\n * @author schukai GmbH\n */\n\n'use strict';\n\nimport {Monster} from './namespace.js';\nimport './types/id.js';\nimport './types/is.js';\nimport './types/object.js';\nimport './types/observer.js';\nimport './types/observerlist.js';\nimport './types/proxyobserver.js';\nimport './types/version.js';\nimport './types/tokenlist.js';\nimport './types/validate.js';\nimport './types/version.js';\nimport './math/random.js';\nimport './util/clone.js';\nimport './util/comparator.js';\nimport './util/freeze.js';\nimport './constraints/abstract.js';\nimport './constraints/andoperator.js';\nimport './constraints/invalid.js';\nimport './constraints/isarray.js';\nimport './constraints/isobject.js';\nimport './constraints/abstractoperator.js';\nimport './constraints/oroperator.js';\nimport './constraints/valid.js';\n\nMonster.Util.deepFreeze(Monster);\nexport {Monster};", + "'use strict';\n\n/**\n * @namespace Monster\n * @author schukai GmbH\n */\n\n\n/**\n * namespace class objects form the basic framework of the namespace administration.\n *\n * all functions, classes and objects of the library hang within the namespace tree.\n *\n * via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace.\n *\n * @memberOf Monster\n \n * @copyright schukai GmbH\n * @since 1.0.0\n */\nclass Namespace {\n\n /**\n *\n * @param namespace\n * @param obj\n */\n constructor(namespace) {\n if (namespace === undefined || typeof namespace !== 'string') {\n throw new Error(\"namespace is not a string\")\n }\n this.namespace = namespace;\n }\n\n /**\n *\n * @returns {string}\n */\n getNamespace() {\n return this.namespace;\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return this.getNamespace();\n }\n}\n\n/**\n *\n * @type {Namespace}\n * @global\n */\nexport const Monster = new Namespace(\"Monster\");\n\n\n/**\n *\n */\nassignToNamespace('Monster', assignToNamespace);\n\n/**\n * To expand monster, the `Monster.assignToNamespace()` method can be used. \n *\n * you must call the method in the monster namespace. this allows you to mount your own classes, objects and functions into the namespace.\n * \n * To avoid confusion and so that you do not accidentally overwrite existing functions, you should use the custom namespace `X`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/namespace.js';\n * function hello() {\n * console.log('Hello World!');\n * }\n * Monster.assignToNamespace(\"Monster.X\",hello)\n * Monster.X.hello(); // ↦ Hello World!\n * </script>\n * \n * ```\n *\n * @param ns\n * @param obj\n * @memberOf Monster\n \n */\nfunction assignToNamespace(ns, ...obj) {\n let current = namespaceFor(ns.split(\".\"));\n\n for (let i = 0, l = obj.length; i < l; i++) {\n current[objectName(obj[i])] = obj[i];\n }\n}\n\n/**\n *\n * @param fn\n * @returns {string|*}\n * @private\n */\nfunction objectName(fn) {\n try {\n\n if (typeof fn !== 'function') {\n throw new Error(\"the first argument is not a function or class.\");\n }\n\n if (fn.hasOwnProperty('name')) {\n return fn.name;\n }\n\n if (\"function\" === typeof fn.toString) {\n let s = fn.toString();\n let f = s.match(/^\\s*function\\s+([^\\s(]+)/);\n if (Array.isArray(f) && typeof f[1] === 'string') {\n return f[1];\n }\n let c = s.match(/^\\s*class\\s+([^\\s(]+)/);\n if (Array.isArray(c) && typeof c[1] === 'string') {\n return c[1];\n }\n }\n\n } catch (e) {\n throw new Error(\"exception \" + e);\n }\n\n throw new Error(\"the name of the class or function cannot be resolved.\");\n}\n\n/**\n *\n * @param parts\n * @returns {Namespace}\n * @private\n */\nfunction namespaceFor(parts) {\n var space = Monster, ns = 'Monster';\n\n for (let i = 0; i < parts.length; i++) {\n\n if (\"Monster\" === parts[i]) {\n continue;\n }\n\n ns += '.' + parts[i];\n\n if (!space.hasOwnProperty(parts[i])) {\n space[parts[i]] = new Namespace(ns);\n }\n\n space = space[parts[i]];\n }\n\n return space;\n}\n\n\nexport {assignToNamespace}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {random} from '../math/random.js';\nimport '../types/object.js';\n\nlet internalCounter = 0;\n\n/**\n * id class\n *\n * you can call the method via the monster namespace `new Monster.Types.ID()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js';\n * console.log(new Monster.Types.ID())\n * console.log(new Monster.Types.ID())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js';\n * console.log(new ID())\n * console.log(new ID())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass ID extends Monster.Types.Object {\n\n /**\n * create new object\n */\n constructor() {\n super();\n\n internalCounter += 1;\n\n this.id = global.btoa(random(1, 10000))\n .replace(/=/g, '')\n /** No numbers at the beginning of the ID, because of possible problems with DOM */\n .replace(/^[0-9]+/, 'X') + internalCounter;\n }\n\n toString() {\n return this.id;\n }\n\n}\n\nMonster.assignToNamespace('Monster.Types', ID);\nexport {Monster, ID}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n/**\n * with this function you can check if a value is iterable\n *\n * you can call the method via the monster namespace `Monster.Types.isPrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isIterable(null)) // ↦ false\n * console.log(Monster.Types.isIterable('hello')) // ↦ true\n * console.log(Monster.Types.isIterable([])) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isIterable(null)) // ↦ false\n * console.log(isIterable('hello')) // ↦ true\n * console.log(isIterable([])) // ↦ true\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.2.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isIterable(value) {\n if (value === undefined) return false;\n if (value === null) return false;\n return typeof value?.[Symbol.iterator] === 'function';\n}\n\n\n/**\n * checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol)\n *\n * you can call the method via the monster namespace `Monster.Types.isPrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isPrimitive('2')) // ↦ false\n * console.log(Monster.Types.isPrimitive([])) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isPrimitive('2')) // ↦ true\n * console.log(isPrimitive([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isPrimitive(value) {\n var type;\n\n if (value === undefined || value === null || value === NaN) {\n return true;\n }\n\n type = typeof value;\n\n if (type === 'string' || type === 'number' || type === 'boolean' || type === 'symbol') {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a boolean\n *\n * you can call the method via the monster namespace `Monster.Types.isBoolean()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isBoolean('2')) // ↦ false\n * console.log(Monster.Types.isBoolean([])) // ↦ false\n * console.log(Monster.Types.isBoolean(true)) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isBoolean('2')) // ↦ false\n * console.log(isBoolean([])) // ↦ false\n * console.log(isBoolean(2>4)) // ↦ true\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isBoolean(value) {\n\n if (value === true || value === false) {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a string\n *\n * you can call the method via the monster namespace `Monster.Types.isString()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isString('2')) // ↦ true\n * console.log(Monster.Types.isString([])) // ↦ false\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isString('2')) // ↦ true\n * console.log(isString([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isString(value) {\n if (value === undefined || typeof value !== 'string') {\n return false;\n }\n return true;\n}\n\n/**\n * checks whether the value passed is a object\n *\n * you can call the method via the monster namespace `Monster.Types.isObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isObject('2')) // ↦ false\n * console.log(Monster.Types.isObject([])) // ↦ false\n * console.log(Monster.Types.isObject({})) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isObject('2')) // ↦ false\n * console.log(isObject([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isObject(value) {\n\n if (isArray(value)) return false;\n if (isPrimitive(value)) return false;\n\n if (typeof value === 'object') {\n return true;\n }\n\n return false;\n}\n\n/**\n * checks whether the value passed is a array\n *\n * you can call the method via the monster namespace `Monster.Types.isArray()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isArray('2')) // ↦ false\n * console.log(Monster.Types.isArray([])) // ↦ true\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isArray('2')) // ↦ false\n * console.log(isArray([])) // ↦ true\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isArray(value) {\n if (Array.isArray(value)) {\n return true;\n }\n return false;\n}\n\n/**\n * checks whether the value passed is a function\n *\n * you can call the method via the monster namespace `Monster.Types.isFunction()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(Monster.Types.isFunction(()=>{})) // ↦ true\n * console.log(Monster.Types.isFunction('2')) // ↦ false\n * console.log(Monster.Types.isFunction([])) // ↦ false\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js';\n * console.log(isFunction(()=>{})) // ↦ true\n * console.log(isFunction('2')) // ↦ false\n * console.log(isFunction([])) // ↦ false\n * </script>\n * ```\n *\n * @param {*} value\n * @returns {boolean}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nfunction isFunction(value) {\n if (isArray(value)) return false;\n if (isPrimitive(value)) return false;\n\n if (typeof value === 'function') {\n return true;\n }\n\n return false;\n\n}\n\nMonster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable);\nexport {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\n\n\n/**\n * This is the base class from which all monster classes are derived.\n *\n * you can call the method via the monster namespace `new Monster.Types.Object()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js';\n * console.log(new Monster.Types.Object())\n * console.log(new Monster.Types.Object())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js';\n * console.log(new Object())\n * console.log(new Object())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Object {\n\n /**\n *\n */\n constructor() {\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this);\n };\n\n\n}\n\nMonster.assignToNamespace('Monster.Types', Object);\nexport {Monster, Object}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {TokenList} from '../types/tokenlist.js';\nimport {isObject} from '../types/is.js';\nimport '../types/object.js';\n\n/**\n * an observer manages a callback function\n *\n * you can call the method via the monster namespace `new Monster.Types.Observer()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js';\n * console.log(new Monster.Types.Observer())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js';\n * console.log(Observer())\n * </script>\n * ```\n *\n * the update method is called with the subject object as this pointer. for this reason the callback should not\n * be an arrow function, because it gets the this pointer of its own context.\n *\n * ```\n * <script>\n * Observer(()=>{\n * // this is not subject\n * })\n *\n * Observer(function() {\n * // this is subject\n * })\n * </script>\n * ```\n *\n * additional arguments can be passed to the callback. to do this, simply specify them.\n *\n * ```\n * <script>\n * Observer(function(a, b, c) {\n * console.log(a, b, c); // ↦ \"a\", 2, true \n * }, \"a\", 2, true)\n * </script>\n * ```\n * \n * the callback function must have as many parameters as arguments are given.\n *\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Observer extends Monster.Types.Object {\n\n /**\n *\n * @param {function} callback\n * @param {*} args\n */\n constructor(callback, ...args) {\n super();\n\n if (typeof callback !== 'function') {\n throw new Error(\"observer callback must be a function\")\n }\n\n this.callback = callback;\n this.arguments = args;\n this.tags = new TokenList;\n }\n\n /**\n *\n * @param {string} tag\n * @returns {Observer}\n */\n addTag(tag) {\n this.tags.add(tag);\n return this;\n }\n\n /**\n *\n * @param {string} tag\n * @returns {Observer}\n */\n removeTag(tag) {\n this.tags.remove(tag);\n return this;\n }\n\n /**\n *\n * @returns {Array}\n */\n getTags() {\n return this.tags.entries()\n }\n\n /**\n *\n * @param {string} tag\n * @returns {boolean}\n */\n hasTag(tag) {\n return this.tags.contains(tag)\n }\n\n /**\n *\n * @param {object} subject\n * @returns {Promise}\n */\n update(subject) {\n let self = this;\n\n return new Promise(function (resolve, reject) {\n if (!isObject(subject)) {\n reject(\"subject must be an object\");\n }\n let result = self.callback.apply(subject, self.arguments);\n resolve(result);\n\n });\n\n };\n\n}\n\nMonster.assignToNamespace('Monster.Types', Observer);\nexport {Monster, Observer}\n\n\n\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\n/**\n * With the help of the ObserverList class, observer can be managed.\n *\n * you can call the method via the monster namespace `new Monster.Types.ObserverList()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js';\n * console.log(new Monster.Types.ObserverList()) \n * console.log(new Monster.Types.ObserverList()) \n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js';\n * console.log(ObserverList())\n * console.log(ObserverList())\n * </script>\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass ObserverList extends Monster.Types.Object {\n\n constructor() {\n super();\n this.observers = [];\n }\n\n attach(observer) {\n checkIsObserver(observer);\n this.observers.push(observer);\n return this;\n };\n\n detach(observer) {\n checkIsObserver(observer);\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n if (this.observers[i] === observer) {\n this.observers.splice(i, 1);\n }\n }\n\n return this;\n };\n\n contains(observer) {\n checkIsObserver(observer);\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n if (this.observers[i] === observer) {\n return true;\n }\n }\n return false;\n };\n\n notify(subject) {\n\n let pomises = []\n\n var i = 0, l = this.observers.length;\n for (; i < l; i++) {\n pomises.push(this.observers[i].update(subject));\n }\n\n return Promise.all(pomises);\n };\n\n}\n\n/**\n * \n * @param {Monster.Types.Observer} observer\n * @returns {boolean}\n * @private\n */\nfunction checkIsObserver(observer) {\n if (!(observer instanceof Monster.Types.Observer)) {\n throw new Error(\"argument must be instance of observer\")\n }\n return true;\n}\n\nMonster.assignToNamespace('Monster.Types', ObserverList);\nexport {Monster, ObserverList}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {Object} from '../types/object.js';\nimport {validateObject} from \"./validate.js\";\nimport {ObserverList} from \"./observerlist.js\";\nimport {Observer} from \"./observer.js\";\nimport {isObject, isArray} from \"./is.js\";\n\n/**\n * store proxy objects\n *\n * @type {WeakSet<object>}\n */\nvar proxySet = new WeakSet();\n\n// language=JavaScript\n/**\n * an observer manages a callback function\n *\n * you can call the method via the monster namespace `new Monster.Types.Observer()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js';\n * console.log(new Monster.Types.ProxyObserver())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js';\n * console.log(new ProxyObserver())\n * </script>\n * ```\n *\n * with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place.\n *\n * this also applies to nested objects.\n *\n * ```javascript\n * const o = new Observer(function () {\n * if (isObject(this) && this instanceof ProxyObserver) {\n * // do something (this ist ProxyObserver)\n * const subject = this.getSubject();\n * }\n * )\n * \n * let realSubject = {\n * a: {\n * b: {\n * c: true\n * },\n * d: 5\n * }\n * \n * \n * const p = new ProxyObserver(realSubject);\n * p.attachObserver(o);\n * const s = p.getSubject();\n * s.a.b.c = false;\n * ```\n *\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass ProxyObserver extends Object {\n\n /**\n *\n * @param {object} object\n */\n constructor(object) {\n super();\n validateObject(object);\n this.realSubject = object\n this.subject = new Proxy(object, getHandler.call(this));\n proxySet.add(this.subject);\n this.observers = new ObserverList;\n }\n\n /**\n * get the real object\n *\n * changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later.\n *\n * @returns {object}\n */\n getSubject() {\n return this.subject\n }\n\n /**\n * get the proxied object\n *\n * @returns {object}\n */ getRealSubject() {\n return this.realSubject\n }\n\n /**\n * attach a new observer\n *\n * @param {Observer} observer\n * @returns {ProxyObserver}\n */\n attachObserver(observer) {\n this.observers.attach(observer)\n return this;\n }\n\n /**\n * detach a observer\n *\n * @param {Observer} observer\n * @returns {ProxyObserver}\n */\n detachObserver(observer) {\n this.observers.detach(observer)\n return this;\n }\n\n /**\n * notify all observer\n *\n * @returns {ProxyObserver}\n */\n notifyObservers() {\n this.observers.notify(this);\n return this;\n }\n\n /**\n * @param {Observer} observer\n * @returns {ProxyObserver}\n */\n containsObserver(observer) {\n return this.observers.contains(observer)\n }\n\n}\n\nMonster.assignToNamespace('Monster.Types', ProxyObserver);\nexport {Monster, ProxyObserver}\n\n/**\n *\n * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}}\n * @private\n * @see {@link https://gitlab.schukai.com/-/snippets/49}\n */\nfunction getHandler() {\n\n const proxy = this;\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots\n const handler = {\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver\n get: function (target, property, receiver) {\n const prop = target?.[property];\n\n // return if property not found\n if (prop === undefined) {\n return undefined;\n }\n\n // set value as proxy if object or array\n if (isArray(prop) || isObject(prop) && !proxySet.has(prop)) {\n target[property] = new Proxy(prop, handler);\n proxySet.add(prop);\n }\n\n return target[property];\n\n },\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver \n set: function (target, property, value, receiver) {\n target[property] = value\n proxy.observers.notify(proxy);\n return true;\n },\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p\n deleteProperty: function (target, property) {\n if (property in target) {\n delete target[property];\n proxy.observers.notify(proxy);\n return true;\n }\n return false;\n },\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc\n defineProperty: function (target, property, descriptor) {\n let result = Reflect.defineProperty(target, property, descriptor);\n proxy.observers.notify(proxy);\n return parseURLToResultingURLRecord();\n },\n\n // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v\n setPrototypeOf: function (target, prototype) {\n let result = Reflect.setPrototypeOf(object1, prototype);\n proxy.observers.notify(proxy);\n return result;\n }\n\n };\n\n\n return handler;\n}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {Object} from '../types/object.js';\nimport {isString, isIterable} from '../types/is.js';\nimport {validateString, validateFunction} from '../types/validate.js';\n\n/**\n * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string).\n *\n * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list.\n *\n * you can call the method via the monster namespace `new Monster.Types.TokenList()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js';\n * console.log(new Monster.Types.TokenList(\"myclass row\"))\n * console.log(new Monster.Types.TokenList(\"myclass row\"))\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js';\n * console.log(new TokenList(\"myclass row\"))\n * console.log(new TokenList(\"myclass row\"))\n * </script>\n * ```\n *\n * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).\n *\n * ```\n * console.log(typeof new TokenList(\"myclass row\")[Symbol.iterator]); // \"function\"\n * ```\n *\n *\n * @since 1.2.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass TokenList extends Object {\n\n /**\n *\n * @param {array|string|iteratable} init\n */\n constructor(init) {\n super();\n this.tokens = new Set();\n\n if (typeof init !== \"undefined\") {\n this.add(init);\n }\n\n }\n\n /**\n * Iterator protocol\n *\n * @returns {Symbol.iterator}\n */\n getIterator() {\n return this[Symbol.iterator]();\n }\n\n /**\n * Iterator\n *\n * @returns {{next: ((function(): ({value: *, done: boolean}))|*)}}\n */\n [Symbol.iterator]() {\n // Use a new index for each iterator. This makes multiple\n // iterations over the iterable safe for non-trivial cases,\n // such as use of break or nested looping over the same iterable.\n let index = 0;\n let entries = this.entries()\n\n return {\n next: () => {\n if (index < entries.length) {\n return {value: entries?.[index++], done: false}\n } else {\n return {done: true}\n }\n }\n }\n }\n\n /**\n * Returns true if it contains token, otherwise false\n *\n * ```\n * new TokenList(\"start middle end\").contains('start')); // ↦ true\n * new TokenList(\"start middle end\").contains('end')); // ↦ true\n * new TokenList(\"start middle end\").contains('xyz')); // ↦ false\n * new TokenList(\"start middle end\").contains(['end','start','middle'])); // ↦ true\n * new TokenList(\"start middle end\").contains(['end','start','xyz'])); // ↦ false\n * ```\n *\n * @param {array|string|iteratable} value\n * @returns {boolean}\n */\n contains(value) {\n if (isString(value)) {\n value = value.trim()\n let counter = 0;\n value.split(\" \").forEach(token => {\n if (this.tokens.has(token.trim()) === false) return false;\n counter++\n })\n return counter > 0 ? true : false;\n }\n\n if (isIterable(value)) {\n let counter = 0;\n for (let token of value) {\n validateString(token);\n if (this.tokens.has(token.trim()) === false) return false;\n counter++\n }\n return counter > 0 ? true : false;\n }\n\n return false;\n }\n\n /**\n * add tokens\n *\n * ```\n * new TokenList().add(\"abc xyz\").toString(); // ↦ \"abc xyz\"\n * new TokenList().add([\"abc\",\"xyz\"]).toString(); // ↦ \"abc xyz\"\n * new TokenList().add(undefined); // ↦ add nothing\n * ```\n *\n * @param {array|string|iteratable} value\n * @returns {TokenList}\n * @throws {TypeError} unsupported value\n */\n add(value) {\n if (isString(value)) {\n value.split(\" \").forEach(token => {\n this.tokens.add(token.trim());\n })\n } else if (isIterable(value)) {\n for (let token of value) {\n validateString(token);\n this.tokens.add(token.trim());\n }\n } else if (typeof value !== \"undefined\") {\n throw new TypeError(\"unsupported value\");\n }\n\n return this;\n }\n\n /**\n * remove all tokens\n *\n * @returns {TokenList}\n */\n clear() {\n this.tokens.clear();\n return this;\n }\n\n /**\n * Removes token\n *\n * ```\n * new TokenList(\"abc xyz\").remove(\"xyz\").toString(); // ↦ \"abc\"\n * new TokenList(\"abc xyz\").remove([\"xyz\"]).toString(); // ↦ \"abc\"\n * new TokenList(\"abc xyz\").remove(undefined); // ↦ remove nothing\n * ```\n *\n * @param {array|string|iteratable} value\n * @returns {TokenList}\n * @throws {TypeError} unsupported value\n */\n remove(value) {\n if (isString(value)) {\n value.split(\" \").forEach(token => {\n this.tokens.delete(token.trim());\n })\n } else if (isIterable(value)) {\n for (let token of value) {\n validateString(token);\n this.tokens.delete(token.trim());\n }\n } else if (typeof value !== \"undefined\") {\n throw new TypeError(\"unsupported value\");\n }\n\n return this;\n }\n\n /**\n * this method replaces a token with a new token.\n *\n * if the passed token exists, it is replaced with newToken and TokenList is returned.\n * if the token does not exist, newToken is not set and TokenList is returned.\n *\n * @param {string} token\n * @param {string} newToken\n * @returns {TokenList}\n */\n replace(token, newToken) {\n validateString(token);\n validateString(newToken);\n if (!this.contains(token)) {\n return this;\n }\n\n let a = Array.from(this.tokens)\n let i = a.indexOf(token);\n if (i === -1) return this;\n\n a.splice(i, 1, newToken);\n this.tokens = new Set();\n this.add(a);\n\n return this;\n\n\n }\n\n /**\n * Removes token from string. If token doesn't exist it's added.\n * \n * ```\n * new TokenList(\"abc def ghi\").toggle(\"def xyz\").toString(); // ↦ \"abc ghi xyz\"\n * new TokenList(\"abc def ghi\").toggle([\"abc\",\"xyz\"]).toString(); // ↦ \"def ghi xyz\"\n * new TokenList().toggle(undefined); // ↦ nothing\n * ```\n * \n * @param {array|string|iteratable} value\n * @returns {boolean}\n * @throws {TypeError} unsupported value\n */\n toggle(value) {\n\n if (isString(value)) {\n value.split(\" \").forEach(token => {\n toggleValue.call(this, token);\n })\n } else if (isIterable(value)) {\n for (let token of value) {\n toggleValue.call(this, token);\n }\n } else if (typeof value !== \"undefined\") {\n throw new TypeError(\"unsupported value\");\n }\n\n return this;\n\n }\n\n /**\n * returns an array with all tokens\n *\n * @returns {array}\n */\n entries() {\n return Array.from(this.tokens)\n }\n\n /**\n * executes the provided function with each value of the set\n *\n * @param {function} callback\n * @returns {TokenList}\n */\n forEach(callback) {\n validateFunction(callback);\n this.tokens.forEach(callback);\n return this;\n }\n\n /**\n * returns the individual tokens separated by a blank character\n *\n * @returns {string}\n */\n toString() {\n return this.entries().join(' ');\n }\n\n}\n\n/**\n * @private\n * @param token\n * @returns {toggleValue}\n * @throws {Error} must be called with TokenList.call\n */\nfunction toggleValue(token) {\n if (!(this instanceof TokenList)) throw Error(\"must be called with TokenList.call\")\n validateString(token);\n token = token.trim();\n if (this.contains(token)) {\n this.remove(token);\n return this;\n }\n this.add(token);\n return this;\n}\n\nMonster.assignToNamespace('Monster.Types', TokenList);\nexport {Monster, TokenList}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable} from '../types/is.js';\n\n/**\n * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError\n * console.log(Monster.Types.validateIterable([])) // ↦ undefined\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateIterable('2')) // ↦ TypeError\n * console.log(validateIterable([])) // ↦ undefined\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.2.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a primitive\n * @see {@link isPrimitive}\n * @see {@link Monster/Types/isPrimitive}\n * @see {@link Monster/Types#isPrimitive}\n */\nfunction validateIterable(value) {\n if (!isIterable(value)) {\n throw new TypeError('value is not iterable')\n }\n}\n\n/**\n * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined\n * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validatePrimitive('2')) // ↦ undefined\n * console.log(validatePrimitive([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a primitive\n * @see {@link isPrimitive}\n * @see {@link Monster/Types/isPrimitive}\n * @see {@link Monster/Types#isPrimitive}\n */\nfunction validatePrimitive(value) {\n if (!isPrimitive(value)) {\n throw new TypeError('value is not a primitive')\n }\n}\n\n/**\n * this method checks if the type matches the boolean type. this function is identical to isBoolean() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateBoolean()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined\n * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError\n * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateBoolean(false)) // ↦ undefined\n * console.log(validateBoolean('2')) // ↦ TypeError\n * console.log(validateBoolean([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n\n * @throws {TypeError} value is not primitive\n */\nfunction validateBoolean(value) {\n if (!isBoolean(value)) {\n throw new TypeError('value is not a boolean')\n }\n}\n\n/**\n * this method checks if the type matches the string type. this function is identical to isString() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateString()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateString('2')) // ↦ undefined\n * console.log(Monster.Types.validateString([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateString('2')) // ↦ undefined\n * console.log(validateString([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n\n * @throws {TypeError} value is not a string\n */\nfunction validateString(value) {\n if (!isString(value)) {\n throw new TypeError('value is not a string')\n }\n}\n\n\n/**\n * this method checks if the type matches the object type. this function is identical to isObject() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateObject()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateObject({})) // ↦ undefined\n * console.log(Monster.Types.validateObject('2')) // ↦ TypeError\n * console.log(Monster.Types.validateObject([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateObject({})) // ↦ undefined\n * console.log(validateObject('2')) // ↦ TypeError\n * console.log(validateObject([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a object\n */\nfunction validateObject(value) {\n if (!isObject(value)) {\n throw new TypeError('value is not a object')\n }\n}\n\n/**\n * this method checks if the type matches the array type. this function is identical to isArray() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateArray()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateArray('2')) // ↦ TypeError\n * console.log(Monster.Types.validateArray([])) // ↦ undefined\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateArray('2')) // ↦ TypeError\n * console.log(validateArray([])) // ↦ undefined\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a array\n */\nfunction validateArray(value) {\n if (!isArray(value)) {\n throw new TypeError('value is not not a array')\n }\n}\n\n/**\n * this method checks if the type matches the function type. this function is identical to isFunction() except that a TypeError is thrown.\n *\n * you can call the method via the monster namespace `Monster.Types.validateFunction()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined\n * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError\n * console.log(Monster.Types.validateFunction([])) // ↦ TypeError\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js';\n * console.log(validateFunction(()=>{})) // ↦ undefined\n * console.log(validateFunction('2')) // ↦ TypeError\n * console.log(validateFunction([])) // ↦ TypeError\n * </script>\n * ```\n *\n * @param {*} value\n * @return {undefined}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n * @throws {TypeError} value is not a function\n */\nfunction validateFunction(value) {\n if (!isFunction(value)) {\n throw new TypeError('value is not a function')\n }\n}\n\nMonster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable);\nexport {\n Monster,\n validatePrimitive,\n validateBoolean,\n validateString,\n validateObject,\n validateArray,\n validateFunction,\n validateIterable\n}\n", + "'use strict';\n\nimport {Monster} from '../namespace.js';\nimport '../types/object.js';\n\n/**\n * the version object contains a sematic version number\n *\n * you can create the object via the monster namespace `new Monster.Types.Version()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js';\n * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3\n * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this class individually.\n *\n * ```\n * <script type=\"module\">\n * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js';\n * console.log(new Version('1.2.3')) // ↦ 1.2.3\n * console.log(new Version('1')) // ↦ 1.0.0\n * </script>\n * ```\n *\n * some examples\n *\n * ```\n * new Monster.Types.Version('1.0.0') // 1.0.0\n * new Monster.Types.Version(1) // 1.0.0\n * new Monster.Types.Version(1, 0, 0) // 1.0.0\n * new Monster.Types.Version('1.2.3', 4, 5) // 1.4.5\n * ```\n *\n * @since 1.0.0\n * @author schukai GmbH\n * @copyright schukai GmbH\n * @memberOf Monster/Types\n */\nclass Version extends Monster.Types.Object {\n\n /**\n *\n * @param major\n * @param minor\n * @param patch\n * @throws major is not a number\n * @throws minor is not a number\n * @throws patch is not a number\n */\n constructor(major, minor, patch) {\n super();\n\n if (typeof major === 'string' && minor === undefined && patch === undefined) {\n\n let parts = major.toString().split('.');\n major = parseInt(parts[0] || 0);\n minor = parseInt(parts[1] || 0);\n patch = parseInt(parts[2] || 0);\n }\n\n if (major === undefined) {\n throw new Error(\"major version is undefined\");\n }\n\n if (minor === undefined) {\n minor = 0;\n }\n\n if (patch === undefined) {\n patch = 0;\n }\n\n this.major = parseInt(major);\n this.minor = parseInt(minor);\n this.patch = parseInt(patch);\n\n if (isNaN(this.major)) {\n throw new Error(\"major is not a number\");\n }\n\n if (isNaN(this.minor)) {\n throw new Error(\"minor is not a number\");\n }\n\n if (isNaN(this.patch)) {\n throw new Error(\"patch is not a number\");\n }\n\n }\n\n /**\n *\n * @returns {string}\n */\n toString() {\n return this.major + '.' + this.minor + '.' + this.patch;\n }\n\n /**\n * returns 0 if equal, -1 if the object version is less and 1 if greater\n * then the compared version\n *\n * @param {string|Version} version Version to compare\n * @returns {number}\n */\n compareTo(version) {\n\n if (version instanceof Version) {\n version = version.toString();\n }\n\n if (typeof version !== 'string') {\n throw new Error(\"type exception\");\n }\n\n if (version === this.toString()) {\n return 0;\n }\n\n let a = [this.major, this.minor, this.patch];\n let b = version.split('.');\n let len = Math.max(a.length, b.length);\n\n for (let i = 0; i < len; i += 1) {\n if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {\n return 1;\n } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {\n return -1;\n }\n }\n\n return 0;\n };\n\n}\n\nMonster.assignToNamespace('Monster.Types', Version);\n\n\nlet monsterVersion;\n\n/**\n * Version of monster\n *\n * you can call the method via the monster namespace `Monster.getVersion()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js';\n * console.log(Monster.getVersion())\n * console.log(Monster.getVersion())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js';\n * console.log(getVersion())\n * console.log(getVersion())\n * </script>\n * ```\n *\n * @returns {Monster.Types.Version}\n * @since 1.0.0\n * @copyright schukai GmbH\n * @author schukai GmbH\n * @memberOf Monster\n */\nfunction getVersion() {\n if (monsterVersion instanceof Version) {\n return monsterVersion;\n }\n /**#@+ dont touch, replaced by make with package.json version */\n monsterVersion = new Version('1.3.0')\n /**#@-*/\n return monsterVersion;\n\n}\n\nMonster.assignToNamespace('Monster', getVersion);\nexport {Monster, Version, getVersion}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {isObject, isFunction, isPrimitive, isArray} from '../types/is.js';\n\n\n/**\n * with this function, objects can be cloned.\n * the entire object tree is run through.\n *\n * Proxy, Element, HTMLDocument and DocumentFragment instances are not cloned.\n * Global objects such as windows are also not cloned,\n *\n * If an object has a method `getClone()`, this method is used to create the clone.\n *\n * you can call the method via the monster namespace `Monster.Util.clone()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js';\n * console.log(Monster.Util.clone({}))\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js';\n * console.log(clone({}))\n * </script>\n * ```\n *\n *\n * @param {*} obj object to be cloned\n * @returns {*}\n *\n * @since 1.0.0\n * @memberOf Monster/Util\n * @copyright schukai GmbH\n * @throws {Error} unable to clone obj! its type isn't supported.\n */\nfunction clone(obj) {\n\n // typeof null results in 'object'. https://2ality.com/2013/10/typeof-null.html\n if (null === obj) {\n return obj;\n }\n\n // Handle the two simple types, null and undefined\n if (isPrimitive(obj)) {\n return obj;\n }\n \n // Handle the two simple types, null and undefined\n if (isFunction(obj)) {\n return obj;\n }\n\n // Handle Array\n if (isArray(obj)) {\n let copy = [];\n for (var i = 0, len = obj.length; i < len; i++) {\n copy[i] = clone(obj[i]);\n }\n\n return copy;\n }\n\n if (isObject(obj)) {\n\n\n // Handle Date\n if (obj instanceof Date) {\n let copy = new Date();\n copy.setTime(obj.getTime());\n return copy;\n }\n\n /** Do not clone DOM nodes */\n if (typeof Element !== 'undefined' && obj instanceof Element) return obj;\n if (typeof HTMLDocument !== 'undefined' && obj instanceof HTMLDocument) return obj;\n if (typeof DocumentFragment !== 'undefined' && obj instanceof DocumentFragment) return obj;\n\n /** Do not clone global objects */\n if (typeof globalContext !== 'undefined' && obj === globalContext) return obj;\n if (typeof window !== 'undefined' && obj === window) return obj;\n if (typeof document !== 'undefined' && obj === document) return obj;\n if (typeof navigator !== 'undefined' && obj === navigator) return obj;\n if (typeof JSON !== 'undefined' && obj === JSON) return obj;\n\n // Handle Proxy-Object\n try {\n // try/catch because possible: TypeError: Function has non-object prototype 'undefined' in instanceof check\n if (obj instanceof Proxy) {\n return obj;\n }\n } catch (e) {\n }\n\n return cloneObject(obj)\n\n }\n\n throw new Error(\"unable to clone obj! its type isn't supported.\");\n}\n\n/**\n *\n * @param {object} obj\n * @returns {object}\n * @private\n */\nfunction cloneObject(obj) {\n var copy;\n\n /** Object has clone method */\n if (typeof obj.hasOwnProperty('getClone') && obj.getClone === 'function') {\n return obj.getClone();\n }\n\n copy = {};\n if (typeof obj.constructor === 'function' &&\n typeof obj.constructor.call === 'function') {\n copy = new obj.constructor();\n }\n\n for (let key in obj) {\n\n if (!obj.hasOwnProperty(key)) {\n continue;\n }\n\n if (Monster.Types.isPrimitive(obj[key])) {\n copy[key] = obj[key];\n continue;\n }\n\n copy[key] = clone(obj[key]);\n }\n\n return copy;\n}\n\nMonster.assignToNamespace('Monster.Util', clone);\nexport {Monster, clone}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster, Object} from '../types/object.js';\nimport {isFunction} from '../types/is.js';\n\n/**\n * the comparator allows a comparison function to be abstracted.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js';\n * console.log(new Monster.Util.Comparator())\n * console.log(new Monster.Util.Comparator())\n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js';\n * console.log(new Util())\n * console.log(new Util())\n * </script>\n * ```\n * \n * the following are some examples of the application of the class.\n *\n * ```\n * new Comparator().lessThanOrEqual(2, 5) // ↦ true\n * new Comparator().greaterThan(4, 2) // ↦ true\n * new Comparator().equal(4, 4) // ↦ true\n * new Comparator().equal(4, 5) // ↦ false\n * ```\n * \n * you can also pass your own comparison function, and thus define the comparison function.\n * \n * ```\n * new Comparator(function (a, b) {\n * if (a.v === b.v) return 0;\n * return a.v < b.v ? -1 : 1;\n * }).equal({v: 2}, {v: 2}); // ↦ true\n * ```\n *\n * @since 1.3.0\n * @memberOf Monster/Util\n */\nclass Comparator extends Object {\n\n /**\n * create new comparator\n *\n * @param {function} callback\n * @throw {TypeError} \"unsupported type\"\n * @throw {TypeError} \"impractical comparison\"\n */\n constructor(callback) {\n super();\n\n if (isFunction(callback)) {\n this.compare = callback\n } else if (callback !== undefined) {\n throw new TypeError(\"unsupported type\")\n } else {\n // default compare function\n this.compare = function (a, b) {\n\n if (typeof a !== typeof b) {\n throw new TypeError(\"impractical comparison\")\n }\n\n if (a === b) {\n return 0;\n }\n return a < b ? -1 : 1;\n };\n }\n\n }\n\n /**\n * changes the order of the operators\n *\n * @return {Comparator}\n */\n reverse() {\n const original = this.compare;\n this.compare = (a, b) => original(b, a);\n return this;\n }\n\n /**\n * Checks if two variables are equal.\n *\n * @param {*} a\n * @param {*} b\n *\n * @return {boolean}\n */\n equal(a, b) {\n return this.compare(a, b) === 0;\n }\n\n\n /**\n * Checks if variable `a` is greater than `b`\n *\n * @param {*} a\n * @param {*} b\n *\n * @return {boolean}\n */\n greaterThan(a, b) {\n return this.compare(a, b) > 0;\n }\n\n /**\n * Checks if variable `a` is greater than or equal to `b`\n *\n * @param {*} a\n * @param {*} b\n *\n * @return {boolean}\n */\n greaterThanOrEqual(a, b) {\n return this.greaterThan(a, b) || this.equal(a, b);\n }\n\n /**\n * Checks if variable `a` is less than or equal to `b`\n *\n * @param {*} a\n * @param {*} b\n *\n * @return {boolean}\n */\n lessThanOrEqual(a, b) {\n return this.lessThan(a, b) || this.equal(a, b);\n }\n\n /**\n * Checks if variable a is less than b\n *\n * @param {*} a\n * @param {*} b\n *\n * @return {boolean}\n */\n lessThan(a, b) {\n return this.compare(a, b) < 0;\n }\n\n\n}\n\nMonster.assignToNamespace('Monster.Util', Comparator);\nexport {Monster, Comparator}\n", + "'use strict';\n\n/**\n * @author schukai GmbH\n */\n\nimport {Monster} from '../namespace.js';\nimport {validateObject} from '../types/validate.js';\n\n/**\n * deep freeze a object\n *\n * you can call the method via the monster namespace `Monster.Util.deepFreeze()`.\n *\n * ```\n * <script type=\"module\">\n * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js';\n * console.log(Monster.Util.deepFreeze({})) \n * </script>\n * ```\n *\n * Alternatively, you can also integrate this function individually.\n *\n * ```\n * <script type=\"module\">\n * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js';\n * console.log(deepFreeze({})) \n * </script>\n * ```\n *\n * @param {object} obj object to be freeze\n * @since 1.0.0\n * @returns {object}\n * @memberOf Monster/Util\n * @copyright schukai GmbH\n * @throws {TypeError} value is not a object\n */\nfunction deepFreeze(object) {\n \n validateObject(object)\n\n // Retrieve the defined property names of the object\n var propNames = Object.getOwnPropertyNames(object);\n\n // Freeze properties before freezing yourself\n for (let name of propNames) {\n let value = object[name];\n\n object[name] = value && typeof value === \"object\" ?\n deepFreeze(value) : value;\n }\n\n return Object.freeze(object);\n}\n\nMonster.assignToNamespace('Monster.Util', deepFreeze);\nexport {Monster, deepFreeze}\n" ] } \ No newline at end of file diff --git a/packages/monster/dist/monster.js b/packages/monster/dist/monster.js index f9cb8b333f4db006d0b5a9c7f32785f160771920..06d3e83a6feefe7a8bef066638ba116df8f7e49f 100644 --- a/packages/monster/dist/monster.js +++ b/packages/monster/dist/monster.js @@ -1,2 +1,2 @@ -/** Monster 1.1.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){(function(global){(function(){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.random=random;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");function random(min,max){if(min===undefined){min=0}if(max===undefined){max=MAX}if(max<min){throw new Error("max must be greater than min")}return Math.round(create(min,max))}var MAX=1e9;Math.log2=Math.log2||function(n){return Math.log(n)/Math.log(2)};function create(min,max){var crypt;if(typeof global!=="undefined"){var _global,_global2;crypt=((_global=global)===null||_global===void 0?void 0:_global["crypto"])||((_global2=global)===null||_global2===void 0?void 0:_global2["msCrypto"])}else{crypt=typeof crypto!=="undefined"?crypto:undefined}if(typeof crypt==="undefined"){throw new Error("missing crypt")}var rval=0;var range=max-min;if(range<2){return min}var bitsNeeded=Math.ceil(Math.log2(range));if(bitsNeeded>53){throw new Error("we cannot generate numbers larger than 53 bits.")}var bytesNeeded=Math.ceil(bitsNeeded/8);var mask=Math.pow(2,bitsNeeded)-1;var byteArray=new Uint8Array(bytesNeeded);crypt.getRandomValues(byteArray);var p=(bytesNeeded-1)*8;for(var i=0;i<bytesNeeded;i++){rval+=byteArray[i]*Math.pow(2,p);p-=8}rval=rval&mask;if(rval>=range){return create(min,max)}return min+rval}_namespace.Monster.assignToNamespace("Monster.Math",random)}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../namespace.js":3}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("./namespace.js");require("./types/id.js");require("./types/is.js");require("./types/object.js");require("./types/version.js");require("./types/observer.js");require("./types/observerlist.js");require("./types/validate.js");require("./math/random.js");require("./util/clone.js");require("./util/freeze.js");_namespace.Monster.Util.deepFreeze(_namespace.Monster)},{"./math/random.js":1,"./namespace.js":3,"./types/id.js":4,"./types/is.js":5,"./types/object.js":6,"./types/observer.js":7,"./types/observerlist.js":8,"./types/validate.js":9,"./types/version.js":10,"./util/clone.js":11,"./util/freeze.js":12}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.assignToNamespace=assignToNamespace;exports.Monster=void 0;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var Namespace=function(){function Namespace(namespace){_classCallCheck(this,Namespace);if(namespace===undefined||typeof namespace!=="string"){throw new Error("namespace is not a string")}this.namespace=namespace}_createClass(Namespace,[{key:"getNamespace",value:function getNamespace(){return this.namespace}},{key:"toString",value:function toString(){return this.getNamespace()}}]);return Namespace}();var Monster=new Namespace("Monster");exports.Monster=Monster;assignToNamespace("Monster",assignToNamespace);function assignToNamespace(ns){var current=namespaceFor(ns.split("."));for(var i=0,l=arguments.length<=1?0:arguments.length-1;i<l;i++){current[objectName(i+1<1||arguments.length<=i+1?undefined:arguments[i+1])]=i+1<1||arguments.length<=i+1?undefined:arguments[i+1]}}function objectName(fn){try{if(typeof fn!=="function"){throw new Error("the first argument is not a function or class.")}if(fn.hasOwnProperty("name")){return fn.name}if("function"===typeof fn.toString){var s=fn.toString();var f=s.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(f)&&typeof f[1]==="string"){return f[1]}var c=s.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(c)&&typeof c[1]==="string"){return c[1]}}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(parts){var space=Monster,ns="Monster";for(var i=0;i<parts.length;i++){if("Monster"===parts[i]){continue}ns+="."+parts[i];if(!space.hasOwnProperty(parts[i])){space[parts[i]]=new Namespace(ns)}space=space[parts[i]]}return space}},{}],4:[function(require,module,exports){(function(global){(function(){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.ID=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var internalCounter=0;var ID=function(_Monster$Types$Object){_inherits(ID,_Monster$Types$Object);var _super=_createSuper(ID);function ID(){var _this;_classCallCheck(this,ID);_this=_super.call(this);internalCounter+=1;_this.id=global.btoa(_namespace.Monster.Math.random(1,1e4)).replace(/=/g,"").replace(/^[0-9]+/,"X")+internalCounter;return _this}_createClass(ID,[{key:"toString",value:function toString(){return this.id}}]);return ID}(_namespace.Monster.Types.Object);exports.ID=ID;_namespace.Monster.assignToNamespace("Monster.Types",ID)}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../namespace.js":3,"../types/object.js":6}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isPrimitive=isPrimitive;exports.isBoolean=isBoolean;exports.isString=isString;exports.isObject=isObject;exports.isArray=isArray;exports.isFunction=isFunction;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function isPrimitive(value){var type;if(value===undefined||value===null){return true}type=_typeof(value);if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(_typeof(value)==="object"){return true}return false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}_namespace.Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction)},{"../namespace.js":3}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Object=void 0;var _namespace=require("../namespace.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var _Object=function(){function Object(){_classCallCheck(this,Object)}_createClass(Object,[{key:"toString",value:function toString(){return JSON.stringify(this)}}]);return Object}();exports.Object=_Object;_namespace.Monster.assignToNamespace("Monster.Types",_Object)},{"../namespace.js":3}],7:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Observer=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Observer=function(_Monster$Types$Object){_inherits(Observer,_Monster$Types$Object);var _super=_createSuper(Observer);function Observer(callback){var _this;_classCallCheck(this,Observer);_this=_super.call(this);if(typeof callback!=="function"){throw new Error("observer callback must be a function")}_this.callback=callback;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}_this.arguments=args;_this.tags=new Set;return _this}_createClass(Observer,[{key:"addTag",value:function addTag(tag){this.tags.add(tag);return this}},{key:"removeTag",value:function removeTag(tag){this.tags["delete"](tag);return this}},{key:"getTags",value:function getTags(){return this.tags}},{key:"hasTag",value:function hasTag(tag){return this.tags.has(tag)}},{key:"update",value:function update(subject){var self=this;return new Promise(function(resolve,reject){if(!(subject instanceof Object)){reject("subject must be an object")}var result=self.callback.apply(subject,self.arguments);resolve(result)})}}]);return Observer}(_namespace.Monster.Types.Object);exports.Observer=Observer;_namespace.Monster.assignToNamespace("Monster.Types",Observer)},{"../namespace.js":3,"../types/object.js":6}],8:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.ObserverList=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var ObserverList=function(_Monster$Types$Object){_inherits(ObserverList,_Monster$Types$Object);var _super=_createSuper(ObserverList);function ObserverList(){var _this;_classCallCheck(this,ObserverList);_this=_super.call(this);_this.observers=[];return _this}_createClass(ObserverList,[{key:"attach",value:function attach(observer){checkIsObserver(observer);this.observers.push(observer);return this}},{key:"detach",value:function detach(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){this.observers.splice(i,1)}}return this}},{key:"contains",value:function contains(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){return true}}return false}},{key:"notify",value:function notify(subject){var pomises=[];var i=0,l=this.observers.length;for(;i<l;i++){pomises.push(this.observers[i].update(subject))}return Promise.all(pomises)}}]);return ObserverList}(_namespace.Monster.Types.Object);exports.ObserverList=ObserverList;function checkIsObserver(observer){if(!(observer instanceof _namespace.Monster.Types.Observer)){throw new Error("argument must be instance of observer")}return true}_namespace.Monster.assignToNamespace("Monster.Types",ObserverList)},{"../namespace.js":3,"../types/object.js":6}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.validatePrimitive=validatePrimitive;exports.validateBoolean=validateBoolean;exports.validateString=validateString;exports.validateObject=validateObject;exports.validateArray=validateArray;exports.validateFunction=validateFunction;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _is=require("../types/is.js");function validatePrimitive(value){if(!(0,_is.isPrimitive)(value)){throw new TypeError("value is not a primitive")}}function validateBoolean(value){if(!(0,_is.isBoolean)(value)){throw new TypeError("value is not a boolean")}}function validateString(value){if(!(0,_is.isString)(value)){throw new TypeError("value is not a string")}}function validateObject(value){if(!(0,_is.isObject)(value)){throw new TypeError("value is not a object")}}function validateArray(value){if(!(0,_is.isArray)(value)){throw new TypeError("value is not not a array")}}function validateFunction(value){if(!(0,_is.isFunction)(value)){throw new TypeError("value is not a function")}}_namespace.Monster.assignToNamespace("Monster.Types",validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction)},{"../namespace.js":3,"../types/is.js":5}],10:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});exports.getVersion=getVersion;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Version=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Version=function(_Monster$Types$Object){_inherits(Version,_Monster$Types$Object);var _super=_createSuper(Version);function Version(major,minor,patch){var _this;_classCallCheck(this,Version);_this=_super.call(this);if(typeof major==="string"&&minor===undefined&&patch===undefined){var parts=major.toString().split(".");major=parseInt(parts[0]||0);minor=parseInt(parts[1]||0);patch=parseInt(parts[2]||0)}if(major===undefined){throw new Error("major version is undefined")}if(minor===undefined){minor=0}if(patch===undefined){patch=0}_this.major=parseInt(major);_this.minor=parseInt(minor);_this.patch=parseInt(patch);if(isNaN(_this.major)){throw new Error("major is not a number")}if(isNaN(_this.minor)){throw new Error("minor is not a number")}if(isNaN(_this.patch)){throw new Error("patch is not a number")}return _this}_createClass(Version,[{key:"toString",value:function toString(){return this.major+"."+this.minor+"."+this.patch}},{key:"compareTo",value:function compareTo(version){if(version instanceof Version){version=version.toString()}if(typeof version!=="string"){throw new Error("type exception")}if(version===this.toString()){return 0}var a=[this.major,this.minor,this.patch];var b=version.split(".");var len=Math.max(a.length,b.length);for(var i=0;i<len;i+=1){if(a[i]&&!b[i]&&parseInt(a[i])>0||parseInt(a[i])>parseInt(b[i])){return 1}else if(b[i]&&!a[i]&&parseInt(b[i])>0||parseInt(a[i])<parseInt(b[i])){return-1}}return 0}}]);return Version}(_namespace.Monster.Types.Object);exports.Version=Version;_namespace.Monster.assignToNamespace("Monster.Types",Version);var monsterVersion;function getVersion(){if(monsterVersion instanceof Version){return monsterVersion}monsterVersion=new Version("1.1.0");return monsterVersion}_namespace.Monster.assignToNamespace("Monster",getVersion)},{"../namespace.js":3,"../types/object.js":6}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clone=clone;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _is=require("../types/is.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function clone(obj){if(null===obj){return obj}if((0,_is.isPrimitive)(obj)){return obj}if((0,_is.isFunction)(obj)){return obj}if((0,_is.isArray)(obj)){var copy=[];for(var i=0,len=obj.length;i<len;i++){copy[i]=clone(obj[i])}return copy}if((0,_is.isObject)(obj)){if(obj instanceof Date){var _copy=new Date;_copy.setTime(obj.getTime());return _copy}if(typeof Element!=="undefined"&&obj instanceof Element)return obj;if(typeof HTMLDocument!=="undefined"&&obj instanceof HTMLDocument)return obj;if(typeof DocumentFragment!=="undefined"&&obj instanceof DocumentFragment)return obj;if(typeof globalContext!=="undefined"&&obj===globalContext)return obj;if(typeof window!=="undefined"&&obj===window)return obj;if(typeof document!=="undefined"&&obj===document)return obj;if(typeof navigator!=="undefined"&&obj===navigator)return obj;if(typeof JSON!=="undefined"&&obj===JSON)return obj;try{if(obj instanceof Proxy){return obj}}catch(e){}return cloneObject(obj)}throw new Error("unable to clone obj! its type isn't supported.")}function cloneObject(obj){var copy;if(_typeof(obj.hasOwnProperty("getClone"))&&obj.getClone==="function"){return obj.getClone()}copy={};if(typeof obj.constructor==="function"&&typeof obj.constructor.call==="function"){copy=new obj.constructor}for(var key in obj){if(!obj.hasOwnProperty(key)){continue}if(_namespace.Monster.Types.isPrimitive(obj[key])){copy[key]=obj[key];continue}copy[key]=clone(obj[key])}return copy}_namespace.Monster.assignToNamespace("Monster.Util",clone)},{"../namespace.js":3,"../types/is.js":5}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deepFreeze=deepFreeze;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _validate=require("../types/validate.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function deepFreeze(object){(0,_validate.validateObject)(object);var propNames=Object.getOwnPropertyNames(object);var _iterator=_createForOfIteratorHelper(propNames),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var name=_step.value;var value=object[name];object[name]=value&&_typeof(value)==="object"?deepFreeze(value):value}}catch(err){_iterator.e(err)}finally{_iterator.f()}return Object.freeze(object)}_namespace.Monster.assignToNamespace("Monster.Util",deepFreeze)},{"../namespace.js":3,"../types/validate.js":9}]},{},[2]); +/** Monster 1.3.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.AbstractConstraint=void 0;var _namespace=require("../namespace.js");var _object=require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var AbstractConstraint=function(_Object){_inherits(AbstractConstraint,_Object);var _super=_createSuper(AbstractConstraint);function AbstractConstraint(){_classCallCheck(this,AbstractConstraint);return _super.call(this)}_createClass(AbstractConstraint,[{key:"isValid",value:function isValid(value){return Promise.reject(value)}}]);return AbstractConstraint}(Object);exports.AbstractConstraint=AbstractConstraint;_namespace.Monster.assignToNamespace("Monster.Constraints",AbstractConstraint)},{"../namespace.js":11,"../types/object.js":14}],2:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.AbstractOperator=void 0;var _abstract=require("./abstract.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var AbstractOperator=function(_AbstractConstraint){_inherits(AbstractOperator,_AbstractConstraint);var _super=_createSuper(AbstractOperator);function AbstractOperator(operantA,operantB){var _this;_classCallCheck(this,AbstractOperator);_this=_super.call(this);if(!(operantA instanceof _abstract.AbstractConstraint)||!(operantB instanceof _abstract.AbstractConstraint)){throw new TypeError("parameters must be from type AbstractConstraint")}_this.operantA=operantA;_this.operantB=operantB;return _this}return AbstractOperator}(_abstract.AbstractConstraint);exports.AbstractOperator=AbstractOperator;_abstract.Monster.assignToNamespace("Monster.Constraints",AbstractOperator)},{"./abstract.js":1}],3:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.AndOperator=void 0;var _abstract=require("./abstract.js");var _abstractoperator=require("./abstractoperator.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var AndOperator=function(_AbstractOperator){_inherits(AndOperator,_AbstractOperator);var _super=_createSuper(AndOperator);function AndOperator(){_classCallCheck(this,AndOperator);return _super.apply(this,arguments)}_createClass(AndOperator,[{key:"isValid",value:function isValid(value){return Promise.all([this.operantA.isValid(value),this.operantB.isValid(value)])}}]);return AndOperator}(_abstractoperator.AbstractOperator);exports.AndOperator=AndOperator;_abstract.Monster.assignToNamespace("Monster.Constraints",AndOperator)},{"./abstract.js":1,"./abstractoperator.js":2}],4:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.Invalid=void 0;var _abstract=require("./abstract.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Invalid=function(_AbstractConstraint){_inherits(Invalid,_AbstractConstraint);var _super=_createSuper(Invalid);function Invalid(){_classCallCheck(this,Invalid);return _super.apply(this,arguments)}_createClass(Invalid,[{key:"isValid",value:function isValid(value){return Promise.reject(value)}}]);return Invalid}(_abstract.AbstractConstraint);exports.Invalid=Invalid;_abstract.Monster.assignToNamespace("Monster.Constraints",Invalid)},{"./abstract.js":1}],5:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.IsArray=void 0;var _abstract=require("./abstract.js");var _is=require("../types/is.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var IsArray=function(_AbstractConstraint){_inherits(IsArray,_AbstractConstraint);var _super=_createSuper(IsArray);function IsArray(){_classCallCheck(this,IsArray);return _super.apply(this,arguments)}_createClass(IsArray,[{key:"isValid",value:function isValid(value){if((0,_is.isArray)(value)){return Promise.resolve(value)}return Promise.reject(value)}}]);return IsArray}(_abstract.AbstractConstraint);exports.IsArray=IsArray;_abstract.Monster.assignToNamespace("Monster.Constraints",IsArray)},{"../types/is.js":13,"./abstract.js":1}],6:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.IsObject=void 0;var _abstract=require("./abstract.js");var _is=require("../types/is.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var IsObject=function(_AbstractConstraint){_inherits(IsObject,_AbstractConstraint);var _super=_createSuper(IsObject);function IsObject(){_classCallCheck(this,IsObject);return _super.apply(this,arguments)}_createClass(IsObject,[{key:"isValid",value:function isValid(value){if((0,_is.isObject)(value)){return Promise.resolve(value)}return Promise.reject(value)}}]);return IsObject}(_abstract.AbstractConstraint);exports.IsObject=IsObject;_abstract.Monster.assignToNamespace("Monster.Constraints",IsObject)},{"../types/is.js":13,"./abstract.js":1}],7:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstractoperator.Monster}});exports.OrOperator=void 0;var _abstractoperator=require("./abstractoperator.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var OrOperator=function(_AbstractOperator){_inherits(OrOperator,_AbstractOperator);var _super=_createSuper(OrOperator);function OrOperator(){_classCallCheck(this,OrOperator);return _super.apply(this,arguments)}_createClass(OrOperator,[{key:"isValid",value:function isValid(value){var self=this;return new Promise(function(resolve,reject){var 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()}})})}}]);return OrOperator}(_abstractoperator.AbstractOperator);exports.OrOperator=OrOperator;_abstractoperator.Monster.assignToNamespace("Monster.Constraints",OrOperator)},{"./abstractoperator.js":2}],8:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _abstract.Monster}});exports.Valid=void 0;var _abstract=require("./abstract.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Valid=function(_AbstractConstraint){_inherits(Valid,_AbstractConstraint);var _super=_createSuper(Valid);function Valid(){_classCallCheck(this,Valid);return _super.apply(this,arguments)}_createClass(Valid,[{key:"isValid",value:function isValid(value){return Promise.resolve(value)}}]);return Valid}(_abstract.AbstractConstraint);exports.Valid=Valid;_abstract.Monster.assignToNamespace("Monster.Constraints",Valid)},{"./abstract.js":1}],9:[function(require,module,exports){(function(global){(function(){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.random=random;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");function random(min,max){if(min===undefined){min=0}if(max===undefined){max=MAX}if(max<min){throw new Error("max must be greater than min")}return Math.round(create(min,max))}var MAX=1e9;Math.log2=Math.log2||function(n){return Math.log(n)/Math.log(2)};function create(min,max){var crypt;if(typeof global!=="undefined"){var _global,_global2;crypt=((_global=global)===null||_global===void 0?void 0:_global["crypto"])||((_global2=global)===null||_global2===void 0?void 0:_global2["msCrypto"])}else{crypt=typeof crypto!=="undefined"?crypto:undefined}if(typeof crypt==="undefined"){throw new Error("missing crypt")}var rval=0;var range=max-min;if(range<2){return min}var bitsNeeded=Math.ceil(Math.log2(range));if(bitsNeeded>53){throw new Error("we cannot generate numbers larger than 53 bits.")}var bytesNeeded=Math.ceil(bitsNeeded/8);var mask=Math.pow(2,bitsNeeded)-1;var byteArray=new Uint8Array(bytesNeeded);crypt.getRandomValues(byteArray);var p=(bytesNeeded-1)*8;for(var i=0;i<bytesNeeded;i++){rval+=byteArray[i]*Math.pow(2,p);p-=8}rval=rval&mask;if(rval>=range){return create(min,max)}return min+rval}_namespace.Monster.assignToNamespace("Monster.Math",random)}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../namespace.js":11}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("./namespace.js");require("./types/id.js");require("./types/is.js");require("./types/object.js");require("./types/observer.js");require("./types/observerlist.js");require("./types/proxyobserver.js");require("./types/version.js");require("./types/tokenlist.js");require("./types/validate.js");require("./math/random.js");require("./util/clone.js");require("./util/comparator.js");require("./util/freeze.js");require("./constraints/abstract.js");require("./constraints/andoperator.js");require("./constraints/invalid.js");require("./constraints/isarray.js");require("./constraints/isobject.js");require("./constraints/abstractoperator.js");require("./constraints/oroperator.js");require("./constraints/valid.js");_namespace.Monster.Util.deepFreeze(_namespace.Monster)},{"./constraints/abstract.js":1,"./constraints/abstractoperator.js":2,"./constraints/andoperator.js":3,"./constraints/invalid.js":4,"./constraints/isarray.js":5,"./constraints/isobject.js":6,"./constraints/oroperator.js":7,"./constraints/valid.js":8,"./math/random.js":9,"./namespace.js":11,"./types/id.js":12,"./types/is.js":13,"./types/object.js":14,"./types/observer.js":15,"./types/observerlist.js":16,"./types/proxyobserver.js":17,"./types/tokenlist.js":18,"./types/validate.js":19,"./types/version.js":20,"./util/clone.js":21,"./util/comparator.js":22,"./util/freeze.js":23}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.assignToNamespace=assignToNamespace;exports.Monster=void 0;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var Namespace=function(){function Namespace(namespace){_classCallCheck(this,Namespace);if(namespace===undefined||typeof namespace!=="string"){throw new Error("namespace is not a string")}this.namespace=namespace}_createClass(Namespace,[{key:"getNamespace",value:function getNamespace(){return this.namespace}},{key:"toString",value:function toString(){return this.getNamespace()}}]);return Namespace}();var Monster=new Namespace("Monster");exports.Monster=Monster;assignToNamespace("Monster",assignToNamespace);function assignToNamespace(ns){var current=namespaceFor(ns.split("."));for(var i=0,l=arguments.length<=1?0:arguments.length-1;i<l;i++){current[objectName(i+1<1||arguments.length<=i+1?undefined:arguments[i+1])]=i+1<1||arguments.length<=i+1?undefined:arguments[i+1]}}function objectName(fn){try{if(typeof fn!=="function"){throw new Error("the first argument is not a function or class.")}if(fn.hasOwnProperty("name")){return fn.name}if("function"===typeof fn.toString){var s=fn.toString();var f=s.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(f)&&typeof f[1]==="string"){return f[1]}var c=s.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(c)&&typeof c[1]==="string"){return c[1]}}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(parts){var space=Monster,ns="Monster";for(var i=0;i<parts.length;i++){if("Monster"===parts[i]){continue}ns+="."+parts[i];if(!space.hasOwnProperty(parts[i])){space[parts[i]]=new Namespace(ns)}space=space[parts[i]]}return space}},{}],12:[function(require,module,exports){(function(global){(function(){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.ID=void 0;var _namespace=require("../namespace.js");var _random=require("../math/random.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var internalCounter=0;var ID=function(_Monster$Types$Object){_inherits(ID,_Monster$Types$Object);var _super=_createSuper(ID);function ID(){var _this;_classCallCheck(this,ID);_this=_super.call(this);internalCounter+=1;_this.id=global.btoa((0,_random.random)(1,1e4)).replace(/=/g,"").replace(/^[0-9]+/,"X")+internalCounter;return _this}_createClass(ID,[{key:"toString",value:function toString(){return this.id}}]);return ID}(_namespace.Monster.Types.Object);exports.ID=ID;_namespace.Monster.assignToNamespace("Monster.Types",ID)}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../math/random.js":9,"../namespace.js":11,"../types/object.js":14}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isPrimitive=isPrimitive;exports.isBoolean=isBoolean;exports.isString=isString;exports.isObject=isObject;exports.isArray=isArray;exports.isFunction=isFunction;exports.isIterable=isIterable;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function isIterable(value){if(value===undefined)return false;if(value===null)return false;return typeof(value===null||value===void 0?void 0:value[Symbol.iterator])==="function"}function isPrimitive(value){var type;if(value===undefined||value===null||value===NaN){return true}type=_typeof(value);if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(_typeof(value)==="object"){return true}return false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}_namespace.Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable)},{"../namespace.js":11}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Object=void 0;var _namespace=require("../namespace.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var _Object=function(){function Object(){_classCallCheck(this,Object)}_createClass(Object,[{key:"toString",value:function toString(){return JSON.stringify(this)}}]);return Object}();exports.Object=_Object;_namespace.Monster.assignToNamespace("Monster.Types",_Object)},{"../namespace.js":11}],15:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Observer=void 0;var _namespace=require("../namespace.js");var _tokenlist=require("../types/tokenlist.js");var _is=require("../types/is.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Observer=function(_Monster$Types$Object){_inherits(Observer,_Monster$Types$Object);var _super=_createSuper(Observer);function Observer(callback){var _this;_classCallCheck(this,Observer);_this=_super.call(this);if(typeof callback!=="function"){throw new Error("observer callback must be a function")}_this.callback=callback;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}_this.arguments=args;_this.tags=new _tokenlist.TokenList;return _this}_createClass(Observer,[{key:"addTag",value:function addTag(tag){this.tags.add(tag);return this}},{key:"removeTag",value:function removeTag(tag){this.tags.remove(tag);return this}},{key:"getTags",value:function getTags(){return this.tags.entries()}},{key:"hasTag",value:function hasTag(tag){return this.tags.contains(tag)}},{key:"update",value:function update(subject){var self=this;return new Promise(function(resolve,reject){if(!(0,_is.isObject)(subject)){reject("subject must be an object")}var result=self.callback.apply(subject,self.arguments);resolve(result)})}}]);return Observer}(_namespace.Monster.Types.Object);exports.Observer=Observer;_namespace.Monster.assignToNamespace("Monster.Types",Observer)},{"../namespace.js":11,"../types/is.js":13,"../types/object.js":14,"../types/tokenlist.js":18}],16:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.ObserverList=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var ObserverList=function(_Monster$Types$Object){_inherits(ObserverList,_Monster$Types$Object);var _super=_createSuper(ObserverList);function ObserverList(){var _this;_classCallCheck(this,ObserverList);_this=_super.call(this);_this.observers=[];return _this}_createClass(ObserverList,[{key:"attach",value:function attach(observer){checkIsObserver(observer);this.observers.push(observer);return this}},{key:"detach",value:function detach(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){this.observers.splice(i,1)}}return this}},{key:"contains",value:function contains(observer){checkIsObserver(observer);var i=0,l=this.observers.length;for(;i<l;i++){if(this.observers[i]===observer){return true}}return false}},{key:"notify",value:function notify(subject){var pomises=[];var i=0,l=this.observers.length;for(;i<l;i++){pomises.push(this.observers[i].update(subject))}return Promise.all(pomises)}}]);return ObserverList}(_namespace.Monster.Types.Object);exports.ObserverList=ObserverList;function checkIsObserver(observer){if(!(observer instanceof _namespace.Monster.Types.Observer)){throw new Error("argument must be instance of observer")}return true}_namespace.Monster.assignToNamespace("Monster.Types",ObserverList)},{"../namespace.js":11,"../types/object.js":14}],17:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.ProxyObserver=void 0;var _namespace=require("../namespace.js");var _object=require("../types/object.js");var _validate=require("./validate.js");var _observerlist=require("./observerlist.js");var _observer=require("./observer.js");var _is=require("./is.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var proxySet=new WeakSet;var ProxyObserver=function(_Object){_inherits(ProxyObserver,_Object);var _super=_createSuper(ProxyObserver);function ProxyObserver(object){var _this;_classCallCheck(this,ProxyObserver);_this=_super.call(this);(0,_validate.validateObject)(object);_this.realSubject=object;_this.subject=new Proxy(object,getHandler.call(_assertThisInitialized(_this)));proxySet.add(_this.subject);_this.observers=new _observerlist.ObserverList;return _this}_createClass(ProxyObserver,[{key:"getSubject",value:function getSubject(){return this.subject}},{key:"getRealSubject",value:function getRealSubject(){return this.realSubject}},{key:"attachObserver",value:function attachObserver(observer){this.observers.attach(observer);return this}},{key:"detachObserver",value:function detachObserver(observer){this.observers.detach(observer);return this}},{key:"notifyObservers",value:function notifyObservers(){this.observers.notify(this);return this}},{key:"containsObserver",value:function containsObserver(observer){return this.observers.contains(observer)}}]);return ProxyObserver}(Object);exports.ProxyObserver=ProxyObserver;_namespace.Monster.assignToNamespace("Monster.Types",ProxyObserver);function getHandler(){var proxy=this;var handler={get:function get(target,property,receiver){var prop=target===null||target===void 0?void 0:target[property];if(prop===undefined){return undefined}if((0,_is.isArray)(prop)||(0,_is.isObject)(prop)&&!proxySet.has(prop)){target[property]=new Proxy(prop,handler);proxySet.add(prop)}return target[property]},set:function set(target,property,value,receiver){target[property]=value;proxy.observers.notify(proxy);return true},deleteProperty:function deleteProperty(target,property){if(property in target){delete target[property];proxy.observers.notify(proxy);return true}return false},defineProperty:function defineProperty(target,property,descriptor){var result=Reflect.defineProperty(target,property,descriptor);proxy.observers.notify(proxy);return parseURLToResultingURLRecord()},setPrototypeOf:function setPrototypeOf(target,prototype){var result=Reflect.setPrototypeOf(object1,prototype);proxy.observers.notify(proxy);return result}};return handler}},{"../namespace.js":11,"../types/object.js":14,"./is.js":13,"./observer.js":15,"./observerlist.js":16,"./validate.js":19}],18:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.TokenList=void 0;var _namespace=require("../namespace.js");var _object=require("../types/object.js");var _is=require("../types/is.js");var _validate=require("../types/validate.js");function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var TokenList=function(_Object){_inherits(TokenList,_Object);var _super=_createSuper(TokenList);function TokenList(init){var _this;_classCallCheck(this,TokenList);_this=_super.call(this);_this.tokens=new Set;if(typeof init!=="undefined"){_this.add(init)}return _this}_createClass(TokenList,[{key:"getIterator",value:function getIterator(){return this[Symbol.iterator]()}},{key:Symbol.iterator,value:function value(){var index=0;var entries=this.entries();return{next:function next(){if(index<entries.length){return{value:entries===null||entries===void 0?void 0:entries[index++],done:false}}else{return{done:true}}}}}},{key:"contains",value:function contains(value){var _this2=this;if((0,_is.isString)(value)){value=value.trim();var counter=0;value.split(" ").forEach(function(token){if(_this2.tokens.has(token.trim())===false)return false;counter++});return counter>0?true:false}if((0,_is.isIterable)(value)){var _counter=0;var _iterator=_createForOfIteratorHelper(value),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var token=_step.value;(0,_validate.validateString)(token);if(this.tokens.has(token.trim())===false)return false;_counter++}}catch(err){_iterator.e(err)}finally{_iterator.f()}return _counter>0?true:false}return false}},{key:"add",value:function add(value){var _this3=this;if((0,_is.isString)(value)){value.split(" ").forEach(function(token){_this3.tokens.add(token.trim())})}else if((0,_is.isIterable)(value)){var _iterator2=_createForOfIteratorHelper(value),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var token=_step2.value;(0,_validate.validateString)(token);this.tokens.add(token.trim())}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}},{key:"clear",value:function clear(){this.tokens.clear();return this}},{key:"remove",value:function remove(value){var _this4=this;if((0,_is.isString)(value)){value.split(" ").forEach(function(token){_this4.tokens["delete"](token.trim())})}else if((0,_is.isIterable)(value)){var _iterator3=_createForOfIteratorHelper(value),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var token=_step3.value;(0,_validate.validateString)(token);this.tokens["delete"](token.trim())}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}},{key:"replace",value:function replace(token,newToken){(0,_validate.validateString)(token);(0,_validate.validateString)(newToken);if(!this.contains(token)){return this}var a=Array.from(this.tokens);var i=a.indexOf(token);if(i===-1)return this;a.splice(i,1,newToken);this.tokens=new Set;this.add(a);return this}},{key:"toggle",value:function toggle(value){var _this5=this;if((0,_is.isString)(value)){value.split(" ").forEach(function(token){toggleValue.call(_this5,token)})}else if((0,_is.isIterable)(value)){var _iterator4=_createForOfIteratorHelper(value),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var token=_step4.value;toggleValue.call(this,token)}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}else if(typeof value!=="undefined"){throw new TypeError("unsupported value")}return this}},{key:"entries",value:function entries(){return Array.from(this.tokens)}},{key:"forEach",value:function forEach(callback){(0,_validate.validateFunction)(callback);this.tokens.forEach(callback);return this}},{key:"toString",value:function toString(){return this.entries().join(" ")}}]);return TokenList}(Object);exports.TokenList=TokenList;function toggleValue(token){if(!(this instanceof TokenList))throw Error("must be called with TokenList.call");(0,_validate.validateString)(token);token=token.trim();if(this.contains(token)){this.remove(token);return this}this.add(token);return this}_namespace.Monster.assignToNamespace("Monster.Types",TokenList)},{"../namespace.js":11,"../types/is.js":13,"../types/object.js":14,"../types/validate.js":19}],19:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.validatePrimitive=validatePrimitive;exports.validateBoolean=validateBoolean;exports.validateString=validateString;exports.validateObject=validateObject;exports.validateArray=validateArray;exports.validateFunction=validateFunction;exports.validateIterable=validateIterable;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _is=require("../types/is.js");function validateIterable(value){if(!(0,_is.isIterable)(value)){throw new TypeError("value is not iterable")}}function validatePrimitive(value){if(!(0,_is.isPrimitive)(value)){throw new TypeError("value is not a primitive")}}function validateBoolean(value){if(!(0,_is.isBoolean)(value)){throw new TypeError("value is not a boolean")}}function validateString(value){if(!(0,_is.isString)(value)){throw new TypeError("value is not a string")}}function validateObject(value){if(!(0,_is.isObject)(value)){throw new TypeError("value is not a object")}}function validateArray(value){if(!(0,_is.isArray)(value)){throw new TypeError("value is not not a array")}}function validateFunction(value){if(!(0,_is.isFunction)(value)){throw new TypeError("value is not a function")}}_namespace.Monster.assignToNamespace("Monster.Types",validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction,validateIterable)},{"../namespace.js":11,"../types/is.js":13}],20:[function(require,module,exports){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}Object.defineProperty(exports,"__esModule",{value:true});exports.getVersion=getVersion;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});exports.Version=void 0;var _namespace=require("../namespace.js");require("../types/object.js");function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Version=function(_Monster$Types$Object){_inherits(Version,_Monster$Types$Object);var _super=_createSuper(Version);function Version(major,minor,patch){var _this;_classCallCheck(this,Version);_this=_super.call(this);if(typeof major==="string"&&minor===undefined&&patch===undefined){var parts=major.toString().split(".");major=parseInt(parts[0]||0);minor=parseInt(parts[1]||0);patch=parseInt(parts[2]||0)}if(major===undefined){throw new Error("major version is undefined")}if(minor===undefined){minor=0}if(patch===undefined){patch=0}_this.major=parseInt(major);_this.minor=parseInt(minor);_this.patch=parseInt(patch);if(isNaN(_this.major)){throw new Error("major is not a number")}if(isNaN(_this.minor)){throw new Error("minor is not a number")}if(isNaN(_this.patch)){throw new Error("patch is not a number")}return _this}_createClass(Version,[{key:"toString",value:function toString(){return this.major+"."+this.minor+"."+this.patch}},{key:"compareTo",value:function compareTo(version){if(version instanceof Version){version=version.toString()}if(typeof version!=="string"){throw new Error("type exception")}if(version===this.toString()){return 0}var a=[this.major,this.minor,this.patch];var b=version.split(".");var len=Math.max(a.length,b.length);for(var i=0;i<len;i+=1){if(a[i]&&!b[i]&&parseInt(a[i])>0||parseInt(a[i])>parseInt(b[i])){return 1}else if(b[i]&&!a[i]&&parseInt(b[i])>0||parseInt(a[i])<parseInt(b[i])){return-1}}return 0}}]);return Version}(_namespace.Monster.Types.Object);exports.Version=Version;_namespace.Monster.assignToNamespace("Monster.Types",Version);var monsterVersion;function getVersion(){if(monsterVersion instanceof Version){return monsterVersion}monsterVersion=new Version("1.3.0");return monsterVersion}_namespace.Monster.assignToNamespace("Monster",getVersion)},{"../namespace.js":11,"../types/object.js":14}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clone=clone;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _is=require("../types/is.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function clone(obj){if(null===obj){return obj}if((0,_is.isPrimitive)(obj)){return obj}if((0,_is.isFunction)(obj)){return obj}if((0,_is.isArray)(obj)){var copy=[];for(var i=0,len=obj.length;i<len;i++){copy[i]=clone(obj[i])}return copy}if((0,_is.isObject)(obj)){if(obj instanceof Date){var _copy=new Date;_copy.setTime(obj.getTime());return _copy}if(typeof Element!=="undefined"&&obj instanceof Element)return obj;if(typeof HTMLDocument!=="undefined"&&obj instanceof HTMLDocument)return obj;if(typeof DocumentFragment!=="undefined"&&obj instanceof DocumentFragment)return obj;if(typeof globalContext!=="undefined"&&obj===globalContext)return obj;if(typeof window!=="undefined"&&obj===window)return obj;if(typeof document!=="undefined"&&obj===document)return obj;if(typeof navigator!=="undefined"&&obj===navigator)return obj;if(typeof JSON!=="undefined"&&obj===JSON)return obj;try{if(obj instanceof Proxy){return obj}}catch(e){}return cloneObject(obj)}throw new Error("unable to clone obj! its type isn't supported.")}function cloneObject(obj){var copy;if(_typeof(obj.hasOwnProperty("getClone"))&&obj.getClone==="function"){return obj.getClone()}copy={};if(typeof obj.constructor==="function"&&typeof obj.constructor.call==="function"){copy=new obj.constructor}for(var key in obj){if(!obj.hasOwnProperty(key)){continue}if(_namespace.Monster.Types.isPrimitive(obj[key])){copy[key]=obj[key];continue}copy[key]=clone(obj[key])}return copy}_namespace.Monster.assignToNamespace("Monster.Util",clone)},{"../namespace.js":11,"../types/is.js":13}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _object.Monster}});exports.Comparator=void 0;var _object=require("../types/object.js");var _is=require("../types/is.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}var Comparator=function(_Object){_inherits(Comparator,_Object);var _super=_createSuper(Comparator);function Comparator(callback){var _this;_classCallCheck(this,Comparator);_this=_super.call(this);if((0,_is.isFunction)(callback)){_this.compare=callback}else if(callback!==undefined){throw new TypeError("unsupported type")}else{_this.compare=function(a,b){if(_typeof(a)!==_typeof(b)){throw new TypeError("impractical comparison")}if(a===b){return 0}return a<b?-1:1}}return _this}_createClass(Comparator,[{key:"reverse",value:function reverse(){var original=this.compare;this.compare=function(a,b){return original(b,a)};return this}},{key:"equal",value:function equal(a,b){return this.compare(a,b)===0}},{key:"greaterThan",value:function greaterThan(a,b){return this.compare(a,b)>0}},{key:"greaterThanOrEqual",value:function greaterThanOrEqual(a,b){return this.greaterThan(a,b)||this.equal(a,b)}},{key:"lessThanOrEqual",value:function lessThanOrEqual(a,b){return this.lessThan(a,b)||this.equal(a,b)}},{key:"lessThan",value:function lessThan(a,b){return this.compare(a,b)<0}}]);return Comparator}(Object);exports.Comparator=Comparator;_object.Monster.assignToNamespace("Monster.Util",Comparator)},{"../types/is.js":13,"../types/object.js":14}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deepFreeze=deepFreeze;Object.defineProperty(exports,"Monster",{enumerable:true,get:function get(){return _namespace.Monster}});var _namespace=require("../namespace.js");var _validate=require("../types/validate.js");function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function deepFreeze(object){(0,_validate.validateObject)(object);var propNames=Object.getOwnPropertyNames(object);var _iterator=_createForOfIteratorHelper(propNames),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var name=_step.value;var value=object[name];object[name]=value&&_typeof(value)==="object"?deepFreeze(value):value}}catch(err){_iterator.e(err)}finally{_iterator.f()}return Object.freeze(object)}_namespace.Monster.assignToNamespace("Monster.Util",deepFreeze)},{"../namespace.js":11,"../types/validate.js":19}]},{},[10]); diff --git a/packages/monster/package.json b/packages/monster/package.json index 2a6581e25c629837ecdc482f286c5a58329a3dc3..1e2fadcb16016499ce0c27c8ec9dc808b677cbdb 100644 --- a/packages/monster/package.json +++ b/packages/monster/package.json @@ -1,6 +1,6 @@ { "name": "@schukai/monster", - "version": "1.1.0", + "version": "1.3.0", "description": "Monster is a simple library for creating fast, robust and lightweight websites.", "keywords": [ "framework", diff --git a/packages/monster/source/constraints/abstract.js b/packages/monster/source/constraints/abstract.js new file mode 100644 index 0000000000000000000000000000000000000000..139ddb34ed2df3492eb593c81996b5bf74ee6b41 --- /dev/null +++ b/packages/monster/source/constraints/abstract.js @@ -0,0 +1,41 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; + + +/** + * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined. + * + * derived classes must implement the method isValid(). + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AbstractConstraint extends Object { + + /** + * + */ + constructor() { + super(); + } + + /** + * this method must return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } +} + +Monster.assignToNamespace('Monster.Constraints', AbstractConstraint); +export {Monster, AbstractConstraint} \ No newline at end of file diff --git a/packages/monster/source/constraints/abstractoperator.js b/packages/monster/source/constraints/abstractoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..7c54914798311794ab8837ca521a7479fc3d0da2 --- /dev/null +++ b/packages/monster/source/constraints/abstractoperator.js @@ -0,0 +1,40 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together. + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AbstractOperator extends AbstractConstraint { + + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" + */ + constructor(operantA, operantB) { + super(); + + if (!(operantA instanceof AbstractConstraint) || !(operantB instanceof AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint") + } + + this.operantA = operantA; + this.operantB = operantB; + + } + + +} + +Monster.assignToNamespace('Monster.Constraints', AbstractOperator); +export {Monster, AbstractOperator} \ No newline at end of file diff --git a/packages/monster/source/constraints/andoperator.js b/packages/monster/source/constraints/andoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..2ca15463eca4eb8a1de5a257078416b358715760 --- /dev/null +++ b/packages/monster/source/constraints/andoperator.js @@ -0,0 +1,49 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {AbstractOperator} from "./abstractoperator.js"; + +/** + * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/andoperator.js'; + * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class AndOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]); + } + +} + +Monster.assignToNamespace('Monster.Constraints', AndOperator); +export {Monster, AndOperator} diff --git a/packages/monster/source/constraints/invalid.js b/packages/monster/source/constraints/invalid.js new file mode 100644 index 0000000000000000000000000000000000000000..1349d7fa414fed599118d6e670c0ef9f4a144b32 --- /dev/null +++ b/packages/monster/source/constraints/invalid.js @@ -0,0 +1,49 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Monster.Constraint.Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/invalid.js'; + * new Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class Invalid extends AbstractConstraint { + + /** + * this method return a rejected promise + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', Invalid); +export {Monster, Invalid} diff --git a/packages/monster/source/constraints/isarray.js b/packages/monster/source/constraints/isarray.js new file mode 100644 index 0000000000000000000000000000000000000000..66becf6d8c6fa8a594ec178099a3e764d574a8fa --- /dev/null +++ b/packages/monster/source/constraints/isarray.js @@ -0,0 +1,54 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isArray} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new Monster.Constraint.IsArray()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isarray.js'; + * console.log(new IsArray()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class IsArray extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if(isArray(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', IsArray); +export {Monster, IsArray} diff --git a/packages/monster/source/constraints/isobject.js b/packages/monster/source/constraints/isobject.js new file mode 100644 index 0000000000000000000000000000000000000000..b5ffe20f2f32ce6fcaeee01f5651a72f2e2a5d6f --- /dev/null +++ b/packages/monster/source/constraints/isobject.js @@ -0,0 +1,54 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; +import {isObject} from "../types/is.js"; + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new Monster.Constraint.IsObject()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/isobject.js'; + * console.log(new IsObject()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class IsObject extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + if (isObject(value)) { + return Promise.resolve(value); + } + + return Promise.reject(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', IsObject); +export {Monster, IsObject} diff --git a/packages/monster/source/constraints/namespace.js b/packages/monster/source/constraints/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..40d7963ab5802c922e2eba1c1438681dbb043037 --- /dev/null +++ b/packages/monster/source/constraints/namespace.js @@ -0,0 +1,6 @@ +'use strict'; + +/** + * @namespace Monster/Constraints + * @author schukai GmbH + */ \ No newline at end of file diff --git a/packages/monster/source/constraints/oroperator.js b/packages/monster/source/constraints/oroperator.js new file mode 100644 index 0000000000000000000000000000000000000000..0369f1fb8f4c2b55813c6f1989c1a2aa373ddc57 --- /dev/null +++ b/packages/monster/source/constraints/oroperator.js @@ -0,0 +1,75 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractOperator} from "./abstractoperator.js"; + +/** + * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraint/oroperator.js'; + * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class OrOperator extends AbstractOperator { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + 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; + /** b has already been evaluated and was not true */ + if (b === false) { + reject(); + } + }); + + self.operantB.isValid(value) + .then(function () { + resolve(); + }).catch(function () { + b = false; + /** b has already been evaluated and was not true */ + if (a === false) { + reject(); + } + }); + }); + } + + +} + +Monster.assignToNamespace('Monster.Constraints', OrOperator); +export {Monster, OrOperator} diff --git a/packages/monster/source/constraints/valid.js b/packages/monster/source/constraints/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..dda748a8aeccdfd59d8f658939f30fa82981df99 --- /dev/null +++ b/packages/monster/source/constraints/valid.js @@ -0,0 +1,49 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, AbstractConstraint} from "./abstract.js"; + +/** + * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Valid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Monster.Constraint.Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/constraints/valid.js'; + * new Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +class Valid extends AbstractConstraint { + + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + isValid(value) { + return Promise.resolve(value); + } + +} + +Monster.assignToNamespace('Monster.Constraints', Valid); +export {Monster, Valid} diff --git a/packages/monster/source/math/random.js b/packages/monster/source/math/random.js index 281eb871d9f7dd78d2287da3bf49b2586366af06..ee8dfd665f61191fefd4a7db537a03a239853ff1 100644 --- a/packages/monster/source/math/random.js +++ b/packages/monster/source/math/random.js @@ -14,7 +14,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; * console.log(Monster.Math.random(1,10)) // ↦ 5 * </script> * ``` @@ -23,7 +23,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/math/random.js'; + * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/math/random.js'; * console.log(random(1,10)) // ↦ 5 * </script> * ``` diff --git a/packages/monster/source/monster.js b/packages/monster/source/monster.js index 8fe5ccde3d8a46a3b1f047b289d431cd46426d65..352b08563ae3cf785165e171dacb57984f28471f 100644 --- a/packages/monster/source/monster.js +++ b/packages/monster/source/monster.js @@ -11,13 +11,25 @@ import {Monster} from './namespace.js'; import './types/id.js'; import './types/is.js'; import './types/object.js'; -import './types/version.js'; import './types/observer.js'; import './types/observerlist.js'; +import './types/proxyobserver.js'; +import './types/version.js'; +import './types/tokenlist.js'; import './types/validate.js'; +import './types/version.js'; import './math/random.js'; import './util/clone.js'; +import './util/comparator.js'; import './util/freeze.js'; +import './constraints/abstract.js'; +import './constraints/andoperator.js'; +import './constraints/invalid.js'; +import './constraints/isarray.js'; +import './constraints/isobject.js'; +import './constraints/abstractoperator.js'; +import './constraints/oroperator.js'; +import './constraints/valid.js'; Monster.Util.deepFreeze(Monster); export {Monster}; \ No newline at end of file diff --git a/packages/monster/source/namespace.js b/packages/monster/source/namespace.js index 9f96894a8ecf50c0adc8781765536464a17e87ab..da4db08a0ffcd2577ebef45df9d203eeeb82971c 100644 --- a/packages/monster/source/namespace.js +++ b/packages/monster/source/namespace.js @@ -7,11 +7,11 @@ /** - * Namespace class objects form the basic framework of the namespace administration. + * namespace class objects form the basic framework of the namespace administration. * - * All functions, classes and objects of the library hang within the namespace tree. + * all functions, classes and objects of the library hang within the namespace tree. * - * Via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. + * via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. * * @memberOf Monster @@ -71,7 +71,7 @@ assignToNamespace('Monster', assignToNamespace); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/namespace.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/namespace.js'; * function hello() { * console.log('Hello World!'); * } diff --git a/packages/monster/source/types/id.js b/packages/monster/source/types/id.js index 699a24deeb9dedf27e9b93c0303f740a18eb8950..90908b60eb820782cbb063c5a75c928d8b50f84a 100644 --- a/packages/monster/source/types/id.js +++ b/packages/monster/source/types/id.js @@ -5,17 +5,19 @@ */ import {Monster} from '../namespace.js'; +import {random} from '../math/random.js'; import '../types/object.js'; let internalCounter = 0; /** + * id class * * you can call the method via the monster namespace `new Monster.Types.ID()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; * console.log(new Monster.Types.ID()) * console.log(new Monster.Types.ID()) * </script> @@ -25,7 +27,7 @@ let internalCounter = 0; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/id.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; * console.log(new ID()) * console.log(new ID()) * </script> @@ -37,12 +39,15 @@ let internalCounter = 0; */ class ID extends Monster.Types.Object { + /** + * create new object + */ constructor() { super(); internalCounter += 1; - this.id = global.btoa(Monster.Math.random(1, 10000)) + this.id = global.btoa(random(1, 10000)) .replace(/=/g, '') /** No numbers at the beginning of the ID, because of possible problems with DOM */ .replace(/^[0-9]+/, 'X') + internalCounter; diff --git a/packages/monster/source/types/is.js b/packages/monster/source/types/is.js index d05d26d56fabd6115c2fb2178867a686d87b6b52..b7653c48b6b945b61fef65ac78c2ba3da764ff52 100644 --- a/packages/monster/source/types/is.js +++ b/packages/monster/source/types/is.js @@ -7,13 +7,51 @@ import {Monster} from '../namespace.js'; /** - * checks whether the value passed is a primitive (string, number, boolean or symbol) + * with this function you can check if a value is iterable * * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(Monster.Types.isIterable(null)) // ↦ false + * console.log(Monster.Types.isIterable('hello')) // ↦ true + * console.log(Monster.Types.isIterable([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; + * console.log(isIterable(null)) // ↦ false + * console.log(isIterable('hello')) // ↦ true + * console.log(isIterable([])) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +function isIterable(value) { + if (value === undefined) return false; + if (value === null) return false; + return typeof value?.[Symbol.iterator] === 'function'; +} + + +/** + * checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol) + * + * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isPrimitive('2')) // ↦ false * console.log(Monster.Types.isPrimitive([])) // ↦ true * </script> @@ -23,12 +61,12 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isPrimitive('2')) // ↦ true * console.log(isPrimitive([])) // ↦ false * </script> * ``` - * + * * @param {*} value * @returns {boolean} * @since 1.0.0 @@ -38,7 +76,7 @@ import {Monster} from '../namespace.js'; function isPrimitive(value) { var type; - if (value === undefined || value === null) { + if (value === undefined || value === null || value === NaN) { return true; } @@ -58,7 +96,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isBoolean('2')) // ↦ false * console.log(Monster.Types.isBoolean([])) // ↦ false * console.log(Monster.Types.isBoolean(true)) // ↦ true @@ -69,7 +107,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isBoolean('2')) // ↦ false * console.log(isBoolean([])) // ↦ false * console.log(isBoolean(2>4)) // ↦ true @@ -93,22 +131,22 @@ function isBoolean(value) { /** * checks whether the value passed is a string - * + * * you can call the method via the monster namespace `Monster.Types.isString()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isString('2')) // ↦ true * console.log(Monster.Types.isString([])) // ↦ false * </script> * ``` - * + * * Alternatively, you can also integrate this function individually. - * + * * ``` * <script type="module"> - * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isString('2')) // ↦ true * console.log(isString([])) // ↦ false * </script> @@ -134,7 +172,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isObject('2')) // ↦ false * console.log(Monster.Types.isObject([])) // ↦ false * console.log(Monster.Types.isObject({})) // ↦ true @@ -145,7 +183,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isObject('2')) // ↦ false * console.log(isObject([])) // ↦ false * </script> @@ -176,7 +214,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isArray('2')) // ↦ false * console.log(Monster.Types.isArray([])) // ↦ true * </script> @@ -186,7 +224,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isArray('2')) // ↦ false * console.log(isArray([])) // ↦ true * </script> @@ -212,7 +250,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(Monster.Types.isFunction(()=>{})) // ↦ true * console.log(Monster.Types.isFunction('2')) // ↦ false * console.log(Monster.Types.isFunction([])) // ↦ false @@ -223,7 +261,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/is.js'; + * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/is.js'; * console.log(isFunction(()=>{})) // ↦ true * console.log(isFunction('2')) // ↦ false * console.log(isFunction([])) // ↦ false @@ -248,5 +286,5 @@ function isFunction(value) { } -Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction); -export {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction} +Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable); +export {Monster, isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable} diff --git a/packages/monster/source/types/object.js b/packages/monster/source/types/object.js index b00d39b2782ab9286c34814ad7e8837f99a9e919..fff2cef24487590a83e4a785ce4cf8a0ed0eda8e 100644 --- a/packages/monster/source/types/object.js +++ b/packages/monster/source/types/object.js @@ -14,7 +14,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; * console.log(new Monster.Types.Object()) * console.log(new Monster.Types.Object()) * </script> @@ -24,7 +24,7 @@ import {Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/object.js'; + * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/object.js'; * console.log(new Object()) * console.log(new Object()) * </script> diff --git a/packages/monster/source/types/observer.js b/packages/monster/source/types/observer.js index fc1e81f66b3d7309e063980bff32d5b0fc5971b7..9cf0b524ed9dc4b810e50764247ee197ca7f0084 100644 --- a/packages/monster/source/types/observer.js +++ b/packages/monster/source/types/observer.js @@ -5,6 +5,8 @@ */ import {Monster} from '../namespace.js'; +import {TokenList} from '../types/tokenlist.js'; +import {isObject} from '../types/is.js'; import '../types/object.js'; /** @@ -14,8 +16,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(new Monster.Types.Observer()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; * console.log(new Monster.Types.Observer()) * </script> * ``` @@ -24,18 +25,50 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observer.js'; - * console.log(Observer()) + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observer.js'; * console.log(Observer()) * </script> * ``` * + * the update method is called with the subject object as this pointer. for this reason the callback should not + * be an arrow function, because it gets the this pointer of its own context. + * + * ``` + * <script> + * Observer(()=>{ + * // this is not subject + * }) + * + * Observer(function() { + * // this is subject + * }) + * </script> + * ``` + * + * additional arguments can be passed to the callback. to do this, simply specify them. + * + * ``` + * <script> + * Observer(function(a, b, c) { + * console.log(a, b, c); // ↦ "a", 2, true + * }, "a", 2, true) + * </script> + * ``` + * + * the callback function must have as many parameters as arguments are given. + * + * * @since 1.0.0 * @copyright schukai GmbH * @memberOf Monster/Types */ class Observer extends Monster.Types.Object { + /** + * + * @param {function} callback + * @param {*} args + */ constructor(callback, ...args) { super(); @@ -45,32 +78,56 @@ class Observer extends Monster.Types.Object { this.callback = callback; this.arguments = args; - this.tags = new Set; + this.tags = new TokenList; } + /** + * + * @param {string} tag + * @returns {Observer} + */ addTag(tag) { this.tags.add(tag); return this; } + /** + * + * @param {string} tag + * @returns {Observer} + */ removeTag(tag) { - this.tags.delete(tag); + this.tags.remove(tag); return this; } + /** + * + * @returns {Array} + */ getTags() { - return this.tags + return this.tags.entries() } + /** + * + * @param {string} tag + * @returns {boolean} + */ hasTag(tag) { - return this.tags.has(tag) + return this.tags.contains(tag) } + /** + * + * @param {object} subject + * @returns {Promise} + */ update(subject) { let self = this; return new Promise(function (resolve, reject) { - if (!(subject instanceof Object)) { + if (!isObject(subject)) { reject("subject must be an object"); } let result = self.callback.apply(subject, self.arguments); diff --git a/packages/monster/source/types/observerlist.js b/packages/monster/source/types/observerlist.js index 186997bf8eaf1c47acf483d0a4beeed0b1301932..08ecdedeae80a9bf7756d08a1772662db277ede9 100644 --- a/packages/monster/source/types/observerlist.js +++ b/packages/monster/source/types/observerlist.js @@ -14,7 +14,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; * console.log(new Monster.Types.ObserverList()) * console.log(new Monster.Types.ObserverList()) * </script> @@ -24,7 +24,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/observerlist.js'; + * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/observerlist.js'; * console.log(ObserverList()) * console.log(ObserverList()) * </script> diff --git a/packages/monster/source/types/proxyobserver.js b/packages/monster/source/types/proxyobserver.js new file mode 100644 index 0000000000000000000000000000000000000000..6810b922e1af5c07cd7e76e25c40a9ed928b3087 --- /dev/null +++ b/packages/monster/source/types/proxyobserver.js @@ -0,0 +1,220 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; +import {validateObject} from "./validate.js"; +import {ObserverList} from "./observerlist.js"; +import {Observer} from "./observer.js"; +import {isObject, isArray} from "./is.js"; + +/** + * store proxy objects + * + * @type {WeakSet<object>} + */ +var proxySet = new WeakSet(); + +// language=JavaScript +/** + * an observer manages a callback function + * + * you can call the method via the monster namespace `new Monster.Types.Observer()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new Monster.Types.ProxyObserver()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/proxyobserver.js'; + * console.log(new ProxyObserver()) + * </script> + * ``` + * + * with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. + * + * this also applies to nested objects. + * + * ```javascript + * const o = new Observer(function () { + * if (isObject(this) && this instanceof ProxyObserver) { + * // do something (this ist ProxyObserver) + * const subject = this.getSubject(); + * } + * ) + * + * let realSubject = { + * a: { + * b: { + * c: true + * }, + * d: 5 + * } + * + * + * const p = new ProxyObserver(realSubject); + * p.attachObserver(o); + * const s = p.getSubject(); + * s.a.b.c = false; + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +class ProxyObserver extends Object { + + /** + * + * @param {object} object + */ + constructor(object) { + super(); + validateObject(object); + this.realSubject = object + this.subject = new Proxy(object, getHandler.call(this)); + proxySet.add(this.subject); + this.observers = new ObserverList; + } + + /** + * get the real object + * + * changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later. + * + * @returns {object} + */ + getSubject() { + return this.subject + } + + /** + * get the proxied object + * + * @returns {object} + */ getRealSubject() { + return this.realSubject + } + + /** + * attach a new observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + attachObserver(observer) { + this.observers.attach(observer) + return this; + } + + /** + * detach a observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + detachObserver(observer) { + this.observers.detach(observer) + return this; + } + + /** + * notify all observer + * + * @returns {ProxyObserver} + */ + notifyObservers() { + this.observers.notify(this); + return this; + } + + /** + * @param {Observer} observer + * @returns {ProxyObserver} + */ + containsObserver(observer) { + return this.observers.contains(observer) + } + +} + +Monster.assignToNamespace('Monster.Types', ProxyObserver); +export {Monster, ProxyObserver} + +/** + * + * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}} + * @private + * @see {@link https://gitlab.schukai.com/-/snippets/49} + */ +function getHandler() { + + const proxy = this; + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots + const handler = { + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + get: function (target, property, receiver) { + const prop = target?.[property]; + + // return if property not found + if (prop === undefined) { + return undefined; + } + + // set value as proxy if object or array + if (isArray(prop) || isObject(prop) && !proxySet.has(prop)) { + target[property] = new Proxy(prop, handler); + proxySet.add(prop); + } + + return target[property]; + + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + set: function (target, property, value, receiver) { + target[property] = value + proxy.observers.notify(proxy); + return true; + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + deleteProperty: function (target, property) { + if (property in target) { + delete target[property]; + proxy.observers.notify(proxy); + return true; + } + return false; + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + defineProperty: function (target, property, descriptor) { + let result = Reflect.defineProperty(target, property, descriptor); + proxy.observers.notify(proxy); + return parseURLToResultingURLRecord(); + }, + + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v + setPrototypeOf: function (target, prototype) { + let result = Reflect.setPrototypeOf(object1, prototype); + proxy.observers.notify(proxy); + return result; + } + + }; + + + return handler; +} diff --git a/packages/monster/source/types/tokenlist.js b/packages/monster/source/types/tokenlist.js new file mode 100644 index 0000000000000000000000000000000000000000..ae87911b66cb1e2fe2129fe969d5b6ad139207b5 --- /dev/null +++ b/packages/monster/source/types/tokenlist.js @@ -0,0 +1,316 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster} from '../namespace.js'; +import {Object} from '../types/object.js'; +import {isString, isIterable} from '../types/is.js'; +import {validateString, validateFunction} from '../types/validate.js'; + +/** + * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). + * + * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. + * + * you can call the method via the monster namespace `new Monster.Types.TokenList()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new Monster.Types.TokenList("myclass row")) + * console.log(new Monster.Types.TokenList("myclass row")) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/tokenlist.js'; + * console.log(new TokenList("myclass row")) + * console.log(new TokenList("myclass row")) + * </script> + * ``` + * + * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * + * ``` + * console.log(typeof new TokenList("myclass row")[Symbol.iterator]); // "function" + * ``` + * + * + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +class TokenList extends Object { + + /** + * + * @param {array|string|iteratable} init + */ + constructor(init) { + super(); + this.tokens = new Set(); + + if (typeof init !== "undefined") { + this.add(init); + } + + } + + /** + * Iterator protocol + * + * @returns {Symbol.iterator} + */ + getIterator() { + return this[Symbol.iterator](); + } + + /** + * Iterator + * + * @returns {{next: ((function(): ({value: *, done: boolean}))|*)}} + */ + [Symbol.iterator]() { + // Use a new index for each iterator. This makes multiple + // iterations over the iterable safe for non-trivial cases, + // such as use of break or nested looping over the same iterable. + let index = 0; + let entries = this.entries() + + return { + next: () => { + if (index < entries.length) { + return {value: entries?.[index++], done: false} + } else { + return {done: true} + } + } + } + } + + /** + * Returns true if it contains token, otherwise false + * + * ``` + * new TokenList("start middle end").contains('start')); // ↦ true + * new TokenList("start middle end").contains('end')); // ↦ true + * new TokenList("start middle end").contains('xyz')); // ↦ false + * new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true + * new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + */ + contains(value) { + if (isString(value)) { + value = value.trim() + let counter = 0; + value.split(" ").forEach(token => { + if (this.tokens.has(token.trim()) === false) return false; + counter++ + }) + return counter > 0 ? true : false; + } + + if (isIterable(value)) { + let counter = 0; + for (let token of value) { + validateString(token); + if (this.tokens.has(token.trim()) === false) return false; + counter++ + } + return counter > 0 ? true : false; + } + + return false; + } + + /** + * add tokens + * + * ``` + * new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" + * new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" + * new TokenList().add(undefined); // ↦ add nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + add(value) { + if (isString(value)) { + value.split(" ").forEach(token => { + this.tokens.add(token.trim()); + }) + } else if (isIterable(value)) { + for (let token of value) { + validateString(token); + this.tokens.add(token.trim()); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + + /** + * remove all tokens + * + * @returns {TokenList} + */ + clear() { + this.tokens.clear(); + return this; + } + + /** + * Removes token + * + * ``` + * new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(undefined); // ↦ remove nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + remove(value) { + if (isString(value)) { + value.split(" ").forEach(token => { + this.tokens.delete(token.trim()); + }) + } else if (isIterable(value)) { + for (let token of value) { + validateString(token); + this.tokens.delete(token.trim()); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + + /** + * this method replaces a token with a new token. + * + * if the passed token exists, it is replaced with newToken and TokenList is returned. + * if the token does not exist, newToken is not set and TokenList is returned. + * + * @param {string} token + * @param {string} newToken + * @returns {TokenList} + */ + replace(token, newToken) { + validateString(token); + validateString(newToken); + if (!this.contains(token)) { + return this; + } + + let a = Array.from(this.tokens) + let i = a.indexOf(token); + if (i === -1) return this; + + a.splice(i, 1, newToken); + this.tokens = new Set(); + this.add(a); + + return this; + + + } + + /** + * Removes token from string. If token doesn't exist it's added. + * + * ``` + * new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" + * new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" + * new TokenList().toggle(undefined); // ↦ nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + * @throws {TypeError} unsupported value + */ + toggle(value) { + + if (isString(value)) { + value.split(" ").forEach(token => { + toggleValue.call(this, token); + }) + } else if (isIterable(value)) { + for (let token of value) { + toggleValue.call(this, token); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + + } + + /** + * returns an array with all tokens + * + * @returns {array} + */ + entries() { + return Array.from(this.tokens) + } + + /** + * executes the provided function with each value of the set + * + * @param {function} callback + * @returns {TokenList} + */ + forEach(callback) { + validateFunction(callback); + this.tokens.forEach(callback); + return this; + } + + /** + * returns the individual tokens separated by a blank character + * + * @returns {string} + */ + toString() { + return this.entries().join(' '); + } + +} + +/** + * @private + * @param token + * @returns {toggleValue} + * @throws {Error} must be called with TokenList.call + */ +function toggleValue(token) { + if (!(this instanceof TokenList)) throw Error("must be called with TokenList.call") + validateString(token); + token = token.trim(); + if (this.contains(token)) { + this.remove(token); + return this; + } + this.add(token); + return this; +} + +Monster.assignToNamespace('Monster.Types', TokenList); +export {Monster, TokenList} diff --git a/packages/monster/source/types/validate.js b/packages/monster/source/types/validate.js index 5b9a01b66eda307e301518ccbfe6202720a576db..0ca3b5499f1b01027db369a1391ddcf9d62ad055 100644 --- a/packages/monster/source/types/validate.js +++ b/packages/monster/source/types/validate.js @@ -5,7 +5,7 @@ */ import {Monster} from '../namespace.js'; -import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '../types/is.js'; +import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable} from '../types/is.js'; /** * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. @@ -14,7 +14,46 @@ import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError + * console.log(Monster.Types.validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; + * console.log(validateIterable('2')) // ↦ TypeError + * console.log(validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * @param {*} value + * @return {undefined} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + * @throws {TypeError} value is not a primitive + * @see {@link isPrimitive} + * @see {@link Monster/Types/isPrimitive} + * @see {@link Monster/Types#isPrimitive} + */ +function validateIterable(value) { + if (!isIterable(value)) { + throw new TypeError('value is not iterable') + } +} + +/** + * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. + * + * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError * </script> @@ -24,7 +63,7 @@ import {isPrimitive, isBoolean, isString, isObject, isArray, isFunction} from '. * * ``` * <script type="module"> - * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validatePrimitive('2')) // ↦ undefined * console.log(validatePrimitive([])) // ↦ TypeError * </script> @@ -53,7 +92,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError @@ -64,7 +103,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateBoolean(false)) // ↦ undefined * console.log(validateBoolean('2')) // ↦ TypeError * console.log(validateBoolean([])) // ↦ TypeError @@ -92,7 +131,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateString('2')) // ↦ undefined * console.log(Monster.Types.validateString([])) // ↦ TypeError * </script> @@ -102,7 +141,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateString('2')) // ↦ undefined * console.log(validateString([])) // ↦ TypeError * </script> @@ -130,7 +169,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateObject({})) // ↦ undefined * console.log(Monster.Types.validateObject('2')) // ↦ TypeError * console.log(Monster.Types.validateObject([])) // ↦ TypeError @@ -141,7 +180,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateObject({})) // ↦ undefined * console.log(validateObject('2')) // ↦ TypeError * console.log(validateObject([])) // ↦ TypeError @@ -168,7 +207,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateArray('2')) // ↦ TypeError * console.log(Monster.Types.validateArray([])) // ↦ undefined * </script> @@ -178,7 +217,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateArray('2')) // ↦ TypeError * console.log(validateArray([])) // ↦ undefined * </script> @@ -204,7 +243,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError * console.log(Monster.Types.validateFunction([])) // ↦ TypeError @@ -215,7 +254,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/validate.js'; * console.log(validateFunction(()=>{})) // ↦ undefined * console.log(validateFunction('2')) // ↦ TypeError * console.log(validateFunction([])) // ↦ TypeError @@ -235,5 +274,14 @@ function validateFunction(value) { } } -Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction); -export {Monster, validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction} +Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable); +export { + Monster, + validatePrimitive, + validateBoolean, + validateString, + validateObject, + validateArray, + validateFunction, + validateIterable +} diff --git a/packages/monster/source/types/version.js b/packages/monster/source/types/version.js index 479019c11fb28b00827d8e008215bf89985b809f..6b5214f40477b983bb9ea237469518e536e3bacd 100644 --- a/packages/monster/source/types/version.js +++ b/packages/monster/source/types/version.js @@ -10,7 +10,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 * </script> @@ -20,7 +20,7 @@ import '../types/object.js'; * * ``` * <script type="module"> - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(new Version('1.2.3')) // ↦ 1.2.3 * console.log(new Version('1')) // ↦ 1.0.0 * </script> @@ -150,7 +150,7 @@ let monsterVersion; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(Monster.getVersion()) * console.log(Monster.getVersion()) * </script> @@ -160,7 +160,7 @@ let monsterVersion; * * ``` * <script type="module"> - * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/types/version.js'; + * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/version.js'; * console.log(getVersion()) * console.log(getVersion()) * </script> @@ -177,7 +177,7 @@ function getVersion() { return monsterVersion; } /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.1.0') + monsterVersion = new Version('1.3.0') /**#@-*/ return monsterVersion; diff --git a/packages/monster/source/util/clone.js b/packages/monster/source/util/clone.js index c37d763c5b5055f3a93c952402f75936cd89e501..da1f03b0de9b8496f1b40baf55d7e6a19bc45fe7 100644 --- a/packages/monster/source/util/clone.js +++ b/packages/monster/source/util/clone.js @@ -21,7 +21,7 @@ import {isObject, isFunction, isPrimitive, isArray} from '../types/is.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(Monster.Util.clone({})) * </script> * ``` @@ -30,7 +30,7 @@ import {isObject, isFunction, isPrimitive, isArray} from '../types/is.js'; * * ``` * <script type="module"> - * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/clone.js'; + * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/clone.js'; * console.log(clone({})) * </script> * ``` diff --git a/packages/monster/source/util/comparator.js b/packages/monster/source/util/comparator.js new file mode 100644 index 0000000000000000000000000000000000000000..6f4a7ddb600b7396f8fbfe07086158a61e7a019d --- /dev/null +++ b/packages/monster/source/util/comparator.js @@ -0,0 +1,161 @@ +'use strict'; + +/** + * @author schukai GmbH + */ + +import {Monster, Object} from '../types/object.js'; +import {isFunction} from '../types/is.js'; + +/** + * the comparator allows a comparison function to be abstracted. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Monster.Util.Comparator()) + * console.log(new Monster.Util.Comparator()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/types/id.js'; + * console.log(new Util()) + * console.log(new Util()) + * </script> + * ``` + * + * the following are some examples of the application of the class. + * + * ``` + * new Comparator().lessThanOrEqual(2, 5) // ↦ true + * new Comparator().greaterThan(4, 2) // ↦ true + * new Comparator().equal(4, 4) // ↦ true + * new Comparator().equal(4, 5) // ↦ false + * ``` + * + * you can also pass your own comparison function, and thus define the comparison function. + * + * ``` + * new Comparator(function (a, b) { + * if (a.v === b.v) return 0; + * return a.v < b.v ? -1 : 1; + * }).equal({v: 2}, {v: 2}); // ↦ true + * ``` + * + * @since 1.3.0 + * @memberOf Monster/Util + */ +class Comparator extends Object { + + /** + * create new comparator + * + * @param {function} callback + * @throw {TypeError} "unsupported type" + * @throw {TypeError} "impractical comparison" + */ + constructor(callback) { + super(); + + if (isFunction(callback)) { + this.compare = callback + } else if (callback !== undefined) { + throw new TypeError("unsupported type") + } else { + // default compare function + this.compare = function (a, b) { + + if (typeof a !== typeof b) { + throw new TypeError("impractical comparison") + } + + if (a === b) { + return 0; + } + return a < b ? -1 : 1; + }; + } + + } + + /** + * changes the order of the operators + * + * @return {Comparator} + */ + reverse() { + const original = this.compare; + this.compare = (a, b) => original(b, a); + return this; + } + + /** + * Checks if two variables are equal. + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + equal(a, b) { + return this.compare(a, b) === 0; + } + + + /** + * Checks if variable `a` is greater than `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + greaterThan(a, b) { + return this.compare(a, b) > 0; + } + + /** + * Checks if variable `a` is greater than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + greaterThanOrEqual(a, b) { + return this.greaterThan(a, b) || this.equal(a, b); + } + + /** + * Checks if variable `a` is less than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + lessThanOrEqual(a, b) { + return this.lessThan(a, b) || this.equal(a, b); + } + + /** + * Checks if variable a is less than b + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + lessThan(a, b) { + return this.compare(a, b) < 0; + } + + +} + +Monster.assignToNamespace('Monster.Util', Comparator); +export {Monster, Comparator} diff --git a/packages/monster/source/util/freeze.js b/packages/monster/source/util/freeze.js index 45e856ba9b306dd6eacd0817a0606f8824f86f27..1977182d88ae1f059dd42001c5d88e9c5566bc0b 100644 --- a/packages/monster/source/util/freeze.js +++ b/packages/monster/source/util/freeze.js @@ -14,7 +14,7 @@ import {validateObject} from '../types/validate.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(Monster.Util.deepFreeze({})) * </script> * ``` @@ -23,7 +23,7 @@ import {validateObject} from '../types/validate.js'; * * ``` * <script type="module"> - * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.1.0/dist/modules/util/freeze.js'; + * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.3.0/dist/modules/util/freeze.js'; * console.log(deepFreeze({})) * </script> * ``` diff --git a/packages/monster/test/cases/constraint/andoperator.js b/packages/monster/test/cases/constraint/andoperator.js new file mode 100644 index 0000000000000000000000000000000000000000..a9508d1da5c82b80aa14969a20c543c0889f4b9d --- /dev/null +++ b/packages/monster/test/cases/constraint/andoperator.js @@ -0,0 +1,35 @@ +import {Valid} from "../../../source/constraints/valid.js"; +import {Invalid} from "../../../source/constraints/invalid.js"; +import {AndOperator} from "../../../source/constraints/andoperator.js"; + +describe('AndOperator', function () { + + describe('.isValid()', function () { + + [ + [new Valid(), new Valid(), true], + [new Valid(), new Invalid(), false], + [new Invalid(), new Valid(), false], + [new Invalid(), new Invalid(), false] + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + it('constraint.isValid() should return ' + c, function (done) { + + let constraint = new AndOperator(a, b); + constraint.isValid().then(() => { + c === true ? done() : done(new Error()); + }).catch(() => { + c === true ? done(new Error()) : done(); + }) + + }); + + }); + + }); +}); + diff --git a/packages/monster/test/cases/constraint/invalid.js b/packages/monster/test/cases/constraint/invalid.js new file mode 100644 index 0000000000000000000000000000000000000000..fbdf5156571b08b3e5ae2c720edc951fed881ea4 --- /dev/null +++ b/packages/monster/test/cases/constraint/invalid.js @@ -0,0 +1,19 @@ +import {Monster, Invalid} from "../../../source/constraints/invalid.js"; +import {expect} from "chai" + +describe('Invalid', function () { + + describe('.isValid()', function () { + let isvalid = new Invalid() + + it('should resolve promise', function (done) { + isvalid.isValid().catch(e => { + expect(e).to.be.undefined + done(); + }) + }); + + }); + +}); + diff --git a/packages/monster/test/cases/constraint/isarray.js b/packages/monster/test/cases/constraint/isarray.js new file mode 100644 index 0000000000000000000000000000000000000000..d972fcaccc1d5533b65131f23e2f1a424fe2efa3 --- /dev/null +++ b/packages/monster/test/cases/constraint/isarray.js @@ -0,0 +1,21 @@ +import {IsArray} from "../../../source/constraints/isarray.js"; +import {expect} from "chai" + +describe('IsArray', function () { + + describe('.isValid()', function () { + let constraint = new IsArray() + + it('should resolve promise', function (done) { + constraint.isValid([1,2,3]).then(r => { + expect(r).is.a('array'); + done(); + }).catch(e => { + done(new Error("should not reached: " + e)); + }) + }); + + }); + +}); + diff --git a/packages/monster/test/cases/constraint/isobject.js b/packages/monster/test/cases/constraint/isobject.js new file mode 100644 index 0000000000000000000000000000000000000000..ab5230b31994fbd8f0f63fe83111fef39d853d88 --- /dev/null +++ b/packages/monster/test/cases/constraint/isobject.js @@ -0,0 +1,21 @@ +import {IsObject} from "../../../source/constraints/isobject.js"; +import {expect} from "chai" + +describe('IsObject', function () { + + describe('.isValid()', function () { + let constraint = new IsObject() + + it('should resolve promise', function (done) { + constraint.isValid({}).then(r => { + expect(r).is.a('object'); + done(); + }).catch(e => { + done(new Error("should not reached: " + e)); + }) + }); + + }); + +}); + diff --git a/packages/monster/test/cases/constraint/oroperator.js b/packages/monster/test/cases/constraint/oroperator.js new file mode 100644 index 0000000000000000000000000000000000000000..a1721ae98f3294ea5a5bbad629d6fcede908bd91 --- /dev/null +++ b/packages/monster/test/cases/constraint/oroperator.js @@ -0,0 +1,35 @@ +import {Valid} from "../../../source/constraints/valid.js"; +import {Invalid} from "../../../source/constraints/invalid.js"; +import {OrOperator} from "../../../source/constraints/oroperator.js"; + +describe('OrOperator', function () { + + describe('.isValid()', function () { + + [ + [new Valid(), new Valid(), true], + [new Valid(), new Invalid(), true], + [new Invalid(), new Valid(), true], + [new Invalid(), new Invalid(), false] + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + it('constraint.isValid() should return ' + c, function (done) { + + let constraint = new OrOperator(a, b); + constraint.isValid().then(() => { + c === true ? done() : done(new Error()); + }).catch(() => { + c === true ? done(new Error()) : done(); + }) + + }); + + }); + + }); +}); + diff --git a/packages/monster/test/cases/constraint/valid.js b/packages/monster/test/cases/constraint/valid.js new file mode 100644 index 0000000000000000000000000000000000000000..a5363be3ab2d7cd80f469675159e5b71bf5fd22d --- /dev/null +++ b/packages/monster/test/cases/constraint/valid.js @@ -0,0 +1,20 @@ +import {Monster, Valid} from "../../../source/constraints/valid.js"; +import {expect} from "chai" + +describe('Valid', function () { + + describe('.isValid()', function () { + let constraint = new Valid() + + it('should resolve promise', function (done) { + constraint.isValid({}).then(r => { + done(); + }).catch(e => { + done(new Error("should not reached: " + e)); + }) + }); + + }); + +}); + diff --git a/packages/monster/test/cases/math/random.js b/packages/monster/test/cases/math/random.js index b36615b3e9355c0c0e9eda405b51850afae71ef2..fef5eeda184cc6c6d7c3da642d78bd2ddccdc677 100644 --- a/packages/monster/test/cases/math/random.js +++ b/packages/monster/test/cases/math/random.js @@ -3,7 +3,7 @@ /** nodejs doesnt support window.crypt */ import {expect} from "chai" import * as Crypto from "@peculiar/webcrypto"; -import {Monster} from "../../../source/monster.js"; +import {Monster,random} from "../../../source/math/random.js"; if(!global['crypto']) { global['crypto'] = new Crypto.Crypto(); @@ -22,7 +22,7 @@ describe('Math', function () { let a = data.shift() let b = data.shift() - let r = Monster.Math.random(a, b); + let r = random(a, b); it(r + ' should return value between ' + a + ' ' + b, function () { expect(r >= a).to.be.true; @@ -43,7 +43,7 @@ describe('Math', function () { const rounds = 500 for (let i = 0, max = rounds; i < max; i++) { - sum += Monster.Math.random(a, b); + sum += random(a, b); } let avg = sum / rounds; diff --git a/packages/monster/test/cases/monster.js b/packages/monster/test/cases/monster.js index 535e5f907d4e0145cb29bae0a81d3daf82571d17..e373343a742d94c689a616cc8d9dba42a4784dff 100644 --- a/packages/monster/test/cases/monster.js +++ b/packages/monster/test/cases/monster.js @@ -1,20 +1,19 @@ -import * as assert from 'assert'; -import {Monster} from "../../source/monster.js"; +import {expect} from "chai" +import {Monster,Version} from "../../source/types/version.js"; describe('Monster', function () { describe('.getVersion()', function () { let monsterVersion - let Version = Monster.Types.Version /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.1.0') + monsterVersion = new Version('1.3.0') /**#@-*/ let m = Monster.getVersion(); it('should ' + monsterVersion + ' is ' + m, function () { - assert.equal(m.compareTo(monsterVersion), 0); + expect(m.compareTo(monsterVersion)).is.equal(0); }); }); diff --git a/packages/monster/test/cases/types/id.js b/packages/monster/test/cases/types/id.js index ddec0a8f0dfb8efd2cf1451fc8f5b9a4ec6b6da1..bdc4c0282b689649e68c48afc69bcb6c9044cc5e 100644 --- a/packages/monster/test/cases/types/id.js +++ b/packages/monster/test/cases/types/id.js @@ -1,16 +1,21 @@ -import * as assert from 'assert'; +import {Monster, ID} from "../../../source/types/id.js"; +import {expect} from "chai" + +import * as Crypto from "@peculiar/webcrypto"; + +if (!global['crypto']) { + global['crypto'] = new Crypto.Crypto(); +} -import * as btoa from 'btoa'; -import {Monster} from "../../../source/monster.js"; describe('ID', function () { describe('.toString()', function () { - let id = new Monster.Types.ID() + let id = new ID() let result = id.toString(); it('should return a string', function () { - assert.ok(typeof result === 'string'); + expect(result).is.a('string') }); }); diff --git a/packages/monster/test/cases/types/is.js b/packages/monster/test/cases/types/is.js index 41cd076c8be706063aa41cab537ba1ec7f6f82ee..1711f4bf26d86e82fe81192989d03eee9eb77582 100644 --- a/packages/monster/test/cases/types/is.js +++ b/packages/monster/test/cases/types/is.js @@ -1,6 +1,16 @@ -import * as assert from 'assert'; -import {Monster} from "../../../source/monster.js"; +import { + Monster, + isPrimitive, + isBoolean, + isString, + isObject, + isArray, + isFunction, + isIterable +} from "../../../source/types/is.js"; + +import {expect} from "chai" describe('Is', function () { @@ -10,13 +20,15 @@ describe('Is', function () { ['test1', true], [undefined, true], [null, true], - [()=>{},false], + [() => { + }, false], [2, true], + [parseInt("a"), true], [false, true], [true, true], [4.5, true], [{}, false], - [[1,2,3], false], + [[1, 2, 3], false], [Symbol("foo"), true], ].forEach(function (data) { @@ -24,8 +36,36 @@ describe('Is', function () { let b = data.shift() it('is.isPrimitive(' + typeof a + ') should return ' + b, function () { - assert.equal(Monster.Types.isPrimitive(a), b); + expect(isPrimitive(a)).is.equal(b) + }); + }); + + + }); + + describe('.isIterable()', function () { + + [ + ['test1', true], + [undefined, false], + [null, false], + [() => { + }, false], + [parseInt("a"), false], + [2, false], + [false, false], + [true, false], + [4.5, false], + [{}, false], + [[1, 2, 3], true], + [Symbol("foo"), false], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + it('is.isIterable(' + typeof a + ') should return ' + b, function () { + expect(isIterable(a)).is.equal(b) }); }); @@ -38,13 +78,15 @@ describe('Is', function () { ['test1', false], [undefined, false], [null, false], - [()=>{},false], + [() => { + }, false], [2, false], [false, true], + [parseInt("a"), false], [true, true], [4.5, false], [{}, false], - [[1,2,3], false], + [[1, 2, 3], false], [Symbol("foo"), false], ].forEach(function (data) { @@ -52,27 +94,28 @@ describe('Is', function () { let b = data.shift() it('is.isBoolean(' + typeof a + ') should return ' + b, function () { - assert.equal(Monster.Types.isBoolean(a), b); - + expect(isBoolean(a)).is.equal(b) }); }); }); - + describe('.isString()', function () { [ ['test1', true], [undefined, false], [null, false], - [()=>{},false], + [() => { + }, false], [2, false], [false, false], + [parseInt("a"), false], [true, false], [4.5, false], [{}, false], - [[1,2,3], false], + [[1, 2, 3], false], [Symbol("foo"), false], ].forEach(function (data) { @@ -80,27 +123,28 @@ describe('Is', function () { let b = data.shift() it('is.isString(' + typeof a + ') should return ' + b, function () { - assert.equal(Monster.Types.isString(a), b); - + expect(isString(a)).is.equal(b) }); }); }); - + describe('.isObject()', function () { [ ['test1', false], [undefined, false], [null, false], - [()=>{},false], + [() => { + }, false], [2, false], [false, false], + [parseInt("a"), false], [true, false], [4.5, false], [{}, true], - [[1,2,3], false], + [[1, 2, 3], false], [Symbol("foo"), false], ].forEach(function (data) { @@ -108,28 +152,29 @@ describe('Is', function () { let b = data.shift() it('is.isObject(' + JSON.stringify(a) + ') should return ' + b, function () { - assert.equal(Monster.Types.isObject(a), b); - + expect(isObject(a)).is.equal(b) }); }); }); - + describe('.isArray()', function () { [ ['test1', false], [undefined, false], [null, false], - [()=>{},false], + [() => { + }, false], [2, false], [false, false], + [parseInt("a"), false], [true, false], [4.5, false], [{}, false], - [[1,2,3], true], + [[1, 2, 3], true], [Symbol("foo"), false], ].forEach(function (data) { @@ -137,25 +182,26 @@ describe('Is', function () { let b = data.shift() it('is.isArray(' + typeof a + ') should return ' + b, function () { - assert.equal(Monster.Types.isArray(a), b); - + expect(isArray(a)).is.equal(b) }); }); - }); - + }); + describe('.isFunction()', function () { [ ['test1', false], [undefined, false], [null, false], - [()=>{},true], + [() => { + }, true], [2, false], [false, false], + [parseInt("a"), false], [true, false], [4.5, false], [{}, false], - [[1,2,3], false], + [[1, 2, 3], false], [Symbol("foo"), false], ].forEach(function (data) { @@ -163,8 +209,7 @@ describe('Is', function () { let b = data.shift() it('is.isFunction(' + typeof a + ') should return ' + b, function () { - assert.equal(Monster.Types.isFunction(a), b); - + expect(isFunction(a)).is.equal(b) }); }); }); diff --git a/packages/monster/test/cases/types/observer.js b/packages/monster/test/cases/types/observer.js index cf3f86a0284da10e35bc904e389248261f7655e8..2a477f98f08f64c3d3cbd49c15a774e4296108ee 100644 --- a/packages/monster/test/cases/types/observer.js +++ b/packages/monster/test/cases/types/observer.js @@ -1,13 +1,14 @@ -import * as assert from 'assert'; +import {expect} from "chai" + +import {Monster, Observer} from "../../../source/types/observer.js"; -import {Monster} from "../../../source/monster.js"; describe('Observer', function () { let callback = function () { }; - let observer = new Monster.Types.Observer(callback) + let observer = new Observer(callback) describe('.addTag()', function () { @@ -18,8 +19,8 @@ describe('Observer', function () { let a = data.shift() - it('addTag(' + a + ') should return instanceof Monster.Types.Observer', function () { - assert.ok(observer.addTag(a) instanceof Monster.Types.Observer); + it('addTag(' + a + ') should return instanceof Observer', function () { + expect(observer.addTag(a)).is.instanceOf(Observer) }); }); @@ -34,8 +35,8 @@ describe('Observer', function () { let a = data.shift() - it('removeTag(' + a + ') should return instanceof Monster.Types.Observer', function () { - assert.ok(observer.removeTag(a) instanceof Monster.Types.Observer); + it('removeTag(' + a + ') should return instanceof Observer', function () { + expect(observer.removeTag(a)).is.instanceOf(Observer) }); }); @@ -50,7 +51,7 @@ describe('Observer', function () { ['test4', false], ].forEach(function (data) { - let tempObserver = new Monster.Types.Observer(callback) + let tempObserver = new Observer(callback) let a = data.shift() let b = data.shift() @@ -59,9 +60,9 @@ describe('Observer', function () { if (b === true) { tempObserver.addTag(a) - assert.ok(tempObserver.hasTag(a)); + expect(tempObserver.hasTag(a)).is.be.true } else { - assert.ok(!tempObserver.hasTag(a)) + expect(tempObserver.hasTag(a)).is.be.false } }); }); @@ -73,16 +74,14 @@ describe('Observer', function () { let obj = {} it('observer.update(' + obj + ') is ' + 1 + 3 + 6, function (done) { - let tempObserver = new Monster.Types.Observer(function (a, b, c) { + let tempObserver = new Observer(function (a, b, c) { return a + b + c }, 1, 3, 6) tempObserver.update(obj).then(a => { - - assert.equal(a, 1 + 3 + 6); + expect(a).is.equal(1 + 3 + 6) done(); - }); }); @@ -96,7 +95,7 @@ describe('Observer', function () { [['test1', 'test1', 'test1', 'test4'], 2], // multiple test1 (set is uniqueue) ].forEach(function (data) { - let tempObserver = new Monster.Types.Observer(callback) + let tempObserver = new Observer(callback) let a = data.shift() let b = data.shift() @@ -105,13 +104,12 @@ describe('Observer', function () { tempObserver.addTag(a[i]); } - it('observer.getTags(' + a + ') is instanceof Set', function () { - assert.ok(tempObserver.getTags() instanceof Set); - + it('observer.getTags(' + a + ') is array', function () { + expect(tempObserver.getTags()).to.be.an('array') }); it('observer.getTags(' + a + ') should return ' + b + " tags", function () { - assert.equal(tempObserver.getTags().size, b); + expect(tempObserver.getTags().length).is.equal(b); }); }); diff --git a/packages/monster/test/cases/types/observerlist.js b/packages/monster/test/cases/types/observerlist.js index 546b59e704faa3bb448bbe3cf8de493d036b9007..97f3959f131a3b714cf9b88be058599d304b1b02 100644 --- a/packages/monster/test/cases/types/observerlist.js +++ b/packages/monster/test/cases/types/observerlist.js @@ -1,16 +1,16 @@ -import * as assert from 'assert'; - -import {Monster} from "../../../source/monster.js"; +import {Monster, ObserverList} from "../../../source/types/observerlist.js"; +import {Observer} from "../../../source/types/observer.js"; +import {expect} from "chai" describe('ObserverList', function () { describe('.attach()', function () { - it('should return instanceof Monster.Types.ObserverList', function () { - let observerList = new Monster.Types.ObserverList() - let result = observerList.attach(new Monster.Types.Observer(() => { + it('should return instanceof ObserverList', function () { + let observerList = new ObserverList() + let result = observerList.attach(new Observer(() => { })) - assert.ok(result instanceof Monster.Types.ObserverList); + expect(result).to.be.instanceOf(ObserverList) }); @@ -18,11 +18,11 @@ describe('ObserverList', function () { describe('.detach()', function () { - it('should return instanceof Monster.Types.ObserverList', function () { - let observerList = new Monster.Types.ObserverList() - let result = observerList.detach(new Monster.Types.Observer(() => { + it('should return instanceof ObserverList', function () { + let observerList = new ObserverList() + let result = observerList.detach(new Observer(() => { })) - assert.ok(result instanceof Monster.Types.ObserverList); + expect(result).to.be.instanceOf(ObserverList) }); @@ -32,15 +32,15 @@ describe('ObserverList', function () { const resultValue = "Yes!"; - let o = new Monster.Types.Observer(() => { + let o = new Observer(() => { return resultValue }); - let observerList = new Monster.Types.ObserverList() + let observerList = new ObserverList() observerList.attach(o) it('should instanceof Promise', function () { - assert.ok(observerList.notify() instanceof Promise); + expect(observerList.notify()).to.be.instanceOf(Promise) }); it('should return ' + resultValue, function (done) { @@ -48,7 +48,7 @@ describe('ObserverList', function () { let obj = {} observerList.notify(obj).then(r => { - assert.equal(r, resultValue); + expect(r).to.be.an('array').that.includes(resultValue); done(); }).catch(e => { done(new Error(e)); @@ -60,37 +60,38 @@ describe('ObserverList', function () { describe('.contains()', function () { - let o1 = new Monster.Types.Observer(() => { + let o1 = new Observer(() => { }); - let o2 = new Monster.Types.Observer(() => { + let o2 = new Observer(() => { }); it('should not contain o1 and o2', function () { - let observerList = new Monster.Types.ObserverList() - assert.ok(!observerList.contains(o1)); - assert.ok(!observerList.contains(o2)); + let observerList = new ObserverList() + + expect(observerList.contains(o1)).to.be.false; + expect(observerList.contains(o2)).to.be.false; }); it('should contain o2 and not o1', function () { - let observerList = new Monster.Types.ObserverList() + let observerList = new ObserverList() observerList.attach(o2) - assert.ok(!observerList.contains(o1)); - assert.ok(observerList.contains(o2)); + expect(observerList.contains(o1)).to.be.false; + expect(observerList.contains(o2)).to.be.true; }); it('should contain o1 and not o2', function () { - let observerList = new Monster.Types.ObserverList() + let observerList = new ObserverList() observerList.attach(o1) - assert.ok(observerList.contains(o1)); - assert.ok(!observerList.contains(o2)); + expect(observerList.contains(o1)).to.be.true; + expect(observerList.contains(o2)).to.be.false; }); it('should contain o2 and o1', function () { - let observerList = new Monster.Types.ObserverList() + let observerList = new ObserverList() observerList.attach(o2).attach(o1) - assert.ok(observerList.contains(o1)); - assert.ok(observerList.contains(o2)); + expect(observerList.contains(o1)).to.be.true; + expect(observerList.contains(o2)).to.be.true; }); diff --git a/packages/monster/test/cases/types/proxyobserver.js b/packages/monster/test/cases/types/proxyobserver.js new file mode 100644 index 0000000000000000000000000000000000000000..1e81a613140782c53ff3359714511c39a9213f4c --- /dev/null +++ b/packages/monster/test/cases/types/proxyobserver.js @@ -0,0 +1,48 @@ +import {expect} from "chai" + +import {Monster, ProxyObserver} from "../../../source/types/proxyobserver.js"; +import {Observer} from "../../../source/types/observer.js"; +import {isObject} from "../../../source/types/is.js"; + + +describe('ProxyObserver', function () { + + describe('create', function () { + it('should return instanceof ProxyObserver', function () { + let o = new ProxyObserver({}); + expect(o).is.instanceOf(ProxyObserver); + }); + }); + + describe('notify observer', function () { + it('should inform observer', function (done) { + let o = new Observer(function (a) { + if(isObject(this) && this instanceof ProxyObserver) { + return done(); + } + + done(new Error("this is not ProxyObserver")) + }, true) + + let realSubject = { + a: { + b: { + c: true + }, + d: 5 + } + } + + let p = new ProxyObserver(realSubject); + expect(p).is.instanceOf(ProxyObserver); + expect(p.attachObserver(o)).is.instanceOf(ProxyObserver); + + let s = p.getSubject(); + s.a.b.c = false; + + }); + }); + + +}); + diff --git a/packages/monster/test/cases/types/tokenlist.js b/packages/monster/test/cases/types/tokenlist.js new file mode 100644 index 0000000000000000000000000000000000000000..640f50399be659eac0281d4bb0ce5daac5084c0f --- /dev/null +++ b/packages/monster/test/cases/types/tokenlist.js @@ -0,0 +1,261 @@ +import {expect} from "chai" +import {Monster, TokenList} from "../../../source/types/tokenlist.js"; + + +describe('TokenList', function () { + + describe('.toString()', function () { + let tokenList = new TokenList() + let result = tokenList.toString(); + + it('should return a string', function () { + expect(result).to.be.a('string'); + }); + + it('set and remove return a string', function () { + expect(result).to.be.a('string'); + }); + + + }); + + + describe('init with string iterable', function () { + + it('new TokenList(' + typeof a + ') throw TypeError ', function () { + + let tokens = ["abc", "def", "ghi"] + let list = new TokenList(tokens); + expect(list.toString()).is.equal("abc def ghi"); + }); + + }); + + describe('init with iterable without string values', function () { + + it('new TokenList(' + typeof a + ') throw TypeError ', function () { + let tokens = ["abc", 4, "ghi"] + expect(() => new TokenList(tokens)).to.throw(TypeError); + }); + + }); + + describe('init values', function () { + + [ + // current, expected, typerror + ['test1', "test1", false], + ['test1 test2', "test1 test2", false], + [undefined, "", false], + [null, undefined, true], + [parseInt("a"), undefined, true], // NaN + [() => { + }, undefined, true], + [2, undefined, true], + [false, undefined, true], + [true, undefined, true], + [4.5, undefined, true], + [{}, undefined, true], + [["1", "2", "3"], '1 2 3', false], // iterable strings + [[1, 2, 3], undefined, true], + [Symbol("foo"), false, true], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + if (c === true) { + it('new TokenList(' + typeof a + ') throw TypeError ', function () { + expect(() => new TokenList(a)).to.throw(TypeError); + }); + } else { + it('new TokenList(' + typeof a + ') should return ' + b, function () { + expect(new TokenList(a).toString()).is.equal(b) + }); + + } + + }); + + }); + + describe('iterator protocol', function () { + + let list; + it('.add(' + "second" + ') should return TokenList', function () { + list = new TokenList("start"); + expect(list.getIterator()).to.be.an('object'); + }); + + it('.add(' + "second" + ') should return TokenList', function () { + list = new TokenList("start end"); + expect([...list]).to.be.an('array'); + expect([...list]).to.be.an('array').to.include('start').to.include('end'); + }); + + + }); + + describe('.entries()', function () { + + let list; + it('.entries() should return Array', function () { + list = new TokenList("start"); + expect(list.entries()).to.be.an('array'); + }); + + it('.entries() should return Array', function () { + list = new TokenList("start end").entries(); + expect(list).to.be.an('array').to.include('start').to.include('end'); + }); + + + }); + + describe('.forEach()', function () { + + let list; + it('.forEach() should iterate over tokenlist', function () { + list = new TokenList("aaa bbb ccc ddd eee fff"); + + let result = "" + list.forEach((a) => { + result += "!" + a + "!"; + expect(a).to.be.an('string'); + }); + expect(result).is.equal("!aaa!!bbb!!ccc!!ddd!!eee!!fff!") + }); + + it('.entries() should return Array', function () { + list = new TokenList("start end").entries(); + expect(list).to.be.an('array').to.include('start').to.include('end'); + }); + + + }); + + describe('contains values', function () { + let list + it('new TokenList(start, middle end) should contain middle', function () { + list = new TokenList("start middle end"); + expect(list.contains('start')).to.be.true; + expect(list.contains('middle')).to.be.true; + expect(list.contains('end')).to.be.true; + expect(list.contains(['end', 'start', 'middle'])).to.be.true; + }); + + it('new TokenList(start, middle end) should not contain xyz', function () { + list = new TokenList("start middle end"); + expect(list.contains('xyz')).to.be.false; + expect(list.contains(['end', 'start', 'middle', 'xyz'])).to.be.false; + }); + + it('new TokenList(start, middle end) should not contain undefined null NaN', function () { + list = new TokenList("start middle end"); + expect(list.contains(undefined)).to.be.false; + expect(list.contains(parseInt("a"))).to.be.false; // NaN + expect(list.contains(null)).to.be.false; // NaN + }); + }) + + describe('toggle values', function () { + let list + it('new TokenList(start middle end).toggle(new-value) should contain new-value', function () { + list = new TokenList("start middle end"); + expect(list.toggle('new-value').toString()).is.equal("start middle end new-value"); + }); + + it('new TokenList(start middle end).toggle(middle) should not contain middle', function () { + list = new TokenList("start middle end"); + expect(list.toggle('middle').toString()).is.equal("start end"); + }); + + it('new TokenList().toggle() should ...', function () { + expect(new TokenList("abc def ghi").toggle("def xyz").toString()).to.equal("abc ghi xyz"); + }); + + it('new TokenList().toggle() should ...', function () { + expect(new TokenList("abc def ghi").toggle(["abc", "xyz"]).toString()).to.equal("def ghi xyz"); + }); + + it('new TokenList().toggle() should ...', function () { + expect(new TokenList("abc def ghi").toggle(undefined).toString()).to.equal("abc def ghi"); + }); + + }) + + describe('manipulate values', function () { + + let list + + it('result TokenList("' + "start" + '") should be "' + "start" + '"', function () { + list = new TokenList("start"); + expect(list.toString()).is.equal("start") + }); + + it('.add(' + "second" + ') should return TokenList', function () { + list = new TokenList("start"); + expect(list.add("second")).to.be.an.instanceof(TokenList); + }); + + it('.add(' + "second" + ').toString() should return "start second" ', function () { + list = new TokenList("start"); + expect(list.add("second").toString()).is.equal("start second"); + }); + + it('.add(' + "second third" + ').toString() should return "start second third" ', function () { + list = new TokenList("start"); + expect(list.add("second third").toString()).is.equal("start second third"); + }); + + it('.add(' + "[second,third]" + ').toString() should return "start second third" ', function () { + list = new TokenList("start"); + expect(list.add(["second", "third"]).toString()).is.equal("start second third"); + }); + + + it('.clear().toString() should "" ', function () { + list = new TokenList("start"); + expect(list.add(["second", "third"]).clear().toString()).is.equal(""); + }); + + + it('new TokenList("start second third end").remove(' + "second" + ') should return TokenList', function () { + list = new TokenList("start second third end"); + expect(list.remove("second")).to.be.an.instanceof(TokenList); + }); + + it('new TokenList("start second third end").remove(' + "second" + ').toString() should return "start third end" ', function () { + list = new TokenList("start second third end"); + expect(list.remove("second").toString()).is.equal("start third end"); + }); + + it('new TokenList("start second third end").remove(' + "second third" + ').toString() should return "start end" ', function () { + list = new TokenList("start second third end"); + expect(list.remove("second third").toString()).is.equal("start end"); + }); + + it('new TokenList("start second third end").remove(' + "[second,third]" + ').toString() should return "start end" ', function () { + list = new TokenList("start second third end"); + expect(list.remove(["second", "third"]).toString()).is.equal("start end"); + }); + + it('new TokenList("start second third end").replace(second, xyz).toString() should return "start xyz third end" ', function () { + list = new TokenList("start second third end"); + expect(list.replace("second", "xyz")).to.be.instanceOf(TokenList); + expect(list.toString()).is.equal("start xyz third end"); + }); + + it('new TokenList("start second third end").replace(end, xyz).toString() should return "start second third xyz" ', function () { + list = new TokenList("start second third end"); + expect(list.replace("end", "xyz")).to.be.instanceOf(TokenList); + expect(list.toString()).is.equal("start second third xyz"); + }); + + + }); + + +}); + diff --git a/packages/monster/test/cases/types/validate.js b/packages/monster/test/cases/types/validate.js index 64c619d5471d5f9759f7607d0a5174e732eb8451..2b4fb8c6c1c54989acfc59e482a8cfd377c388dc 100644 --- a/packages/monster/test/cases/types/validate.js +++ b/packages/monster/test/cases/types/validate.js @@ -1,6 +1,15 @@ -import * as assert from 'assert'; - -import {Monster} from "../../../source/monster.js"; +import { + Monster, + validatePrimitive, + validateBoolean, + validateString, + validateObject, + validateArray, + validateFunction, + validateIterable +} from "../../../source/types/validate.js" + +import {expect} from "chai" describe('validate', function () { @@ -27,14 +36,51 @@ describe('validate', function () { if (b === false) { it('.validatePrimitive(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validatePrimitive(a) - }); + expect( ()=> validatePrimitive(a)).to.throw(TypeError); }); } else { it('.validatePrimitive(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validatePrimitive(a) || true); + expect(validatePrimitive(a)).to.be.undefined; + }); + } + + }); + + + }); + + describe('.validateIterable()', function () { + + [ + ['test1', true], + [undefined, false], + [null, false], + [() => { + }, false], + [2, false], + [false, false], + [true, false], + [4.5, false], + [{}, false], + [[1, 2, 3], true], + [Symbol("foo"), false], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + + if (b === false) { + + it('.validateIterable(' + typeof a + ') should throw TypeException ' + b, function () { + expect(() => { + validateIterable(a) + }).to.throw(TypeError);; + }); + + } else { + it('.validateIterable(' + typeof a + ') should not throw TypeException ' + b, function () { + expect(validateIterable(a)).to.be.undefined; }); } @@ -66,14 +112,14 @@ describe('validate', function () { if (b === false) { it('.validateBoolean(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validateBoolean(a) - }); + expect(() => { + validateBoolean(a) + }).to.throw(TypeError); }); } else { it('.validateBoolean(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validateBoolean(a) || true); + expect(validateBoolean(a)).to.be.undefined; }); } @@ -106,14 +152,14 @@ describe('validate', function () { if (b === false) { it('.validateString(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validateString(a) - }); + expect(() => { + validateString(a) + }).to.throw(TypeError);; }); } else { it('.validateString(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validateString(a) || true); + expect(validateString(a)).to.be.undefined; }); } @@ -145,14 +191,14 @@ describe('validate', function () { if (b === false) { it('.validateObject(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validateObject(a) - }); + expect(() => { + validateObject(a) + }).to.throw(TypeError);; }); } else { it('.validateObject(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validateObject(a) || true); + expect(validateObject(a)).to.be.undefined; }); } @@ -185,14 +231,14 @@ describe('validate', function () { if (b === false) { it('.validateArray(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validateArray(a) - }); + expect(() => { + validateArray(a) + }).to.throw(TypeError);; }); } else { it('.validateArray(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validateArray(a) || true); + expect(validateArray(a)).to.be.undefined; }); } @@ -223,14 +269,14 @@ describe('validate', function () { if (b === false) { it('.validateFunction(' + typeof a + ') should throw TypeException ' + b, function () { - assert.throws(() => { - Monster.Types.validateFunction(a) - }); + expect(() => { + validateFunction(a) + }).to.throw(TypeError);; }); } else { it('.validateFunction(' + typeof a + ') should not throw TypeException ' + b, function () { - assert.ok(Monster.Types.validateFunction(a) || true); + expect(validateFunction(a)).to.be.undefined; }); } diff --git a/packages/monster/test/cases/types/version.js b/packages/monster/test/cases/types/version.js index 23434df68fb20de5f7c55b2ce487bbd55b6b47ca..75bc6028d4065c761950e834d8fc02bd5cf3c92a 100644 --- a/packages/monster/test/cases/types/version.js +++ b/packages/monster/test/cases/types/version.js @@ -1,6 +1,8 @@ -import * as assert from 'assert'; - -import {Monster} from "../../../source/monster.js"; +import { + Monster, + Version +} from "../../../source/types/version.js" +import {expect} from "chai" describe('Version', function () { @@ -18,7 +20,7 @@ describe('Version', function () { let c = data.shift() it('should return ' + c + ' when the value ' + a + ' is ' + b + '', function () { - assert.equal(new Monster.Types.Version(a).compareTo(b), c); + expect(new Version(a).compareTo(b)).to.be.equal(c); }); }); @@ -37,7 +39,7 @@ describe('Version', function () { let d = data.shift() it('should return ' + d, function () { - assert.equal(new Monster.Types.Version(a, b, c).toString(), d); + expect(new Version(a, b, c).toString()).to.be.equal(d); }); }); }) diff --git a/packages/monster/test/cases/util/clone.js b/packages/monster/test/cases/util/clone.js index 541ccde54a96a7585d695f1367a7f9f9595ea146..62b3e3279ace2ac62e4f387633cf7fd41acdd274 100644 --- a/packages/monster/test/cases/util/clone.js +++ b/packages/monster/test/cases/util/clone.js @@ -1,9 +1,6 @@ -import * as assert from 'assert'; - import {clone} from "../../../source/util/clone.js"; import {expect} from "chai" - describe('Clone', function () { class A { @@ -34,7 +31,7 @@ describe('Clone', function () { }) // nodejs does not have a DOM - if(typeof DocumentFragment==="object") { + if (typeof DocumentFragment === "object") { describe('.clone(DocumentFragment)', function () { it('.clone(DocumentFragment) should same DocumentFragment', function () { let a = document.createDocumentFragment(); @@ -59,10 +56,10 @@ describe('Clone', function () { it('.clone(undefined) should undefined', function () { let a = undefined let b = clone(a); - assert.ok(a === b) - assert.ok(typeof b === 'undefined') - assert.ok(a === undefined) - assert.ok(b === undefined) + expect(a === b).to.be.true + expect(typeof b === 'undefined').to.be.true + expect(a === undefined).to.be.true + expect(b === undefined).to.be.true }); }) @@ -71,13 +68,13 @@ describe('Clone', function () { it('.clone({}) should object', function () { let a = {} let b = clone(a); - assert.ok(typeof b === 'object') + expect(typeof b === 'object').to.be.true }); it('.clone({x:1}) should object', function () { let a = {x: 1} let b = clone(a); - assert.equal(a.x, b.x) + expect(a.x).is.equal(b.x) }); }) describe('.clone(function)', function () { @@ -86,7 +83,7 @@ describe('Clone', function () { let a = () => { } let b = clone(a); - assert.ok(typeof b === 'function') + expect(typeof b === 'function').to.be.true }); }) @@ -114,7 +111,7 @@ describe('Clone', function () { it('.clone(' + JSON.stringify(a) + ') should ' + b + ' ', function () { let c = clone(a); - assert.equal(typeof c, b) + expect(typeof c).is.equal(b); }); diff --git a/packages/monster/test/cases/util/comparator.js b/packages/monster/test/cases/util/comparator.js new file mode 100644 index 0000000000000000000000000000000000000000..9c4165417c0046b2e1dd7c6d05f95e0dc7236ccf --- /dev/null +++ b/packages/monster/test/cases/util/comparator.js @@ -0,0 +1,215 @@ +import {expect} from "chai" +import {Comparator} from "../../../source/util/comparator.js"; + + +describe('Comparator', function () { + + describe('create new instance', function () { + + it('should return a comparator object', function () { + expect(new Comparator()).to.be.a('object'); + }); + + it('should return a comparator object', function () { + expect(new Comparator(function () { + })).to.be.a('object'); + }); + + it('should throw TypeError', function () { + expect(() => new Comparator(true)).to.throw(TypeError); + }); + + it('should throw TypeError', function () { + expect(() => new Comparator("test")).to.throw(TypeError); + }); + + + }); + + describe('equal()', function () { + + [ + ['test1', "test", false], + [5.1, 5, false], + [5.1, 5.1, true], + [true, true, true], + [false, true, false], + [false, false, true], + [-4, -4, true], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().equal(a, b)).is.equal(c) + }); + }); + + }); + + describe('equal()', function () { + + [ + ['test1', true], + ['test1', 5], + ['test1', null], + ['test1', parseInt("a")], + [false, 5], + [undefined, null], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + + it('should compare ' + a + ' and ' + b + ' throw TypeError', function () { + expect(() => new Comparator().equal(a, b)).to.throw(TypeError); + }); + }); + + }); + + describe('greaterThan()', function () { + + [ + ['test1', "test", true], + [5.1, 5, true], + [5.1, 5.1, false], + [true, true, false], + [false, true, false], + [false, false, false], + [-4, -4, false], + [-4, 4, false], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().greaterThan(a, b)).is.equal(c) + }); + }); + + }); + + describe('reverse().greaterThan()', function () { + + [ + ['test1', "test", true], + [5.1, 5, true], + [5.1, 5.1, false], + [true, true, false], + [false, true, false], + [false, false, false], + [-4, -4, false], + [-4, 4, false], + ].forEach(function (data) { + + let b = data.shift() + let a = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().reverse().greaterThan(a, b)).is.equal(c) + }); + }); + + }); + + describe('greaterThanOrEqual()', function () { + + [ + ['test1', "test", true], + [5.1, 5, true], + [5.1, 5.1, true], + [true, true, true], + [false, true, false], + [false, false, true], + [-4, -4, true], + [-4, 4, false], + ].forEach(function (data) { + + let a = data.shift() + let b = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().greaterThanOrEqual(a, b)).is.equal(c) + }); + }); + + }); + + describe('lessThan()', function () { + + [ + ['test1', "test", true], + [5.1, 5, true], + [5.1, 5.1, false], + [true, true, false], + [false, true, false], + [false, false, false], + [-4, -4, false], + [-4, 4, false], + ].forEach(function (data) { + + let b = data.shift() + let a = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().lessThan(a, b)).is.equal(c) + }); + }); + + }); + + describe('documentations', function () { + + + it('should run ...', function () { + expect(new Comparator().lessThanOrEqual(2, 5)).to.be.true; + expect(new Comparator().greaterThan(4, 2)).to.be.true; + expect(new Comparator().equal(4, 4)).to.be.true; + expect(new Comparator().equal(4, 5)).to.be.false; + }); + + + it('should run with own function ...', function () { + expect(new Comparator(function (a, b) { + if (a.v === b.v) return 0; + return a.v < b.v ? -1 : 1; + }).equal({v: 2}, {v: 2})).to.be.true; + }); + + + }) + + describe('lessThanOrEqual()', function () { + + [ + ['test1', "test", true], + [5.1, 5, true], + [5.1, 5.1, true], + [true, true, true], + [false, true, false], + [false, false, true], + [-4, -4, true], + [-4, 4, false], + ].forEach(function (data) { + + let b = data.shift() + let a = data.shift() + let c = data.shift() + + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + expect(new Comparator().lessThanOrEqual(a, b)).is.equal(c) + }); + }); + + }); + + +}); \ No newline at end of file diff --git a/packages/monster/test/web/import.js b/packages/monster/test/web/import.js index 5fdce0be6eaad0c74fdf66e801311a57fe7be568..754dc83f7a7e10a2ea17b970da364221a5ee0f0f 100644 --- a/packages/monster/test/web/import.js +++ b/packages/monster/test/web/import.js @@ -2,9 +2,18 @@ import "../cases/types/observer.js"; import "../cases/types/observerlist.js"; import "../cases/types/is.js"; +import "../cases/types/proxyobserver.js"; +import "../cases/types/tokenlist.js"; import "../cases/types/version.js"; import "../cases/types/id.js"; import "../cases/types/validate.js"; +import "../cases/constraint/isobject.js"; +import "../cases/constraint/valid.js"; +import "../cases/constraint/invalid.js"; +import "../cases/constraint/oroperator.js"; +import "../cases/constraint/andoperator.js"; +import "../cases/constraint/isarray.js"; +import "../cases/util/comparator.js"; import "../cases/util/clone.js"; import "../cases/math/random.js"; import "../cases/monster.js"; diff --git a/packages/monster/test/web/tests.js b/packages/monster/test/web/tests.js index 0799046ecc7f114615f8af91e095180adba67b7f..52702b2324b8203057ebcf7185b6fec2f13b4fe0 100644 --- a/packages/monster/test/web/tests.js +++ b/packages/monster/test/web/tests.js @@ -26,7 +26,7 @@ class AsnConvert { } exports.AsnConvert = AsnConvert; -},{"./parser":10,"./serializer":12,"asn1js":34,"pvtsutils":220}],2:[function(require,module,exports){ +},{"./parser":10,"./serializer":12,"asn1js":34,"pvtsutils":214}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultConverter = exports.AsnNullConverter = exports.AsnGeneralizedTimeConverter = exports.AsnUTCTimeConverter = exports.AsnCharacterStringConverter = exports.AsnGeneralStringConverter = exports.AsnVisibleStringConverter = exports.AsnGraphicStringConverter = exports.AsnIA5StringConverter = exports.AsnVideotexStringConverter = exports.AsnTeletexStringConverter = exports.AsnPrintableStringConverter = exports.AsnNumericStringConverter = exports.AsnUniversalStringConverter = exports.AsnBmpStringConverter = exports.AsnUtf8StringConverter = exports.AsnOctetStringConverter = exports.AsnBooleanConverter = exports.AsnObjectIdentifierConverter = exports.AsnBitStringConverter = exports.AsnIntegerArrayBufferConverter = exports.AsnEnumeratedConverter = exports.AsnIntegerConverter = exports.AsnAnyConverter = void 0; @@ -245,7 +245,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); tslib_1.__exportStar(require("./schema_validation"), exports); -},{"./schema_validation":6,"tslib":251}],6:[function(require,module,exports){ +},{"./schema_validation":6,"tslib":245}],6:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AsnSchemaValidationError = void 0; @@ -326,7 +326,7 @@ tslib_1.__exportStar(require("./errors"), exports); tslib_1.__exportStar(require("./objects"), exports); tslib_1.__exportStar(require("./convert"), exports); -},{"./convert":1,"./converters":2,"./decorators":3,"./enums":4,"./errors":5,"./objects":9,"./parser":10,"./serializer":12,"./types/index":15,"tslib":251}],9:[function(require,module,exports){ +},{"./convert":1,"./converters":2,"./decorators":3,"./enums":4,"./errors":5,"./objects":9,"./parser":10,"./serializer":12,"./types/index":15,"tslib":245}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AsnArray = void 0; @@ -486,7 +486,7 @@ class AsnParser { exports.AsnParser = AsnParser; }).call(this)}).call(this,require("buffer").Buffer) -},{"./converters":2,"./enums":4,"./errors":5,"./helper":7,"./storage":13,"asn1js":34,"buffer":88}],11:[function(require,module,exports){ +},{"./converters":2,"./enums":4,"./errors":5,"./helper":7,"./storage":13,"asn1js":34,"buffer":83}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AsnSchemaStorage = void 0; @@ -865,14 +865,14 @@ class BitString { } exports.BitString = BitString; -},{"asn1js":34,"pvtsutils":220}],15:[function(require,module,exports){ +},{"asn1js":34,"pvtsutils":214}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); tslib_1.__exportStar(require("./bit_string"), exports); tslib_1.__exportStar(require("./octet_string"), exports); -},{"./bit_string":14,"./octet_string":16,"tslib":251}],16:[function(require,module,exports){ +},{"./bit_string":14,"./octet_string":16,"tslib":245}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OctetString = void 0; @@ -917,7 +917,7 @@ class OctetString { } exports.OctetString = OctetString; -},{"asn1js":34,"pvtsutils":220}],17:[function(require,module,exports){ +},{"asn1js":34,"pvtsutils":214}],17:[function(require,module,exports){ /** * Copyright (c) 2020, Peculiar Ventures, All rights reserved. */ @@ -3609,7 +3609,7 @@ Object.defineProperty(exports, 'CryptoKey', { exports.Crypto = Crypto; }).call(this)}).call(this,require("buffer").Buffer) -},{"@peculiar/asn1-schema":8,"@peculiar/json-schema":17,"buffer":88,"crypto":130,"process":277,"pvtsutils":220,"tslib":251,"webcrypto-core":254}],19:[function(require,module,exports){ +},{"@peculiar/asn1-schema":8,"@peculiar/json-schema":17,"buffer":83,"crypto":125,"process":289,"pvtsutils":214,"tslib":245,"webcrypto-core":248}],19:[function(require,module,exports){ 'use strict'; const asn1 = exports; @@ -3681,7 +3681,7 @@ Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { return this._getEncoder(enc).encode(data, reporter); }; -},{"./decoders":28,"./encoders":31,"inherits":193}],21:[function(require,module,exports){ +},{"./decoders":28,"./encoders":31,"inherits":188}],21:[function(require,module,exports){ 'use strict'; const inherits = require('inherits'); @@ -3836,7 +3836,7 @@ EncoderBuffer.prototype.join = function join(out, offset) { return out; }; -},{"../base/reporter":24,"inherits":193,"safer-buffer":226}],22:[function(require,module,exports){ +},{"../base/reporter":24,"inherits":188,"safer-buffer":220}],22:[function(require,module,exports){ 'use strict'; const base = exports; @@ -4486,7 +4486,7 @@ Node.prototype._isPrintstr = function isPrintstr(str) { return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str); }; -},{"../base/buffer":21,"../base/reporter":24,"minimalistic-assert":197}],24:[function(require,module,exports){ +},{"../base/buffer":21,"../base/reporter":24,"minimalistic-assert":192}],24:[function(require,module,exports){ 'use strict'; const inherits = require('inherits'); @@ -4611,7 +4611,7 @@ ReporterError.prototype.rethrow = function rethrow(msg) { return this; }; -},{"inherits":193}],25:[function(require,module,exports){ +},{"inherits":188}],25:[function(require,module,exports){ 'use strict'; // Helper @@ -5031,7 +5031,7 @@ function derDecodeLen(buf, primitive, fail) { return len; } -},{"../base/buffer":21,"../base/node":23,"../constants/der":25,"bn.js":33,"inherits":193}],28:[function(require,module,exports){ +},{"../base/buffer":21,"../base/node":23,"../constants/der":25,"bn.js":33,"inherits":188}],28:[function(require,module,exports){ 'use strict'; const decoders = exports; @@ -5092,7 +5092,7 @@ PEMDecoder.prototype.decode = function decode(data, options) { return DERDecoder.prototype.decode.call(this, input, options); }; -},{"./der":27,"inherits":193,"safer-buffer":226}],30:[function(require,module,exports){ +},{"./der":27,"inherits":188,"safer-buffer":220}],30:[function(require,module,exports){ 'use strict'; const inherits = require('inherits'); @@ -5389,7 +5389,7 @@ function encodeTag(tag, primitive, cls, reporter) { return res; } -},{"../base/node":23,"../constants/der":25,"inherits":193,"safer-buffer":226}],31:[function(require,module,exports){ +},{"../base/node":23,"../constants/der":25,"inherits":188,"safer-buffer":220}],31:[function(require,module,exports){ 'use strict'; const encoders = exports; @@ -5422,7 +5422,7 @@ PEMEncoder.prototype.encode = function encode(data, options) { return out.join('\n'); }; -},{"./der":30,"inherits":193}],33:[function(require,module,exports){ +},{"./der":30,"inherits":188}],33:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -8870,7 +8870,7 @@ PEMEncoder.prototype.encode = function encode(data, options) { }; })(typeof module === 'undefined' || module, this); -},{"buffer":43}],34:[function(require,module,exports){ +},{"buffer":39}],34:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -14784,2607 +14784,1475 @@ function fromJSON(json) {// TODO Implement //endregion //************************************************************************************** -},{"pvutils":221}],35:[function(require,module,exports){ -(function (global){(function (){ -'use strict'; - -var objectAssign = require('object-assign'); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: +},{"pvutils":215}],35:[function(require,module,exports){ +/*! + * assertion-error + * Copyright(c) 2013 Jake Luer <jake@qualiancy.com> + * MIT Licensed + */ /*! - * The buffer module from node.js, for the browser. + * Return a function that will copy properties from + * one object to another excluding any originally + * listed. Returned function will create a new `{}`. * - * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> - * @license MIT + * @param {String} excluded properties ... + * @return {Function} */ -function compare(a, b) { - if (a === b) { - return 0; - } - var x = a.length; - var y = b.length; +function exclude () { + var excludes = [].slice.call(arguments); - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } + function excludeProps (res, obj) { + Object.keys(obj).forEach(function (key) { + if (!~excludes.indexOf(key)) res[key] = obj[key]; + }); } - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} + return function extendExclude () { + var args = [].slice.call(arguments) + , i = 0 + , res = {}; -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. + for (; i < args.length; i++) { + excludeProps(res, args[i]); + } -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -var util = require('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. + return res; + }; +}; + +/*! + * Primary Exports + */ -var assert = module.exports = ok; +module.exports = AssertionError; -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) +/** + * ### AssertionError + * + * An extension of the JavaScript `Error` constructor for + * assertion and validation scenarios. + * + * @param {String} message + * @param {Object} properties to include (optional) + * @param {callee} start stack function (optional) + */ -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; +function AssertionError (message, _props, ssf) { + var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') + , props = extend(_props || {}); - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } + // default values + this.message = message || 'Unspecified AssertionError'; + this.showDiff = false; - this.stack = out; - } + // copy from properties + for (var key in props) { + this[key] = props[key]; } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); + // capture stack trace + ssf = ssf || AssertionError; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, ssf); } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); + try { + throw new Error(); + } catch(e) { + this.stack = e.stack; + } } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); } -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; +/*! + * Inherit from Error.prototype + */ -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. +AssertionError.prototype = Object.create(Error.prototype); -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; +/*! + * Statically set name + */ -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); +AssertionError.prototype.name = 'AssertionError'; -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; +/*! + * Ensure correct constructor + */ -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); +AssertionError.prototype.constructor = AssertionError; -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; +/** + * Allow errors to be converted to JSON for static transfer. + * + * @param {Boolean} include stack (default: `true`) + * @return {Object} object that can be `JSON.stringify` + */ -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); +AssertionError.prototype.toJSON = function (stack) { + var extend = exclude('constructor', 'toJSON', 'stack') + , props = extend({ name: this.name }, this); -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); + // include stack if exists and not turned off + if (false !== stack && this.stack) { + props.stack = this.stack; } -}; -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } + return props; }; -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; +},{}],36:[function(require,module,exports){ +'use strict' - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray - memos.actual.push(actual); - memos.expected.push(expected); +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - return objEquiv(actual, expected, strict, memos); - } +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i } -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') } - return true; -} -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } + return [validLen, placeHoldersLen] } +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; + var curByte = 0 -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF } - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF } - if (Error.isPrototypeOf(expected)) { - return false; + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF } - return expected.call({}, actual) === true; + return arr } -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] } -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) } + return output.join('') +} - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) } - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) } - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } + return parts.join('') } -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; +},{}],37:[function(require,module,exports){ +(function (module, exports) { + 'use strict'; -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); } - return keys; -}; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":199,"util/":38}],36:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; } -} -},{}],37:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],38:[function(require,module,exports){ -(function (process,global){(function (){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. + // BN -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; } - } - return str; -}; + this.negative = 0; + this.words = null; + this.length = 0; -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } + // Reduction context + this.red = null; - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; + this._init(number || 0, base || 10, endian || 'be'); } } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; + if (typeof module === 'object') { + module.exports = BN; } else { - return str; + exports.BN = BN; } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} + BN.BN = BN; + BN.wordSize = 26; -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = require('buffer').Buffer; } - return ret; + } catch (e) { } - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); + + if (typeof number === 'object') { + return this._initArray(number, base, endian); } - if (isError(value)) { - return formatError(value); + + if (base === 'hex') { + base = 16; } - } + assert(base === (base | 0) && base >= 2 && base <= 36); - var base = '', array = false, braces = ['{', '}']; + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; } else { - return ctx.stylize('[Object]', 'special'); + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} + if (endian !== 'le') return; + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; } - }); - return output; -} - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; } } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); + assert(false, 'Invalid character in ' + string); } } - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; } - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; + // 24-bits chunks + var off = 0; + var j = 0; -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; + this._strip(); + }; -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; + r *= mul; -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); -exports.isBuffer = require('./support/isBuffer'); + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } -function objectToString(o) { - return Object.prototype.toString.call(o); -} + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + for (i = 0; i < mod; i++) { + pow *= base; + } -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + this._strip(); + }; -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + BN.prototype._move = function _move (dest) { + move(dest, this); + }; -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":37,"_process":212,"inherits":36}],39:[function(require,module,exports){ -/*! - * assertion-error - * Copyright(c) 2013 Jake Luer <jake@qualiancy.com> - * MIT Licensed - */ + function inspect () { + return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>'; + } -/*! - * Return a function that will copy properties from - * one object to another excluding any originally - * listed. Returned function will create a new `{}`. - * - * @param {String} excluded properties ... - * @return {Function} - */ + /* -function exclude () { - var excludes = [].slice.call(arguments); + var zeros = []; + var groupSizes = []; + var groupBases = []; - function excludeProps (res, obj) { - Object.keys(obj).forEach(function (key) { - if (!~excludes.indexOf(key)) res[key] = obj[key]; - }); + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; } - - return function extendExclude () { - var args = [].slice.call(arguments) - , i = 0 - , res = {}; - - for (; i < args.length; i++) { - excludeProps(res, args[i]); + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } - return res; - }; -}; + */ -/*! - * Primary Exports - */ + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; -module.exports = AssertionError; + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; -/** - * ### AssertionError - * - * An extension of the JavaScript `Error` constructor for - * assertion and validation scenarios. - * - * @param {String} message - * @param {Object} properties to include (optional) - * @param {callee} start stack function (optional) - */ + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; -function AssertionError (message, _props, ssf) { - var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') - , props = extend(_props || {}); + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; - // default values - this.message = message || 'Unspecified AssertionError'; - this.showDiff = false; - - // copy from properties - for (var key in props) { - this[key] = props[key]; - } - - // capture stack trace - ssf = ssf || AssertionError; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ssf); - } else { - try { - throw new Error(); - } catch(e) { - this.stack = e.stack; + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; } - } -} - -/*! - * Inherit from Error.prototype - */ - -AssertionError.prototype = Object.create(Error.prototype); - -/*! - * Statically set name - */ -AssertionError.prototype.name = 'AssertionError'; + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); -/*! - * Ensure correct constructor - */ + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } -AssertionError.prototype.constructor = AssertionError; + assert(false, 'Base should be between 2 and 36'); + }; -/** - * Allow errors to be converted to JSON for static transfer. - * - * @param {Boolean} include stack (default: `true`) - * @return {Object} object that can be `JSON.stringify` - */ + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; -AssertionError.prototype.toJSON = function (stack) { - var extend = exclude('constructor', 'toJSON', 'stack') - , props = extend({ name: this.name }, this); + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; - // include stack if exists and not turned off - if (false !== stack && this.stack) { - props.stack = this.stack; + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; } - return props; -}; - -},{}],40:[function(require,module,exports){ -'use strict' + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; -function getLens (b64) { - var len = b64.length + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } - return [validLen, placeHoldersLen] -} + if (position < res.length) { + res[position++] = carry; -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + while (position < res.length) { + res[position++] = 0; + } + } + }; -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } - var curByte = 0 + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen + if (position >= 0) { + res[position--] = carry; - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } + while (position >= 0) { + res[position--] = 0; + } + } + }; - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; } - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; - return arr -} + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} + function toBitArray (num) { + var w = new Array(num.bitLength()); -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } + w[bit] = (num.words[off] >>> wbit) & 0x01; + } - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) + return w; } - return parts.join('') -} - -},{}],41:[function(require,module,exports){ -(function (module, exports) { - 'use strict'; - - // Utils - function assert (val, msg) { - if (!val) throw new Error(msg || 'Assertion failed'); - } + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; - // Could use `inherits` module, but don't want to move from single file - // architecture yet. - function inherits (ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function () {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; - // BN + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; - function BN (number, base, endian) { - if (BN.isBN(number)) { - return number; + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); } + return this.clone(); + }; - this.negative = 0; - this.words = null; - this.length = 0; + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; - // Reduction context - this.red = null; + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; - if (number !== null) { - if (base === 'le' || base === 'be') { - endian = base; - base = 10; - } + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; - this._init(number || 0, base || 10, endian || 'be'); + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; } - } - if (typeof module === 'object') { - module.exports = BN; - } else { - exports.BN = BN; - } - BN.BN = BN; - BN.wordSize = 26; + return this; + }; - var Buffer; - try { - if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { - Buffer = window.Buffer; - } else { - Buffer = require('buffer').Buffer; + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; } - } catch (e) { - } - BN.isBN = function isBN (num) { - if (num instanceof BN) { - return true; + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; } - return num !== null && typeof num === 'object' && - num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + return this._strip(); }; - BN.max = function max (left, right) { - if (left.cmp(right) > 0) return left; - return right; + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); }; - BN.min = function min (left, right) { - if (left.cmp(right) < 0) return left; - return right; + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); }; - BN.prototype._init = function init (number, base, endian) { - if (typeof number === 'number') { - return this._initNumber(number, base, endian); - } + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; - if (typeof number === 'object') { - return this._initArray(number, base, endian); + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; } - if (base === 'hex') { - base = 16; + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; } - assert(base === (base | 0) && base >= 2 && base <= 36); - number = number.toString().replace(/\s+/g, ''); - var start = 0; - if (number[0] === '-') { - start++; - this.negative = 1; - } + this.length = b.length; - if (start < number.length) { - if (base === 16) { - this._parseHex(number, start, endian); - } else { - this._parseBase(number, base, start); - if (endian === 'le') { - this._initArray(this.toArray(), base, endian); - } - } - } + return this._strip(); }; - BN.prototype._initNumber = function _initNumber (number, base, endian) { - if (number < 0) { - this.negative = 1; - number = -number; - } - if (number < 0x4000000) { - this.words = [number & 0x3ffffff]; - this.length = 1; - } else if (number < 0x10000000000000) { - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff - ]; - this.length = 2; - } else { - assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) - this.words = [ - number & 0x3ffffff, - (number / 0x4000000) & 0x3ffffff, - 1 - ]; - this.length = 3; - } + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; - if (endian !== 'le') return; + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; - // Reverse the bytes - this._initArray(this.toArray(), base, endian); + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); }; - BN.prototype._initArray = function _initArray (number, base, endian) { - // Perhaps a Uint8Array - assert(typeof number.length === 'number'); - if (number.length <= 0) { - this.words = [0]; - this.length = 1; - return this; + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; } - this.length = Math.ceil(number.length / 3); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; } - var j, w; - var off = 0; - if (endian === 'be') { - for (i = number.length - 1, j = 0; i >= 0; i -= 3) { - w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } else if (endian === 'le') { - for (i = 0, j = 0; i < number.length; i += 3) { - w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); - this.words[j] |= (w << off) & 0x3ffffff; - this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; } } + + this.length = a.length; + return this._strip(); }; - function parseHex4Bits (string, index) { - var c = string.charCodeAt(index); - // '0' - '9' - if (c >= 48 && c <= 57) { - return c - 48; - // 'A' - 'F' - } else if (c >= 65 && c <= 70) { - return c - 55; - // 'a' - 'f' - } else if (c >= 97 && c <= 102) { - return c - 87; - } else { - assert(false, 'Invalid character in ' + string); - } - } + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; - function parseHexByte (string, lowerBound, index) { - var r = parseHex4Bits(string, index); - if (index - 1 >= lowerBound) { - r |= parseHex4Bits(string, index - 1) << 4; - } - return r; - } + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; - BN.prototype._parseHex = function _parseHex (number, start, endian) { - // Create possibly bigger array to ensure that it fits the number - this.length = Math.ceil((number.length - start) / 6); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; } - // 24-bits chunks - var off = 0; - var j = 0; + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } - var w; - if (endian === 'be') { - for (i = number.length - 1; i >= start; i -= 2) { - w = parseHexByte(number, start, i) << off; - this.words[j] |= w & 0x3ffffff; - if (off >= 18) { - off -= 18; - j += 1; - this.words[j] |= w >>> 26; - } else { - off += 8; - } - } - } else { - var parseLength = number.length - start; - for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { - w = parseHexByte(number, start, i) << off; - this.words[j] |= w & 0x3ffffff; - if (off >= 18) { - off -= 18; - j += 1; - this.words[j] |= w >>> 26; - } else { - off += 8; - } - } + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); } - this._strip(); + // And remove leading zeroes + return this._strip(); }; - function parseBase (str, start, end, mul) { - var r = 0; - var b = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; - r *= mul; + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); - // 'a' - if (c >= 49) { - b = c - 49 + 0xa; + var off = (bit / 26) | 0; + var wbit = bit % 26; - // 'A' - } else if (c >= 17) { - b = c - 17 + 0xa; + this._expand(off + 1); - // '0' - '9' - } else { - b = c; - } - assert(c >= 0 && b < mul, 'Invalid character'); - r += b; + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); } - return r; - } - - BN.prototype._parseBase = function _parseBase (number, base, start) { - // Initialize as zero - this.words = [0]; - this.length = 1; - // Find length of limb in base - for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { - limbLen++; - } - limbLen--; - limbPow = (limbPow / base) | 0; + return this._strip(); + }; - var total = number.length - start; - var mod = total % limbLen; - var end = Math.min(total, total - mod) + start; + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; - var word = 0; - for (var i = start; i < end; i += limbLen) { - word = parseBase(number, i, i + limbLen, base); + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); - this.imuln(limbPow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); } - if (mod !== 0) { - var pow = 1; - word = parseBase(number, i, number.length, base); + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } - for (i = 0; i < mod; i++) { - pow *= base; - } + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } - this.imuln(pow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; } } - this._strip(); + return this; }; - BN.prototype.copy = function copy (dest) { - dest.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - dest.words[i] = this.words[i]; + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; } - dest.length = this.length; - dest.negative = this.negative; - dest.red = this.red; - }; - function move (dest, src) { - dest.words = src.words; - dest.length = src.length; - dest.negative = src.negative; - dest.red = src.red; - } + if (this.length > num.length) return this.clone().iadd(num); - BN.prototype._move = function _move (dest) { - move(dest, this); + return num.clone().iadd(this); }; - BN.prototype.clone = function clone () { - var r = new BN(null); - this.copy(r); - return r; - }; + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); - BN.prototype._expand = function _expand (size) { - while (this.length < size) { - this.words[this.length++] = 0; + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); } - return this; - }; - // Remove leading `0` from `this` - BN.prototype._strip = function strip () { - while (this.length > 1 && this.words[this.length - 1] === 0) { - this.length--; - } - return this._normSign(); - }; + // At this point both numbers are positive + var cmp = this.cmp(num); - BN.prototype._normSign = function _normSign () { - // -0 = 0 - if (this.length === 1 && this.words[0] === 0) { + // Optimization - zeroify + if (cmp === 0) { this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; } - return this; - }; - // Check Symbol.for because not everywhere where Symbol defined - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility - if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { - try { - BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; - } catch (e) { - BN.prototype.inspect = inspect; + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; } - } else { - BN.prototype.inspect = inspect; - } - function inspect () { - return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>'; - } + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } - /* + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } - var zeros = []; - var groupSizes = []; - var groupBases = []; + this.length = Math.max(this.length, i); - var s = ''; - var i = -1; - while (++i < BN.wordSize) { - zeros[i] = s; - s += '0'; - } - groupSizes[0] = 0; - groupSizes[1] = 0; - groupBases[0] = 0; - groupBases[1] = 0; - var base = 2 - 1; - while (++base < 36 + 1) { - var groupSize = 0; - var groupBase = 1; - while (groupBase < (1 << BN.wordSize) / base) { - groupBase *= base; - groupSize += 1; + if (a !== this) { + this.negative = 1; } - groupSizes[base] = groupSize; - groupBases[base] = groupBase; - } - */ + return this._strip(); + }; - var zeros = [ - '', - '0', - '00', - '000', - '0000', - '00000', - '000000', - '0000000', - '00000000', - '000000000', - '0000000000', - '00000000000', - '000000000000', - '0000000000000', - '00000000000000', - '000000000000000', - '0000000000000000', - '00000000000000000', - '000000000000000000', - '0000000000000000000', - '00000000000000000000', - '000000000000000000000', - '0000000000000000000000', - '00000000000000000000000', - '000000000000000000000000', - '0000000000000000000000000' - ]; + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; - var groupSizes = [ - 0, 0, - 25, 16, 12, 11, 10, 9, 8, - 8, 7, 7, 7, 7, 6, 6, - 6, 6, 6, 6, 6, 5, 5, - 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5 - ]; - - var groupBases = [ - 0, 0, - 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, - 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, - 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, - 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, - 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 - ]; - - BN.prototype.toString = function toString (base, padding) { - base = base || 10; - padding = padding | 0 || 1; - - var out; - if (base === 16 || base === 'hex') { - out = ''; - var off = 0; - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = this.words[i]; - var word = (((w << off) | carry) & 0xffffff).toString(16); - carry = (w >>> (24 - off)) & 0xffffff; - if (carry !== 0 || i !== this.length - 1) { - out = zeros[6 - word.length] + word + out; - } else { - out = word + out; - } - off += 2; - if (off >= 26) { - off -= 26; - i--; - } - } - if (carry !== 0) { - out = carry.toString(16) + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } - - if (base === (base | 0) && base >= 2 && base <= 36) { - // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); - var groupSize = groupSizes[base]; - // var groupBase = Math.pow(base, groupSize); - var groupBase = groupBases[base]; - out = ''; - var c = this.clone(); - c.negative = 0; - while (!c.isZero()) { - var r = c.modrn(groupBase).toString(base); - c = c.idivn(groupBase); - - if (!c.isZero()) { - out = zeros[groupSize - r.length] + r + out; - } else { - out = r + out; - } - } - if (this.isZero()) { - out = '0' + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } - - assert(false, 'Base should be between 2 and 36'); - }; - - BN.prototype.toNumber = function toNumber () { - var ret = this.words[0]; - if (this.length === 2) { - ret += this.words[1] * 0x4000000; - } else if (this.length === 3 && this.words[2] === 0x01) { - // NOTE: at this stage it is known that the top bit is set - ret += 0x10000000000000 + (this.words[1] * 0x4000000); - } else if (this.length > 2) { - assert(false, 'Number can only safely store up to 53 bits'); - } - return (this.negative !== 0) ? -ret : ret; - }; - - BN.prototype.toJSON = function toJSON () { - return this.toString(16, 2); - }; - - if (Buffer) { - BN.prototype.toBuffer = function toBuffer (endian, length) { - return this.toArrayLike(Buffer, endian, length); - }; - } - - BN.prototype.toArray = function toArray (endian, length) { - return this.toArrayLike(Array, endian, length); - }; - - var allocate = function allocate (ArrayType, size) { - if (ArrayType.allocUnsafe) { - return ArrayType.allocUnsafe(size); - } - return new ArrayType(size); - }; - - BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { - this._strip(); - - var byteLength = this.byteLength(); - var reqLength = length || Math.max(1, byteLength); - assert(byteLength <= reqLength, 'byte array longer than desired length'); - assert(reqLength > 0, 'Requested array length <= 0'); - - var res = allocate(ArrayType, reqLength); - var postfix = endian === 'le' ? 'LE' : 'BE'; - this['_toArrayLike' + postfix](res, byteLength); - return res; - }; - - BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { - var position = 0; - var carry = 0; - - for (var i = 0, shift = 0; i < this.length; i++) { - var word = (this.words[i] << shift) | carry; - - res[position++] = word & 0xff; - if (position < res.length) { - res[position++] = (word >> 8) & 0xff; - } - if (position < res.length) { - res[position++] = (word >> 16) & 0xff; - } - - if (shift === 6) { - if (position < res.length) { - res[position++] = (word >> 24) & 0xff; - } - carry = 0; - shift = 0; - } else { - carry = word >>> 24; - shift += 2; - } - } - - if (position < res.length) { - res[position++] = carry; - - while (position < res.length) { - res[position++] = 0; - } - } - }; - - BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { - var position = res.length - 1; - var carry = 0; - - for (var i = 0, shift = 0; i < this.length; i++) { - var word = (this.words[i] << shift) | carry; - - res[position--] = word & 0xff; - if (position >= 0) { - res[position--] = (word >> 8) & 0xff; - } - if (position >= 0) { - res[position--] = (word >> 16) & 0xff; - } - - if (shift === 6) { - if (position >= 0) { - res[position--] = (word >> 24) & 0xff; - } - carry = 0; - shift = 0; - } else { - carry = word >>> 24; - shift += 2; - } - } + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; - if (position >= 0) { - res[position--] = carry; + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; - while (position >= 0) { - res[position--] = 0; - } - } - }; + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; - if (Math.clz32) { - BN.prototype._countBits = function _countBits (w) { - return 32 - Math.clz32(w); - }; - } else { - BN.prototype._countBits = function _countBits (w) { - var t = w; - var r = 0; - if (t >= 0x1000) { - r += 13; - t >>>= 13; - } - if (t >= 0x40) { - r += 7; - t >>>= 7; - } - if (t >= 0x8) { - r += 4; - t >>>= 4; - } - if (t >= 0x02) { - r += 2; - t >>>= 2; + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; } - return r + t; - }; - } - - BN.prototype._zeroBits = function _zeroBits (w) { - // Short-cut - if (w === 0) return 26; - - var t = w; - var r = 0; - if ((t & 0x1fff) === 0) { - r += 13; - t >>>= 13; - } - if ((t & 0x7f) === 0) { - r += 7; - t >>>= 7; - } - if ((t & 0xf) === 0) { - r += 4; - t >>>= 4; - } - if ((t & 0x3) === 0) { - r += 2; - t >>>= 2; - } - if ((t & 0x1) === 0) { - r++; - } - return r; - }; - - // Return number of used bits in a BN - BN.prototype.bitLength = function bitLength () { - var w = this.words[this.length - 1]; - var hi = this._countBits(w); - return (this.length - 1) * 26 + hi; - }; - - function toBitArray (num) { - var w = new Array(num.bitLength()); - - for (var bit = 0; bit < w.length; bit++) { - var off = (bit / 26) | 0; - var wbit = bit % 26; - - w[bit] = (num.words[off] >>> wbit) & 0x01; - } - - return w; - } - - // Number of trailing zero bits - BN.prototype.zeroBits = function zeroBits () { - if (this.isZero()) return 0; - - var r = 0; - for (var i = 0; i < this.length; i++) { - var b = this._zeroBits(this.words[i]); - r += b; - if (b !== 26) break; - } - return r; - }; - - BN.prototype.byteLength = function byteLength () { - return Math.ceil(this.bitLength() / 8); - }; - - BN.prototype.toTwos = function toTwos (width) { - if (this.negative !== 0) { - return this.abs().inotn(width).iaddn(1); - } - return this.clone(); - }; - - BN.prototype.fromTwos = function fromTwos (width) { - if (this.testn(width - 1)) { - return this.notn(width).iaddn(1).ineg(); - } - return this.clone(); - }; - - BN.prototype.isNeg = function isNeg () { - return this.negative !== 0; - }; - - // Return negative clone of `this` - BN.prototype.neg = function neg () { - return this.clone().ineg(); - }; - - BN.prototype.ineg = function ineg () { - if (!this.isZero()) { - this.negative ^= 1; - } - - return this; - }; - - // Or `num` with `this` in-place - BN.prototype.iuor = function iuor (num) { - while (this.length < num.length) { - this.words[this.length++] = 0; - } - - for (var i = 0; i < num.length; i++) { - this.words[i] = this.words[i] | num.words[i]; - } - - return this._strip(); - }; - - BN.prototype.ior = function ior (num) { - assert((this.negative | num.negative) === 0); - return this.iuor(num); - }; - - // Or `num` with `this` - BN.prototype.or = function or (num) { - if (this.length > num.length) return this.clone().ior(num); - return num.clone().ior(this); - }; - - BN.prototype.uor = function uor (num) { - if (this.length > num.length) return this.clone().iuor(num); - return num.clone().iuor(this); - }; - - // And `num` with `this` in-place - BN.prototype.iuand = function iuand (num) { - // b = min-length(num, this) - var b; - if (this.length > num.length) { - b = num; - } else { - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = this.words[i] & num.words[i]; + out.words[k] = rword | 0; + carry = ncarry | 0; } - - this.length = b.length; - - return this._strip(); - }; - - BN.prototype.iand = function iand (num) { - assert((this.negative | num.negative) === 0); - return this.iuand(num); - }; - - // And `num` with `this` - BN.prototype.and = function and (num) { - if (this.length > num.length) return this.clone().iand(num); - return num.clone().iand(this); - }; - - BN.prototype.uand = function uand (num) { - if (this.length > num.length) return this.clone().iuand(num); - return num.clone().iuand(this); - }; - - // Xor `num` with `this` in-place - BN.prototype.iuxor = function iuxor (num) { - // a.length > b.length - var a; - var b; - if (this.length > num.length) { - a = this; - b = num; + if (carry !== 0) { + out.words[k] = carry | 0; } else { - a = num; - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = a.words[i] ^ b.words[i]; + out.length--; } - if (this !== a) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } + return out._strip(); + } - this.length = a.length; - - return this._strip(); - }; - - BN.prototype.ixor = function ixor (num) { - assert((this.negative | num.negative) === 0); - return this.iuxor(num); - }; - - // Xor `num` with `this` - BN.prototype.xor = function xor (num) { - if (this.length > num.length) return this.clone().ixor(num); - return num.clone().ixor(this); - }; - - BN.prototype.uxor = function uxor (num) { - if (this.length > num.length) return this.clone().iuxor(num); - return num.clone().iuxor(this); - }; - - // Not ``this`` with ``width`` bitwidth - BN.prototype.inotn = function inotn (width) { - assert(typeof width === 'number' && width >= 0); - - var bytesNeeded = Math.ceil(width / 26) | 0; - var bitsLeft = width % 26; - - // Extend the buffer with leading zeroes - this._expand(bytesNeeded); - - if (bitsLeft > 0) { - bytesNeeded--; - } - - // Handle complete words - for (var i = 0; i < bytesNeeded; i++) { - this.words[i] = ~this.words[i] & 0x3ffffff; - } - - // Handle the residue - if (bitsLeft > 0) { - this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); - } - - // And remove leading zeroes - return this._strip(); - }; - - BN.prototype.notn = function notn (width) { - return this.clone().inotn(width); - }; - - // Set `bit` of `this` - BN.prototype.setn = function setn (bit, val) { - assert(typeof bit === 'number' && bit >= 0); - - var off = (bit / 26) | 0; - var wbit = bit % 26; - - this._expand(off + 1); - - if (val) { - this.words[off] = this.words[off] | (1 << wbit); - } else { - this.words[off] = this.words[off] & ~(1 << wbit); - } - - return this._strip(); - }; - - // Add `num` to `this` in-place - BN.prototype.iadd = function iadd (num) { - var r; - - // negative + positive - if (this.negative !== 0 && num.negative === 0) { - this.negative = 0; - r = this.isub(num); - this.negative ^= 1; - return this._normSign(); - - // positive + negative - } else if (this.negative === 0 && num.negative !== 0) { - num.negative = 0; - r = this.isub(num); - num.negative = 1; - return r._normSign(); - } - - // a.length > b.length - var a, b; - if (this.length > num.length) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) + (b.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - - this.length = a.length; - if (carry !== 0) { - this.words[this.length] = carry; - this.length++; - // Copy the rest of the words - } else if (a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } - - return this; - }; - - // Add `num` to `this` - BN.prototype.add = function add (num) { - var res; - if (num.negative !== 0 && this.negative === 0) { - num.negative = 0; - res = this.sub(num); - num.negative ^= 1; - return res; - } else if (num.negative === 0 && this.negative !== 0) { - this.negative = 0; - res = num.sub(this); - this.negative = 1; - return res; - } - - if (this.length > num.length) return this.clone().iadd(num); - - return num.clone().iadd(this); - }; - - // Subtract `num` from `this` in-place - BN.prototype.isub = function isub (num) { - // this - (-num) = this + num - if (num.negative !== 0) { - num.negative = 0; - var r = this.iadd(num); - num.negative = 1; - return r._normSign(); - - // -this - num = -(this + num) - } else if (this.negative !== 0) { - this.negative = 0; - this.iadd(num); - this.negative = 1; - return this._normSign(); - } - - // At this point both numbers are positive - var cmp = this.cmp(num); - - // Optimization - zeroify - if (cmp === 0) { - this.negative = 0; - this.length = 1; - this.words[0] = 0; - return this; - } - - // a > b - var a, b; - if (cmp > 0) { - a = this; - b = num; - } else { - a = num; - b = this; - } - - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) - (b.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; - } - - // Copy rest of the words - if (carry === 0 && i < a.length && a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } - } - - this.length = Math.max(this.length, i); - - if (a !== this) { - this.negative = 1; - } - - return this._strip(); - }; - - // Subtract `num` from `this` - BN.prototype.sub = function sub (num) { - return this.clone().isub(num); - }; - - function smallMulTo (self, num, out) { - out.negative = num.negative ^ self.negative; - var len = (self.length + num.length) | 0; - out.length = len; - len = (len - 1) | 0; - - // Peel one iteration (compiler can't do it, because of code complexity) - var a = self.words[0] | 0; - var b = num.words[0] | 0; - var r = a * b; - - var lo = r & 0x3ffffff; - var carry = (r / 0x4000000) | 0; - out.words[0] = lo; - - for (var k = 1; k < len; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = carry >>> 26; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = (k - j) | 0; - a = self.words[i] | 0; - b = num.words[j] | 0; - r = a * b + rword; - ncarry += (r / 0x4000000) | 0; - rword = r & 0x3ffffff; - } - out.words[k] = rword | 0; - carry = ncarry | 0; - } - if (carry !== 0) { - out.words[k] = carry | 0; - } else { - out.length--; - } - - return out._strip(); - } - - // TODO(indutny): it may be reasonable to omit it for users who don't need - // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit - // multiplication (like elliptic secp256k1). - var comb10MulTo = function comb10MulTo (self, num, out) { - var a = self.words; - var b = num.words; - var o = out.words; - var c = 0; - var lo; - var mid; - var hi; - var a0 = a[0] | 0; - var al0 = a0 & 0x1fff; - var ah0 = a0 >>> 13; - var a1 = a[1] | 0; - var al1 = a1 & 0x1fff; - var ah1 = a1 >>> 13; - var a2 = a[2] | 0; - var al2 = a2 & 0x1fff; - var ah2 = a2 >>> 13; - var a3 = a[3] | 0; - var al3 = a3 & 0x1fff; - var ah3 = a3 >>> 13; - var a4 = a[4] | 0; - var al4 = a4 & 0x1fff; - var ah4 = a4 >>> 13; - var a5 = a[5] | 0; - var al5 = a5 & 0x1fff; - var ah5 = a5 >>> 13; - var a6 = a[6] | 0; - var al6 = a6 & 0x1fff; - var ah6 = a6 >>> 13; - var a7 = a[7] | 0; - var al7 = a7 & 0x1fff; - var ah7 = a7 >>> 13; - var a8 = a[8] | 0; - var al8 = a8 & 0x1fff; - var ah8 = a8 >>> 13; - var a9 = a[9] | 0; - var al9 = a9 & 0x1fff; - var ah9 = a9 >>> 13; - var b0 = b[0] | 0; - var bl0 = b0 & 0x1fff; - var bh0 = b0 >>> 13; - var b1 = b[1] | 0; - var bl1 = b1 & 0x1fff; - var bh1 = b1 >>> 13; - var b2 = b[2] | 0; - var bl2 = b2 & 0x1fff; - var bh2 = b2 >>> 13; - var b3 = b[3] | 0; - var bl3 = b3 & 0x1fff; - var bh3 = b3 >>> 13; - var b4 = b[4] | 0; - var bl4 = b4 & 0x1fff; - var bh4 = b4 >>> 13; - var b5 = b[5] | 0; - var bl5 = b5 & 0x1fff; - var bh5 = b5 >>> 13; - var b6 = b[6] | 0; - var bl6 = b6 & 0x1fff; - var bh6 = b6 >>> 13; - var b7 = b[7] | 0; - var bl7 = b7 & 0x1fff; - var bh7 = b7 >>> 13; - var b8 = b[8] | 0; - var bl8 = b8 & 0x1fff; - var bh8 = b8 >>> 13; - var b9 = b[9] | 0; - var bl9 = b9 & 0x1fff; - var bh9 = b9 >>> 13; + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; out.negative = self.negative ^ num.negative; out.length = 19; @@ -19735,7 +18603,7 @@ function fromByteArray (uint8) { }; })(typeof module === 'undefined' || module, this); -},{"buffer":43}],42:[function(require,module,exports){ +},{"buffer":39}],38:[function(require,module,exports){ var r; module.exports = function rand(len) { @@ -19802,9 +18670,9 @@ if (typeof self === 'object') { } } -},{"crypto":43}],43:[function(require,module,exports){ +},{"crypto":39}],39:[function(require,module,exports){ -},{}],44:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ // based on the aes implimentation in triple sec // https://github.com/keybase/triplesec // which is in turn based on the one from crypto-js @@ -20034,7 +18902,7 @@ AES.prototype.scrub = function () { module.exports.AES = AES -},{"safe-buffer":225}],45:[function(require,module,exports){ +},{"safe-buffer":219}],41:[function(require,module,exports){ var aes = require('./aes') var Buffer = require('safe-buffer').Buffer var Transform = require('cipher-base') @@ -20153,7 +19021,7 @@ StreamCipher.prototype.setAAD = function setAAD (buf) { module.exports = StreamCipher -},{"./aes":44,"./ghash":49,"./incr32":50,"buffer-xor":87,"cipher-base":123,"inherits":193,"safe-buffer":225}],46:[function(require,module,exports){ +},{"./aes":40,"./ghash":45,"./incr32":46,"buffer-xor":82,"cipher-base":118,"inherits":188,"safe-buffer":219}],42:[function(require,module,exports){ var ciphers = require('./encrypter') var deciphers = require('./decrypter') var modes = require('./modes/list.json') @@ -20168,7 +19036,7 @@ exports.createDecipher = exports.Decipher = deciphers.createDecipher exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv exports.listCiphers = exports.getCiphers = getCiphers -},{"./decrypter":47,"./encrypter":48,"./modes/list.json":58}],47:[function(require,module,exports){ +},{"./decrypter":43,"./encrypter":44,"./modes/list.json":54}],43:[function(require,module,exports){ var AuthCipher = require('./authCipher') var Buffer = require('safe-buffer').Buffer var MODES = require('./modes') @@ -20294,7 +19162,7 @@ function createDecipher (suite, password) { exports.createDecipher = createDecipher exports.createDecipheriv = createDecipheriv -},{"./aes":44,"./authCipher":45,"./modes":57,"./streamCipher":60,"cipher-base":123,"evp_bytestokey":161,"inherits":193,"safe-buffer":225}],48:[function(require,module,exports){ +},{"./aes":40,"./authCipher":41,"./modes":53,"./streamCipher":56,"cipher-base":118,"evp_bytestokey":156,"inherits":188,"safe-buffer":219}],44:[function(require,module,exports){ var MODES = require('./modes') var AuthCipher = require('./authCipher') var Buffer = require('safe-buffer').Buffer @@ -20410,7 +19278,7 @@ function createCipher (suite, password) { exports.createCipheriv = createCipheriv exports.createCipher = createCipher -},{"./aes":44,"./authCipher":45,"./modes":57,"./streamCipher":60,"cipher-base":123,"evp_bytestokey":161,"inherits":193,"safe-buffer":225}],49:[function(require,module,exports){ +},{"./aes":40,"./authCipher":41,"./modes":53,"./streamCipher":56,"cipher-base":118,"evp_bytestokey":156,"inherits":188,"safe-buffer":219}],45:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var ZEROES = Buffer.alloc(16, 0) @@ -20501,7 +19369,7 @@ GHASH.prototype.final = function (abl, bl) { module.exports = GHASH -},{"safe-buffer":225}],50:[function(require,module,exports){ +},{"safe-buffer":219}],46:[function(require,module,exports){ function incr32 (iv) { var len = iv.length var item @@ -20518,7 +19386,7 @@ function incr32 (iv) { } module.exports = incr32 -},{}],51:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ var xor = require('buffer-xor') exports.encrypt = function (self, block) { @@ -20537,7 +19405,7 @@ exports.decrypt = function (self, block) { return xor(out, pad) } -},{"buffer-xor":87}],52:[function(require,module,exports){ +},{"buffer-xor":82}],48:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var xor = require('buffer-xor') @@ -20572,7 +19440,7 @@ exports.encrypt = function (self, data, decrypt) { return out } -},{"buffer-xor":87,"safe-buffer":225}],53:[function(require,module,exports){ +},{"buffer-xor":82,"safe-buffer":219}],49:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer function encryptByte (self, byteParam, decrypt) { @@ -20616,7 +19484,7 @@ exports.encrypt = function (self, chunk, decrypt) { return out } -},{"safe-buffer":225}],54:[function(require,module,exports){ +},{"safe-buffer":219}],50:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer function encryptByte (self, byteParam, decrypt) { @@ -20643,7 +19511,7 @@ exports.encrypt = function (self, chunk, decrypt) { return out } -},{"safe-buffer":225}],55:[function(require,module,exports){ +},{"safe-buffer":219}],51:[function(require,module,exports){ var xor = require('buffer-xor') var Buffer = require('safe-buffer').Buffer var incr32 = require('../incr32') @@ -20675,7 +19543,7 @@ exports.encrypt = function (self, chunk) { return xor(chunk, pad) } -},{"../incr32":50,"buffer-xor":87,"safe-buffer":225}],56:[function(require,module,exports){ +},{"../incr32":46,"buffer-xor":82,"safe-buffer":219}],52:[function(require,module,exports){ exports.encrypt = function (self, block) { return self._cipher.encryptBlock(block) } @@ -20684,7 +19552,7 @@ exports.decrypt = function (self, block) { return self._cipher.decryptBlock(block) } -},{}],57:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ var modeModules = { ECB: require('./ecb'), CBC: require('./cbc'), @@ -20704,7 +19572,7 @@ for (var key in modes) { module.exports = modes -},{"./cbc":51,"./cfb":52,"./cfb1":53,"./cfb8":54,"./ctr":55,"./ecb":56,"./list.json":58,"./ofb":59}],58:[function(require,module,exports){ +},{"./cbc":47,"./cfb":48,"./cfb1":49,"./cfb8":50,"./ctr":51,"./ecb":52,"./list.json":54,"./ofb":55}],54:[function(require,module,exports){ module.exports={ "aes-128-ecb": { "cipher": "AES", @@ -20897,7 +19765,7 @@ module.exports={ } } -},{}],59:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ (function (Buffer){(function (){ var xor = require('buffer-xor') @@ -20917,7 +19785,7 @@ exports.encrypt = function (self, chunk) { } }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":88,"buffer-xor":87}],60:[function(require,module,exports){ +},{"buffer":83,"buffer-xor":82}],56:[function(require,module,exports){ var aes = require('./aes') var Buffer = require('safe-buffer').Buffer var Transform = require('cipher-base') @@ -20946,7 +19814,7 @@ StreamCipher.prototype._final = function () { module.exports = StreamCipher -},{"./aes":44,"cipher-base":123,"inherits":193,"safe-buffer":225}],61:[function(require,module,exports){ +},{"./aes":40,"cipher-base":118,"inherits":188,"safe-buffer":219}],57:[function(require,module,exports){ var DES = require('browserify-des') var aes = require('browserify-aes/browser') var aesModes = require('browserify-aes/modes') @@ -21015,7 +19883,7 @@ exports.createDecipher = exports.Decipher = createDecipher exports.createDecipheriv = exports.Decipheriv = createDecipheriv exports.listCiphers = exports.getCiphers = getCiphers -},{"browserify-aes/browser":46,"browserify-aes/modes":57,"browserify-des":62,"browserify-des/modes":63,"evp_bytestokey":161}],62:[function(require,module,exports){ +},{"browserify-aes/browser":42,"browserify-aes/modes":53,"browserify-des":58,"browserify-des/modes":59,"evp_bytestokey":156}],58:[function(require,module,exports){ var CipherBase = require('cipher-base') var des = require('des.js') var inherits = require('inherits') @@ -21067,7 +19935,7 @@ DES.prototype._final = function () { return Buffer.from(this._des.final()) } -},{"cipher-base":123,"des.js":132,"inherits":193,"safe-buffer":225}],63:[function(require,module,exports){ +},{"cipher-base":118,"des.js":127,"inherits":188,"safe-buffer":219}],59:[function(require,module,exports){ exports['des-ecb'] = { key: 8, iv: 0 @@ -21093,7 +19961,7 @@ exports['des-ede'] = { iv: 0 } -},{}],64:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ (function (Buffer){(function (){ var BN = require('bn.js') var randomBytes = require('randombytes') @@ -21132,10 +20000,10 @@ crt.getr = getr module.exports = crt }).call(this)}).call(this,require("buffer").Buffer) -},{"bn.js":41,"buffer":88,"randombytes":222}],65:[function(require,module,exports){ +},{"bn.js":37,"buffer":83,"randombytes":216}],61:[function(require,module,exports){ module.exports = require('./browser/algorithms.json') -},{"./browser/algorithms.json":66}],66:[function(require,module,exports){ +},{"./browser/algorithms.json":62}],62:[function(require,module,exports){ module.exports={ "sha224WithRSAEncryption": { "sign": "rsa", @@ -21289,7 +20157,7 @@ module.exports={ } } -},{}],67:[function(require,module,exports){ +},{}],63:[function(require,module,exports){ module.exports={ "1.3.132.0.10": "secp256k1", "1.3.132.0.33": "p224", @@ -21299,7 +20167,7 @@ module.exports={ "1.3.132.0.35": "p521" } -},{}],68:[function(require,module,exports){ +},{}],64:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var createHash = require('create-hash') var stream = require('readable-stream') @@ -21393,7 +20261,7 @@ module.exports = { createVerify: createVerify } -},{"./algorithms.json":66,"./sign":69,"./verify":70,"create-hash":126,"inherits":193,"readable-stream":85,"safe-buffer":225}],69:[function(require,module,exports){ +},{"./algorithms.json":62,"./sign":65,"./verify":66,"create-hash":121,"inherits":188,"readable-stream":81,"safe-buffer":219}],65:[function(require,module,exports){ // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var Buffer = require('safe-buffer').Buffer var createHmac = require('create-hmac') @@ -21538,7 +20406,7 @@ module.exports = sign module.exports.getKey = getKey module.exports.makeKey = makeKey -},{"./curves.json":67,"bn.js":41,"browserify-rsa":64,"create-hmac":128,"elliptic":143,"parse-asn1":204,"safe-buffer":225}],70:[function(require,module,exports){ +},{"./curves.json":63,"bn.js":37,"browserify-rsa":60,"create-hmac":123,"elliptic":138,"parse-asn1":198,"safe-buffer":219}],66:[function(require,module,exports){ // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var Buffer = require('safe-buffer').Buffer var BN = require('bn.js') @@ -21624,7 +20492,7 @@ function checkValue (b, q) { module.exports = verify -},{"./curves.json":67,"bn.js":41,"elliptic":143,"parse-asn1":204,"safe-buffer":225}],71:[function(require,module,exports){ +},{"./curves.json":63,"bn.js":37,"elliptic":138,"parse-asn1":198,"safe-buffer":219}],67:[function(require,module,exports){ 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } @@ -21753,7 +20621,7 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); module.exports.codes = codes; -},{}],72:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ (function (process){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -21895,7 +20763,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', { } }); }).call(this)}).call(this,require('_process')) -},{"./_stream_readable":74,"./_stream_writable":76,"_process":212,"inherits":193}],73:[function(require,module,exports){ +},{"./_stream_readable":70,"./_stream_writable":72,"_process":206,"inherits":188}],69:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -21935,7 +20803,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":75,"inherits":193}],74:[function(require,module,exports){ +},{"./_stream_transform":71,"inherits":188}],70:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -23062,7 +21930,7 @@ function indexOf(xs, x) { return -1; } }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":71,"./_stream_duplex":72,"./internal/streams/async_iterator":77,"./internal/streams/buffer_list":78,"./internal/streams/destroy":79,"./internal/streams/from":81,"./internal/streams/state":83,"./internal/streams/stream":84,"_process":212,"buffer":88,"events":160,"inherits":193,"string_decoder/":250,"util":43}],75:[function(require,module,exports){ +},{"../errors":67,"./_stream_duplex":68,"./internal/streams/async_iterator":73,"./internal/streams/buffer_list":74,"./internal/streams/destroy":75,"./internal/streams/from":77,"./internal/streams/state":79,"./internal/streams/stream":80,"_process":206,"buffer":83,"events":155,"inherits":188,"string_decoder/":244,"util":39}],71:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -23264,7 +22132,7 @@ function done(stream, er, data) { if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); return stream.push(null); } -},{"../errors":71,"./_stream_duplex":72,"inherits":193}],76:[function(require,module,exports){ +},{"../errors":67,"./_stream_duplex":68,"inherits":188}],72:[function(require,module,exports){ (function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // @@ -23964,7 +22832,7 @@ Writable.prototype._destroy = function (err, cb) { cb(err); }; }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":71,"./_stream_duplex":72,"./internal/streams/destroy":79,"./internal/streams/state":83,"./internal/streams/stream":84,"_process":212,"buffer":88,"inherits":193,"util-deprecate":253}],77:[function(require,module,exports){ +},{"../errors":67,"./_stream_duplex":68,"./internal/streams/destroy":75,"./internal/streams/state":79,"./internal/streams/stream":80,"_process":206,"buffer":83,"inherits":188,"util-deprecate":247}],73:[function(require,module,exports){ (function (process){(function (){ 'use strict'; @@ -24174,7 +23042,7 @@ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterat module.exports = createReadableStreamAsyncIterator; }).call(this)}).call(this,require('_process')) -},{"./end-of-stream":80,"_process":212}],78:[function(require,module,exports){ +},{"./end-of-stream":76,"_process":206}],74:[function(require,module,exports){ 'use strict'; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } @@ -24385,7 +23253,7 @@ function () { return BufferList; }(); -},{"buffer":88,"util":43}],79:[function(require,module,exports){ +},{"buffer":83,"util":39}],75:[function(require,module,exports){ (function (process){(function (){ 'use strict'; // undocumented cb() API, needed for core, not for public API @@ -24493,7 +23361,7 @@ module.exports = { errorOrDestroy: errorOrDestroy }; }).call(this)}).call(this,require('_process')) -},{"_process":212}],80:[function(require,module,exports){ +},{"_process":206}],76:[function(require,module,exports){ // Ported from https://github.com/mafintosh/end-of-stream with // permission from the author, Mathias Buus (@mafintosh). 'use strict'; @@ -24598,12 +23466,12 @@ function eos(stream, opts, callback) { } module.exports = eos; -},{"../../../errors":71}],81:[function(require,module,exports){ +},{"../../../errors":67}],77:[function(require,module,exports){ module.exports = function () { throw new Error('Readable.from is not available in the browser') }; -},{}],82:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ // Ported from https://github.com/mafintosh/pump with // permission from the author, Mathias Buus (@mafintosh). 'use strict'; @@ -24701,7 +23569,7 @@ function pipeline() { } module.exports = pipeline; -},{"../../../errors":71,"./end-of-stream":80}],83:[function(require,module,exports){ +},{"../../../errors":67,"./end-of-stream":76}],79:[function(require,module,exports){ 'use strict'; var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; @@ -24729,10 +23597,10 @@ function getHighWaterMark(state, options, duplexKey, isDuplex) { module.exports = { getHighWaterMark: getHighWaterMark }; -},{"../../../errors":71}],84:[function(require,module,exports){ +},{"../../../errors":67}],80:[function(require,module,exports){ module.exports = require('events').EventEmitter; -},{"events":160}],85:[function(require,module,exports){ +},{"events":155}],81:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -24743,28 +23611,7 @@ exports.PassThrough = require('./lib/_stream_passthrough.js'); exports.finished = require('./lib/internal/streams/end-of-stream.js'); exports.pipeline = require('./lib/internal/streams/pipeline.js'); -},{"./lib/_stream_duplex.js":72,"./lib/_stream_passthrough.js":73,"./lib/_stream_readable.js":74,"./lib/_stream_transform.js":75,"./lib/_stream_writable.js":76,"./lib/internal/streams/end-of-stream.js":80,"./lib/internal/streams/pipeline.js":82}],86:[function(require,module,exports){ -(function (Buffer){(function (){ -(function () { - "use strict"; - - function btoa(str) { - var buffer; - - if (str instanceof Buffer) { - buffer = str; - } else { - buffer = Buffer.from(str.toString(), 'binary'); - } - - return buffer.toString('base64'); - } - - module.exports = btoa; -}()); - -}).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":88}],87:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":68,"./lib/_stream_passthrough.js":69,"./lib/_stream_readable.js":70,"./lib/_stream_transform.js":71,"./lib/_stream_writable.js":72,"./lib/internal/streams/end-of-stream.js":76,"./lib/internal/streams/pipeline.js":78}],82:[function(require,module,exports){ (function (Buffer){(function (){ module.exports = function xor (a, b) { var length = Math.min(a.length, b.length) @@ -24778,7 +23625,7 @@ module.exports = function xor (a, b) { } }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":88}],88:[function(require,module,exports){ +},{"buffer":83}],83:[function(require,module,exports){ (function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. @@ -26559,10 +25406,10 @@ function numberIsNaN (obj) { } }).call(this)}).call(this,require("buffer").Buffer) -},{"base64-js":40,"buffer":88,"ieee754":192}],89:[function(require,module,exports){ +},{"base64-js":36,"buffer":83,"ieee754":187}],84:[function(require,module,exports){ module.exports = require('./lib/chai'); -},{"./lib/chai":90}],90:[function(require,module,exports){ +},{"./lib/chai":85}],85:[function(require,module,exports){ /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> @@ -26656,7 +25503,7 @@ exports.use(should); var assert = require('./chai/interface/assert'); exports.use(assert); -},{"./chai/assertion":91,"./chai/config":92,"./chai/core/assertions":93,"./chai/interface/assert":94,"./chai/interface/expect":95,"./chai/interface/should":96,"./chai/utils":111,"assertion-error":39}],91:[function(require,module,exports){ +},{"./chai/assertion":86,"./chai/config":87,"./chai/core/assertions":88,"./chai/interface/assert":89,"./chai/interface/expect":90,"./chai/interface/should":91,"./chai/utils":106,"assertion-error":35}],86:[function(require,module,exports){ /*! * chai * http://chaijs.com @@ -26833,7 +25680,7 @@ module.exports = function (_chai, util) { }); }; -},{"./config":92}],92:[function(require,module,exports){ +},{"./config":87}],87:[function(require,module,exports){ module.exports = { /** @@ -26929,7 +25776,7 @@ module.exports = { proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'] }; -},{}],93:[function(require,module,exports){ +},{}],88:[function(require,module,exports){ /*! * chai * http://chaijs.com @@ -30784,7 +29631,7 @@ module.exports = function (chai, _) { }); }; -},{}],94:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> @@ -33899,7 +32746,7 @@ module.exports = function (chai, util) { ('isNotEmpty', 'notEmpty'); }; -},{}],95:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> @@ -33948,7 +32795,7 @@ module.exports = function (chai, util) { }; }; -},{}],96:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ /*! * chai * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com> @@ -34169,7 +33016,7 @@ module.exports = function (chai, util) { chai.Should = loadShould; }; -},{}],97:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ /*! * Chai - addChainingMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34323,7 +33170,7 @@ module.exports = function addChainableMethod(ctx, name, method, chainingBehavior }); }; -},{"../../chai":90,"./addLengthGuard":98,"./flag":103,"./proxify":119,"./transferFlags":121}],98:[function(require,module,exports){ +},{"../../chai":85,"./addLengthGuard":93,"./flag":98,"./proxify":114,"./transferFlags":116}],93:[function(require,module,exports){ var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); /*! @@ -34385,7 +33232,7 @@ module.exports = function addLengthGuard (fn, assertionName, isChainable) { return fn; }; -},{}],99:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ /*! * Chai - addMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34455,7 +33302,7 @@ module.exports = function addMethod(ctx, name, method) { ctx[name] = proxify(methodWrapper, name); }; -},{"../../chai":90,"./addLengthGuard":98,"./flag":103,"./proxify":119,"./transferFlags":121}],100:[function(require,module,exports){ +},{"../../chai":85,"./addLengthGuard":93,"./flag":98,"./proxify":114,"./transferFlags":116}],95:[function(require,module,exports){ /*! * Chai - addProperty utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34529,7 +33376,7 @@ module.exports = function addProperty(ctx, name, getter) { }); }; -},{"../../chai":90,"./flag":103,"./isProxyEnabled":114,"./transferFlags":121}],101:[function(require,module,exports){ +},{"../../chai":85,"./flag":98,"./isProxyEnabled":109,"./transferFlags":116}],96:[function(require,module,exports){ /*! * Chai - compareByInspect utility * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com> @@ -34562,7 +33409,7 @@ module.exports = function compareByInspect(a, b) { return inspect(a) < inspect(b) ? -1 : 1; }; -},{"./inspect":112}],102:[function(require,module,exports){ +},{"./inspect":107}],97:[function(require,module,exports){ /*! * Chai - expectTypes utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34615,7 +33462,7 @@ module.exports = function expectTypes(obj, types) { } }; -},{"./flag":103,"assertion-error":39,"type-detect":252}],103:[function(require,module,exports){ +},{"./flag":98,"assertion-error":35,"type-detect":246}],98:[function(require,module,exports){ /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34650,7 +33497,7 @@ module.exports = function flag(obj, key, value) { } }; -},{}],104:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ /*! * Chai - getActual utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34672,7 +33519,7 @@ module.exports = function getActual(obj, args) { return args.length > 4 ? args[4] : obj._obj; }; -},{}],105:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ /*! * Chai - getEnumerableProperties utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34700,7 +33547,7 @@ module.exports = function getEnumerableProperties(object) { return result; }; -},{}],106:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ /*! * Chai - message composition utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34752,7 +33599,7 @@ module.exports = function getMessage(obj, args) { return flagMsg ? flagMsg + ': ' + msg : msg; }; -},{"./flag":103,"./getActual":104,"./objDisplay":115}],107:[function(require,module,exports){ +},{"./flag":98,"./getActual":99,"./objDisplay":110}],102:[function(require,module,exports){ var type = require('type-detect'); var flag = require('./flag'); @@ -34809,7 +33656,7 @@ module.exports = function getOperator(obj, args) { return isObject ? 'deepStrictEqual' : 'strictEqual'; }; -},{"./flag":103,"type-detect":252}],108:[function(require,module,exports){ +},{"./flag":98,"type-detect":246}],103:[function(require,module,exports){ /*! * Chai - getOwnEnumerableProperties utility * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com> @@ -34840,7 +33687,7 @@ module.exports = function getOwnEnumerableProperties(obj) { return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); }; -},{"./getOwnEnumerablePropertySymbols":109}],109:[function(require,module,exports){ +},{"./getOwnEnumerablePropertySymbols":104}],104:[function(require,module,exports){ /*! * Chai - getOwnEnumerablePropertySymbols utility * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com> @@ -34869,7 +33716,7 @@ module.exports = function getOwnEnumerablePropertySymbols(obj) { }); }; -},{}],110:[function(require,module,exports){ +},{}],105:[function(require,module,exports){ /*! * Chai - getProperties utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -34907,7 +33754,7 @@ module.exports = function getProperties(object) { return result; }; -},{}],111:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ /*! * chai * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com> @@ -35086,7 +33933,7 @@ exports.isNaN = require('./isNaN'); */ exports.getOperator = require('./getOperator'); -},{"./addChainableMethod":97,"./addLengthGuard":98,"./addMethod":99,"./addProperty":100,"./compareByInspect":101,"./expectTypes":102,"./flag":103,"./getActual":104,"./getMessage":106,"./getOperator":107,"./getOwnEnumerableProperties":108,"./getOwnEnumerablePropertySymbols":109,"./inspect":112,"./isNaN":113,"./isProxyEnabled":114,"./objDisplay":115,"./overwriteChainableMethod":116,"./overwriteMethod":117,"./overwriteProperty":118,"./proxify":119,"./test":120,"./transferFlags":121,"check-error":122,"deep-eql":131,"get-func-name":162,"pathval":205,"type-detect":252}],112:[function(require,module,exports){ +},{"./addChainableMethod":92,"./addLengthGuard":93,"./addMethod":94,"./addProperty":95,"./compareByInspect":96,"./expectTypes":97,"./flag":98,"./getActual":99,"./getMessage":101,"./getOperator":102,"./getOwnEnumerableProperties":103,"./getOwnEnumerablePropertySymbols":104,"./inspect":107,"./isNaN":108,"./isProxyEnabled":109,"./objDisplay":110,"./overwriteChainableMethod":111,"./overwriteMethod":112,"./overwriteProperty":113,"./proxify":114,"./test":115,"./transferFlags":116,"check-error":117,"deep-eql":126,"get-func-name":157,"pathval":199,"type-detect":246}],107:[function(require,module,exports){ // This is (almost) directly from Node.js utils // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js @@ -35467,7 +34314,7 @@ function objectToString(o) { return Object.prototype.toString.call(o); } -},{"../config":92,"./getEnumerableProperties":105,"./getProperties":110,"get-func-name":162}],113:[function(require,module,exports){ +},{"../config":87,"./getEnumerableProperties":100,"./getProperties":105,"get-func-name":157}],108:[function(require,module,exports){ /*! * Chai - isNaN utility * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com> @@ -35495,7 +34342,7 @@ function isNaN(value) { // If ECMAScript 6's Number.isNaN is present, prefer that. module.exports = Number.isNaN || isNaN; -},{}],114:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ var config = require('../config'); /*! @@ -35521,7 +34368,7 @@ module.exports = function isProxyEnabled() { typeof Reflect !== 'undefined'; }; -},{"../config":92}],115:[function(require,module,exports){ +},{"../config":87}],110:[function(require,module,exports){ /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -35573,7 +34420,7 @@ module.exports = function objDisplay(obj) { } }; -},{"../config":92,"./inspect":112}],116:[function(require,module,exports){ +},{"../config":87,"./inspect":107}],111:[function(require,module,exports){ /*! * Chai - overwriteChainableMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -35644,7 +34491,7 @@ module.exports = function overwriteChainableMethod(ctx, name, method, chainingBe }; }; -},{"../../chai":90,"./transferFlags":121}],117:[function(require,module,exports){ +},{"../../chai":85,"./transferFlags":116}],112:[function(require,module,exports){ /*! * Chai - overwriteMethod utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -35738,7 +34585,7 @@ module.exports = function overwriteMethod(ctx, name, method) { ctx[name] = proxify(overwritingMethodWrapper, name); }; -},{"../../chai":90,"./addLengthGuard":98,"./flag":103,"./proxify":119,"./transferFlags":121}],118:[function(require,module,exports){ +},{"../../chai":85,"./addLengthGuard":93,"./flag":98,"./proxify":114,"./transferFlags":116}],113:[function(require,module,exports){ /*! * Chai - overwriteProperty utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -35832,7 +34679,7 @@ module.exports = function overwriteProperty(ctx, name, getter) { }); }; -},{"../../chai":90,"./flag":103,"./isProxyEnabled":114,"./transferFlags":121}],119:[function(require,module,exports){ +},{"../../chai":85,"./flag":98,"./isProxyEnabled":109,"./transferFlags":116}],114:[function(require,module,exports){ var config = require('../config'); var flag = require('./flag'); var getProperties = require('./getProperties'); @@ -35981,7 +34828,7 @@ function stringDistanceCapped(strA, strB, cap) { return memo[strA.length][strB.length]; } -},{"../config":92,"./flag":103,"./getProperties":110,"./isProxyEnabled":114}],120:[function(require,module,exports){ +},{"../config":87,"./flag":98,"./getProperties":105,"./isProxyEnabled":109}],115:[function(require,module,exports){ /*! * Chai - test utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -36011,7 +34858,7 @@ module.exports = function test(obj, args) { return negate ? !expr : expr; }; -},{"./flag":103}],121:[function(require,module,exports){ +},{"./flag":98}],116:[function(require,module,exports){ /*! * Chai - transferFlags utility * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> @@ -36058,7 +34905,7 @@ module.exports = function transferFlags(assertion, object, includeAll) { } }; -},{}],122:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ 'use strict'; /* ! @@ -36232,7 +35079,7 @@ module.exports = { getConstructorName: getConstructorName, }; -},{}],123:[function(require,module,exports){ +},{}],118:[function(require,module,exports){ var Buffer = require('safe-buffer').Buffer var Transform = require('stream').Transform var StringDecoder = require('string_decoder').StringDecoder @@ -36333,7 +35180,7 @@ CipherBase.prototype._toString = function (value, enc, fin) { module.exports = CipherBase -},{"inherits":193,"safe-buffer":225,"stream":235,"string_decoder":250}],124:[function(require,module,exports){ +},{"inherits":188,"safe-buffer":219,"stream":229,"string_decoder":244}],119:[function(require,module,exports){ (function (Buffer){(function (){ var elliptic = require('elliptic') var BN = require('bn.js') @@ -36461,9 +35308,9 @@ function formatReturnValue (bn, enc, len) { } }).call(this)}).call(this,require("buffer").Buffer) -},{"bn.js":125,"buffer":88,"elliptic":143}],125:[function(require,module,exports){ +},{"bn.js":120,"buffer":83,"elliptic":138}],120:[function(require,module,exports){ arguments[4][33][0].apply(exports,arguments) -},{"buffer":43,"dup":33}],126:[function(require,module,exports){ +},{"buffer":39,"dup":33}],121:[function(require,module,exports){ 'use strict' var inherits = require('inherits') var MD5 = require('md5.js') @@ -36495,14 +35342,14 @@ module.exports = function createHash (alg) { return new Hash(sha(alg)) } -},{"cipher-base":123,"inherits":193,"md5.js":194,"ripemd160":224,"sha.js":228}],127:[function(require,module,exports){ +},{"cipher-base":118,"inherits":188,"md5.js":189,"ripemd160":218,"sha.js":222}],122:[function(require,module,exports){ var MD5 = require('md5.js') module.exports = function (buffer) { return new MD5().update(buffer).digest() } -},{"md5.js":194}],128:[function(require,module,exports){ +},{"md5.js":189}],123:[function(require,module,exports){ 'use strict' var inherits = require('inherits') var Legacy = require('./legacy') @@ -36566,7 +35413,7 @@ module.exports = function createHmac (alg, key) { return new Hmac(alg, key) } -},{"./legacy":129,"cipher-base":123,"create-hash/md5":127,"inherits":193,"ripemd160":224,"safe-buffer":225,"sha.js":228}],129:[function(require,module,exports){ +},{"./legacy":124,"cipher-base":118,"create-hash/md5":122,"inherits":188,"ripemd160":218,"safe-buffer":219,"sha.js":222}],124:[function(require,module,exports){ 'use strict' var inherits = require('inherits') var Buffer = require('safe-buffer').Buffer @@ -36614,7 +35461,7 @@ Hmac.prototype._final = function () { } module.exports = Hmac -},{"cipher-base":123,"inherits":193,"safe-buffer":225}],130:[function(require,module,exports){ +},{"cipher-base":118,"inherits":188,"safe-buffer":219}],125:[function(require,module,exports){ 'use strict' exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes') @@ -36713,7 +35560,7 @@ exports.constants = { 'POINT_CONVERSION_HYBRID': 6 } -},{"browserify-cipher":61,"browserify-sign":68,"browserify-sign/algos":65,"create-ecdh":124,"create-hash":126,"create-hmac":128,"diffie-hellman":138,"pbkdf2":206,"public-encrypt":213,"randombytes":222,"randomfill":223}],131:[function(require,module,exports){ +},{"browserify-cipher":57,"browserify-sign":64,"browserify-sign/algos":61,"create-ecdh":119,"create-hash":121,"create-hmac":123,"diffie-hellman":133,"pbkdf2":200,"public-encrypt":207,"randombytes":216,"randomfill":217}],126:[function(require,module,exports){ 'use strict'; /* globals Symbol: false, Uint8Array: false, WeakMap: false */ /*! @@ -37170,7 +36017,7 @@ function isPrimitive(value) { return value === null || typeof value !== 'object'; } -},{"type-detect":252}],132:[function(require,module,exports){ +},{"type-detect":246}],127:[function(require,module,exports){ 'use strict'; exports.utils = require('./des/utils'); @@ -37179,7 +36026,7 @@ exports.DES = require('./des/des'); exports.CBC = require('./des/cbc'); exports.EDE = require('./des/ede'); -},{"./des/cbc":133,"./des/cipher":134,"./des/des":135,"./des/ede":136,"./des/utils":137}],133:[function(require,module,exports){ +},{"./des/cbc":128,"./des/cipher":129,"./des/des":130,"./des/ede":131,"./des/utils":132}],128:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -37246,7 +36093,7 @@ proto._update = function _update(inp, inOff, out, outOff) { } }; -},{"inherits":193,"minimalistic-assert":197}],134:[function(require,module,exports){ +},{"inherits":188,"minimalistic-assert":192}],129:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -37389,7 +36236,7 @@ Cipher.prototype._finalDecrypt = function _finalDecrypt() { return this._unpad(out); }; -},{"minimalistic-assert":197}],135:[function(require,module,exports){ +},{"minimalistic-assert":192}],130:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -37533,7 +36380,7 @@ DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { utils.rip(l, r, out, off); }; -},{"./cipher":134,"./utils":137,"inherits":193,"minimalistic-assert":197}],136:[function(require,module,exports){ +},{"./cipher":129,"./utils":132,"inherits":188,"minimalistic-assert":192}],131:[function(require,module,exports){ 'use strict'; var assert = require('minimalistic-assert'); @@ -37589,7 +36436,7 @@ EDE.prototype._update = function _update(inp, inOff, out, outOff) { EDE.prototype._pad = DES.prototype._pad; EDE.prototype._unpad = DES.prototype._unpad; -},{"./cipher":134,"./des":135,"inherits":193,"minimalistic-assert":197}],137:[function(require,module,exports){ +},{"./cipher":129,"./des":130,"inherits":188,"minimalistic-assert":192}],132:[function(require,module,exports){ 'use strict'; exports.readUInt32BE = function readUInt32BE(bytes, off) { @@ -37847,7 +36694,7 @@ exports.padSplit = function padSplit(num, size, group) { return out.join(' '); }; -},{}],138:[function(require,module,exports){ +},{}],133:[function(require,module,exports){ (function (Buffer){(function (){ var generatePrime = require('./lib/generatePrime') var primes = require('./lib/primes.json') @@ -37893,7 +36740,7 @@ exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffi exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman }).call(this)}).call(this,require("buffer").Buffer) -},{"./lib/dh":139,"./lib/generatePrime":140,"./lib/primes.json":141,"buffer":88}],139:[function(require,module,exports){ +},{"./lib/dh":134,"./lib/generatePrime":135,"./lib/primes.json":136,"buffer":83}],134:[function(require,module,exports){ (function (Buffer){(function (){ var BN = require('bn.js'); var MillerRabin = require('miller-rabin'); @@ -38061,7 +36908,7 @@ function formatReturnValue(bn, enc) { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./generatePrime":140,"bn.js":142,"buffer":88,"miller-rabin":195,"randombytes":222}],140:[function(require,module,exports){ +},{"./generatePrime":135,"bn.js":137,"buffer":83,"miller-rabin":190,"randombytes":216}],135:[function(require,module,exports){ var randomBytes = require('randombytes'); module.exports = findPrime; findPrime.simpleSieve = simpleSieve; @@ -38168,7 +37015,7 @@ function findPrime(bits, gen) { } -},{"bn.js":142,"miller-rabin":195,"randombytes":222}],141:[function(require,module,exports){ +},{"bn.js":137,"miller-rabin":190,"randombytes":216}],136:[function(require,module,exports){ module.exports={ "modp1": { "gen": "02", @@ -38203,9 +37050,9 @@ module.exports={ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } } -},{}],142:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ arguments[4][33][0].apply(exports,arguments) -},{"buffer":43,"dup":33}],143:[function(require,module,exports){ +},{"buffer":39,"dup":33}],138:[function(require,module,exports){ 'use strict'; var elliptic = exports; @@ -38220,7 +37067,7 @@ elliptic.curves = require('./elliptic/curves'); elliptic.ec = require('./elliptic/ec'); elliptic.eddsa = require('./elliptic/eddsa'); -},{"../package.json":159,"./elliptic/curve":146,"./elliptic/curves":149,"./elliptic/ec":150,"./elliptic/eddsa":153,"./elliptic/utils":157,"brorand":42}],144:[function(require,module,exports){ +},{"../package.json":154,"./elliptic/curve":141,"./elliptic/curves":144,"./elliptic/ec":145,"./elliptic/eddsa":148,"./elliptic/utils":152,"brorand":38}],139:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -38603,7 +37450,7 @@ BasePoint.prototype.dblp = function dblp(k) { return r; }; -},{"../utils":157,"bn.js":158}],145:[function(require,module,exports){ +},{"../utils":152,"bn.js":153}],140:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -39040,7 +37887,7 @@ Point.prototype.eqXToP = function eqXToP(x) { Point.prototype.toP = Point.prototype.normalize; Point.prototype.mixedAdd = Point.prototype.add; -},{"../utils":157,"./base":144,"bn.js":158,"inherits":193}],146:[function(require,module,exports){ +},{"../utils":152,"./base":139,"bn.js":153,"inherits":188}],141:[function(require,module,exports){ 'use strict'; var curve = exports; @@ -39050,7 +37897,7 @@ curve.short = require('./short'); curve.mont = require('./mont'); curve.edwards = require('./edwards'); -},{"./base":144,"./edwards":145,"./mont":147,"./short":148}],147:[function(require,module,exports){ +},{"./base":139,"./edwards":140,"./mont":142,"./short":143}],142:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -39230,7 +38077,7 @@ Point.prototype.getX = function getX() { return this.x.fromRed(); }; -},{"../utils":157,"./base":144,"bn.js":158,"inherits":193}],148:[function(require,module,exports){ +},{"../utils":152,"./base":139,"bn.js":153,"inherits":188}],143:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -40170,7 +39017,7 @@ JPoint.prototype.isInfinity = function isInfinity() { return this.z.cmpn(0) === 0; }; -},{"../utils":157,"./base":144,"bn.js":158,"inherits":193}],149:[function(require,module,exports){ +},{"../utils":152,"./base":139,"bn.js":153,"inherits":188}],144:[function(require,module,exports){ 'use strict'; var curves = exports; @@ -40378,7 +39225,7 @@ defineCurve('secp256k1', { ], }); -},{"./curve":146,"./precomputed/secp256k1":156,"./utils":157,"hash.js":179}],150:[function(require,module,exports){ +},{"./curve":141,"./precomputed/secp256k1":151,"./utils":152,"hash.js":174}],145:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -40623,7 +39470,7 @@ EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { throw new Error('Unable to find valid recovery factor'); }; -},{"../curves":149,"../utils":157,"./key":151,"./signature":152,"bn.js":158,"brorand":42,"hmac-drbg":191}],151:[function(require,module,exports){ +},{"../curves":144,"../utils":152,"./key":146,"./signature":147,"bn.js":153,"brorand":38,"hmac-drbg":186}],146:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -40746,7 +39593,7 @@ KeyPair.prototype.inspect = function inspect() { ' pub: ' + (this.pub && this.pub.inspect()) + ' >'; }; -},{"../utils":157,"bn.js":158}],152:[function(require,module,exports){ +},{"../utils":152,"bn.js":153}],147:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -40914,7 +39761,7 @@ Signature.prototype.toDER = function toDER(enc) { return utils.encode(res, enc); }; -},{"../utils":157,"bn.js":158}],153:[function(require,module,exports){ +},{"../utils":152,"bn.js":153}],148:[function(require,module,exports){ 'use strict'; var hash = require('hash.js'); @@ -41034,7 +39881,7 @@ EDDSA.prototype.isPoint = function isPoint(val) { return val instanceof this.pointClass; }; -},{"../curves":149,"../utils":157,"./key":154,"./signature":155,"hash.js":179}],154:[function(require,module,exports){ +},{"../curves":144,"../utils":152,"./key":149,"./signature":150,"hash.js":174}],149:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); @@ -41131,7 +39978,7 @@ KeyPair.prototype.getPublic = function getPublic(enc) { module.exports = KeyPair; -},{"../utils":157}],155:[function(require,module,exports){ +},{"../utils":152}],150:[function(require,module,exports){ 'use strict'; var BN = require('bn.js'); @@ -41198,7 +40045,7 @@ Signature.prototype.toHex = function toHex() { module.exports = Signature; -},{"../utils":157,"bn.js":158}],156:[function(require,module,exports){ +},{"../utils":152,"bn.js":153}],151:[function(require,module,exports){ module.exports = { doubles: { step: 4, @@ -41980,9104 +40827,9800 @@ module.exports = { }, }; -},{}],157:[function(require,module,exports){ -'use strict'; +},{}],152:[function(require,module,exports){ +'use strict'; + +var utils = exports; +var BN = require('bn.js'); +var minAssert = require('minimalistic-assert'); +var minUtils = require('minimalistic-crypto-utils'); + +utils.assert = minAssert; +utils.toArray = minUtils.toArray; +utils.zero2 = minUtils.zero2; +utils.toHex = minUtils.toHex; +utils.encode = minUtils.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (var i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; + + +},{"bn.js":153,"minimalistic-assert":192,"minimalistic-crypto-utils":193}],153:[function(require,module,exports){ +arguments[4][33][0].apply(exports,arguments) +},{"buffer":39,"dup":33}],154:[function(require,module,exports){ +module.exports={ + "name": "elliptic", + "version": "6.5.4", + "description": "EC cryptography", + "main": "lib/elliptic.js", + "files": [ + "lib" + ], + "scripts": { + "lint": "eslint lib test", + "lint:fix": "npm run lint -- --fix", + "unit": "istanbul test _mocha --reporter=spec test/index.js", + "test": "npm run lint && npm run unit", + "version": "grunt dist && git add dist/" + }, + "repository": { + "type": "git", + "url": "git@github.com:indutny/elliptic" + }, + "keywords": [ + "EC", + "Elliptic", + "curve", + "Cryptography" + ], + "author": "Fedor Indutny <fedor@indutny.com>", + "license": "MIT", + "bugs": { + "url": "https://github.com/indutny/elliptic/issues" + }, + "homepage": "https://github.com/indutny/elliptic", + "devDependencies": { + "brfs": "^2.0.2", + "coveralls": "^3.1.0", + "eslint": "^7.6.0", + "grunt": "^1.2.1", + "grunt-browserify": "^5.3.0", + "grunt-cli": "^1.3.2", + "grunt-contrib-connect": "^3.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^5.0.0", + "grunt-mocha-istanbul": "^5.0.2", + "grunt-saucelabs": "^9.0.1", + "istanbul": "^0.4.5", + "mocha": "^8.0.1" + }, + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } +} + +},{}],155:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + +},{}],156:[function(require,module,exports){ +var Buffer = require('safe-buffer').Buffer +var MD5 = require('md5.js') + +/* eslint-disable camelcase */ +function EVP_BytesToKey (password, salt, keyBits, ivLen) { + if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary') + if (salt) { + if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary') + if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length') + } + + var keyLen = keyBits / 8 + var key = Buffer.alloc(keyLen) + var iv = Buffer.alloc(ivLen || 0) + var tmp = Buffer.alloc(0) + + while (keyLen > 0 || ivLen > 0) { + var hash = new MD5() + hash.update(tmp) + hash.update(password) + if (salt) hash.update(salt) + tmp = hash.digest() + + var used = 0 + + if (keyLen > 0) { + var keyStart = key.length - keyLen + used = Math.min(keyLen, tmp.length) + tmp.copy(key, keyStart, 0, used) + keyLen -= used + } + + if (used < tmp.length && ivLen > 0) { + var ivStart = iv.length - ivLen + var length = Math.min(ivLen, tmp.length - used) + tmp.copy(iv, ivStart, used, used + length) + ivLen -= length + } + } + + tmp.fill(0) + return { key: key, iv: iv } +} + +module.exports = EVP_BytesToKey + +},{"md5.js":189,"safe-buffer":219}],157:[function(require,module,exports){ +'use strict'; + +/* ! + * Chai - getFuncName utility + * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com> + * MIT Licensed + */ + +/** + * ### .getFuncName(constructorFn) + * + * Returns the name of a function. + * When a non-function instance is passed, returns `null`. + * This also includes a polyfill function if `aFunc.name` is not defined. + * + * @name getFuncName + * @param {Function} funct + * @namespace Utils + * @api public + */ + +var toString = Function.prototype.toString; +var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; +function getFuncName(aFunc) { + if (typeof aFunc !== 'function') { + return null; + } + + var name = ''; + if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { + // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined + var match = toString.call(aFunc).match(functionNameMatch); + if (match) { + name = match[1]; + } + } else { + // If we've got a `name` property we just use it + name = aFunc.name; + } + + return name; +} + +module.exports = getFuncName; -var utils = exports; -var BN = require('bn.js'); -var minAssert = require('minimalistic-assert'); -var minUtils = require('minimalistic-crypto-utils'); +},{}],158:[function(require,module,exports){ +'use strict' +var Buffer = require('safe-buffer').Buffer +var Transform = require('readable-stream').Transform +var inherits = require('inherits') -utils.assert = minAssert; -utils.toArray = minUtils.toArray; -utils.zero2 = minUtils.zero2; -utils.toHex = minUtils.toHex; -utils.encode = minUtils.encode; +function throwIfNotStringOrBuffer (val, prefix) { + if (!Buffer.isBuffer(val) && typeof val !== 'string') { + throw new TypeError(prefix + ' must be a string or a buffer') + } +} -// Represent num in a w-NAF form -function getNAF(num, w, bits) { - var naf = new Array(Math.max(num.bitLength(), bits) + 1); - naf.fill(0); +function HashBase (blockSize) { + Transform.call(this) - var ws = 1 << (w + 1); - var k = num.clone(); + this._block = Buffer.allocUnsafe(blockSize) + this._blockSize = blockSize + this._blockOffset = 0 + this._length = [0, 0, 0, 0] - for (var i = 0; i < naf.length; i++) { - var z; - var mod = k.andln(ws - 1); - if (k.isOdd()) { - if (mod > (ws >> 1) - 1) - z = (ws >> 1) - mod; - else - z = mod; - k.isubn(z); - } else { - z = 0; - } + this._finalized = false +} - naf[i] = z; - k.iushrn(1); +inherits(HashBase, Transform) + +HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null + try { + this.update(chunk, encoding) + } catch (err) { + error = err } - return naf; + callback(error) } -utils.getNAF = getNAF; -// Represent k1, k2 in a Joint Sparse Form -function getJSF(k1, k2) { - var jsf = [ - [], - [], - ]; +HashBase.prototype._flush = function (callback) { + var error = null + try { + this.push(this.digest()) + } catch (err) { + error = err + } - k1 = k1.clone(); - k2 = k2.clone(); - var d1 = 0; - var d2 = 0; - var m8; - while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { - // First phase - var m14 = (k1.andln(3) + d1) & 3; - var m24 = (k2.andln(3) + d2) & 3; - if (m14 === 3) - m14 = -1; - if (m24 === 3) - m24 = -1; - var u1; - if ((m14 & 1) === 0) { - u1 = 0; - } else { - m8 = (k1.andln(7) + d1) & 7; - if ((m8 === 3 || m8 === 5) && m24 === 2) - u1 = -m14; - else - u1 = m14; - } - jsf[0].push(u1); + callback(error) +} - var u2; - if ((m24 & 1) === 0) { - u2 = 0; - } else { - m8 = (k2.andln(7) + d2) & 7; - if ((m8 === 3 || m8 === 5) && m14 === 2) - u2 = -m24; - else - u2 = m24; - } - jsf[1].push(u2); +HashBase.prototype.update = function (data, encoding) { + throwIfNotStringOrBuffer(data, 'Data') + if (this._finalized) throw new Error('Digest already called') + if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) - // Second phase - if (2 * d1 === u1 + 1) - d1 = 1 - d1; - if (2 * d2 === u2 + 1) - d2 = 1 - d2; - k1.iushrn(1); - k2.iushrn(1); + // consume data + var block = this._block + var offset = 0 + while (this._blockOffset + data.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] + this._update() + this._blockOffset = 0 } + while (offset < data.length) block[this._blockOffset++] = data[offset++] - return jsf; + // update length + for (var j = 0, carry = data.length * 8; carry > 0; ++j) { + this._length[j] += carry + carry = (this._length[j] / 0x0100000000) | 0 + if (carry > 0) this._length[j] -= 0x0100000000 * carry + } + + return this } -utils.getJSF = getJSF; -function cachedProperty(obj, name, computer) { - var key = '_' + name; - obj.prototype[name] = function cachedProperty() { - return this[key] !== undefined ? this[key] : - this[key] = computer.call(this); - }; +HashBase.prototype._update = function () { + throw new Error('_update is not implemented') } -utils.cachedProperty = cachedProperty; -function parseBytes(bytes) { - return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : - bytes; +HashBase.prototype.digest = function (encoding) { + if (this._finalized) throw new Error('Digest already called') + this._finalized = true + + var digest = this._digest() + if (encoding !== undefined) digest = digest.toString(encoding) + + // reset state + this._block.fill(0) + this._blockOffset = 0 + for (var i = 0; i < 4; ++i) this._length[i] = 0 + + return digest } -utils.parseBytes = parseBytes; -function intFromLE(bytes) { - return new BN(bytes, 'hex', 'le'); +HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented') } -utils.intFromLE = intFromLE; +module.exports = HashBase -},{"bn.js":158,"minimalistic-assert":197,"minimalistic-crypto-utils":198}],158:[function(require,module,exports){ -arguments[4][33][0].apply(exports,arguments) -},{"buffer":43,"dup":33}],159:[function(require,module,exports){ -module.exports={ - "name": "elliptic", - "version": "6.5.4", - "description": "EC cryptography", - "main": "lib/elliptic.js", - "files": [ - "lib" - ], - "scripts": { - "lint": "eslint lib test", - "lint:fix": "npm run lint -- --fix", - "unit": "istanbul test _mocha --reporter=spec test/index.js", - "test": "npm run lint && npm run unit", - "version": "grunt dist && git add dist/" - }, - "repository": { - "type": "git", - "url": "git@github.com:indutny/elliptic" - }, - "keywords": [ - "EC", - "Elliptic", - "curve", - "Cryptography" - ], - "author": "Fedor Indutny <fedor@indutny.com>", - "license": "MIT", - "bugs": { - "url": "https://github.com/indutny/elliptic/issues" - }, - "homepage": "https://github.com/indutny/elliptic", - "devDependencies": { - "brfs": "^2.0.2", - "coveralls": "^3.1.0", - "eslint": "^7.6.0", - "grunt": "^1.2.1", - "grunt-browserify": "^5.3.0", - "grunt-cli": "^1.3.2", - "grunt-contrib-connect": "^3.0.0", - "grunt-contrib-copy": "^1.0.0", - "grunt-contrib-uglify": "^5.0.0", - "grunt-mocha-istanbul": "^5.0.2", - "grunt-saucelabs": "^9.0.1", - "istanbul": "^0.4.5", - "mocha": "^8.0.1" - }, - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" +},{"inherits":188,"readable-stream":173,"safe-buffer":219}],159:[function(require,module,exports){ +arguments[4][67][0].apply(exports,arguments) +},{"dup":67}],160:[function(require,module,exports){ +arguments[4][68][0].apply(exports,arguments) +},{"./_stream_readable":162,"./_stream_writable":164,"_process":206,"dup":68,"inherits":188}],161:[function(require,module,exports){ +arguments[4][69][0].apply(exports,arguments) +},{"./_stream_transform":163,"dup":69,"inherits":188}],162:[function(require,module,exports){ +arguments[4][70][0].apply(exports,arguments) +},{"../errors":159,"./_stream_duplex":160,"./internal/streams/async_iterator":165,"./internal/streams/buffer_list":166,"./internal/streams/destroy":167,"./internal/streams/from":169,"./internal/streams/state":171,"./internal/streams/stream":172,"_process":206,"buffer":83,"dup":70,"events":155,"inherits":188,"string_decoder/":244,"util":39}],163:[function(require,module,exports){ +arguments[4][71][0].apply(exports,arguments) +},{"../errors":159,"./_stream_duplex":160,"dup":71,"inherits":188}],164:[function(require,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"../errors":159,"./_stream_duplex":160,"./internal/streams/destroy":167,"./internal/streams/state":171,"./internal/streams/stream":172,"_process":206,"buffer":83,"dup":72,"inherits":188,"util-deprecate":247}],165:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"./end-of-stream":168,"_process":206,"dup":73}],166:[function(require,module,exports){ +arguments[4][74][0].apply(exports,arguments) +},{"buffer":83,"dup":74,"util":39}],167:[function(require,module,exports){ +arguments[4][75][0].apply(exports,arguments) +},{"_process":206,"dup":75}],168:[function(require,module,exports){ +arguments[4][76][0].apply(exports,arguments) +},{"../../../errors":159,"dup":76}],169:[function(require,module,exports){ +arguments[4][77][0].apply(exports,arguments) +},{"dup":77}],170:[function(require,module,exports){ +arguments[4][78][0].apply(exports,arguments) +},{"../../../errors":159,"./end-of-stream":168,"dup":78}],171:[function(require,module,exports){ +arguments[4][79][0].apply(exports,arguments) +},{"../../../errors":159,"dup":79}],172:[function(require,module,exports){ +arguments[4][80][0].apply(exports,arguments) +},{"dup":80,"events":155}],173:[function(require,module,exports){ +arguments[4][81][0].apply(exports,arguments) +},{"./lib/_stream_duplex.js":160,"./lib/_stream_passthrough.js":161,"./lib/_stream_readable.js":162,"./lib/_stream_transform.js":163,"./lib/_stream_writable.js":164,"./lib/internal/streams/end-of-stream.js":168,"./lib/internal/streams/pipeline.js":170,"dup":81}],174:[function(require,module,exports){ +var hash = exports; + +hash.utils = require('./hash/utils'); +hash.common = require('./hash/common'); +hash.sha = require('./hash/sha'); +hash.ripemd = require('./hash/ripemd'); +hash.hmac = require('./hash/hmac'); + +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; + +},{"./hash/common":175,"./hash/hmac":176,"./hash/ripemd":177,"./hash/sha":178,"./hash/utils":185}],175:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var assert = require('minimalistic-assert'); + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (t = 8; t < this.padLength; t++) + res[i++] = 0; } + + return res; +}; + +},{"./utils":185,"minimalistic-assert":192}],176:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var assert = require('minimalistic-assert'); + +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; + + this._init(utils.toArray(key, enc)); } +module.exports = Hmac; -},{}],160:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + + for (i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); + + // 0x36 ^ 0x5c = 0x6a + for (i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; + +},{"./utils":185,"minimalistic-assert":192}],177:[function(require,module,exports){ 'use strict'; -var R = typeof Reflect === 'object' ? Reflect : null -var ReflectApply = R && typeof R.apply === 'function' - ? R.apply - : function ReflectApply(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - } +var utils = require('./utils'); +var common = require('./common'); -var ReflectOwnKeys -if (R && typeof R.ownKeys === 'function') { - ReflectOwnKeys = R.ownKeys -} else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target) - .concat(Object.getOwnPropertySymbols(target)); - }; -} else { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target); - }; +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; } +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; -function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); } -var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { - return value !== value; +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; } -function EventEmitter() { - EventEmitter.init.call(this); +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; } -module.exports = EventEmitter; -module.exports.once = once; -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +]; -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._eventsCount = 0; -EventEmitter.prototype._maxListeners = undefined; +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +]; -function checkListener(listener) { - if (typeof listener !== 'function') { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } -} +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; -Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); - } - defaultMaxListeners = arg; - } -}); +},{"./common":175,"./utils":185}],178:[function(require,module,exports){ +'use strict'; -EventEmitter.init = function() { +exports.sha1 = require('./sha/1'); +exports.sha224 = require('./sha/224'); +exports.sha256 = require('./sha/256'); +exports.sha384 = require('./sha/384'); +exports.sha512 = require('./sha/512'); - if (this._events === undefined || - this._events === Object.getPrototypeOf(this)._events) { - this._events = Object.create(null); - this._eventsCount = 0; - } +},{"./sha/1":179,"./sha/224":180,"./sha/256":181,"./sha/384":182,"./sha/512":183}],179:[function(require,module,exports){ +'use strict'; - this._maxListeners = this._maxListeners || undefined; -}; +var utils = require('../utils'); +var common = require('../common'); +var shaCommon = require('./common'); -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); - } - this._maxListeners = n; - return this; -}; +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_5 = utils.sum32_5; +var ft_1 = shaCommon.ft_1; +var BlockHash = common.BlockHash; -function _getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ + 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); } -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return _getMaxListeners(this); -}; +utils.inherits(SHA1, BlockHash); +module.exports = SHA1; -EventEmitter.prototype.emit = function emit(type) { - var args = []; - for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); - var doError = (type === 'error'); +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; - var events = this._events; - if (events !== undefined) - doError = (doError && events.error === undefined); - else if (!doError) - return false; +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; - // If there is no 'error' event listener then throw. - if (doError) { - var er; - if (args.length > 0) - er = args[0]; - if (er instanceof Error) { - // Note: The comments on the `throw` lines are intentional, they show - // up in Node's output if this results in an unhandled exception. - throw er; // Unhandled 'error' event - } - // At least give some kind of context to the user - var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); - err.context = er; - throw err; // Unhandled 'error' event - } + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; - var handler = events[type]; + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); - if (handler === undefined) - return false; + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; - if (typeof handler === 'function') { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - ReflectApply(listeners[i], this, args); + for (i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; } - return true; + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); }; -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - checkListener(listener); - - events = target._events; - if (events === undefined) { - events = target._events = Object.create(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener !== undefined) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } +},{"../common":175,"../utils":185,"./common":184}],180:[function(require,module,exports){ +'use strict'; - if (existing === undefined) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - // If we've already got an array, just append. - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } +var utils = require('../utils'); +var SHA256 = require('./256'); - // Check for listener leak - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - // No error code for this since it is a Warning - // eslint-disable-next-line no-restricted-syntax - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' ' + String(type) + ' listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); - return target; + SHA256.call(this); + this.h = [ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; } +utils.inherits(SHA224, SHA256); +module.exports = SHA224; -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; -EventEmitter.prototype.on = EventEmitter.prototype.addListener; +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) - return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } -} +},{"../utils":185,"./256":181}],181:[function(require,module,exports){ +'use strict'; -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} +var utils = require('../utils'); +var common = require('../common'); +var shaCommon = require('./common'); +var assert = require('minimalistic-assert'); -EventEmitter.prototype.once = function once(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var ch32 = shaCommon.ch32; +var maj32 = shaCommon.maj32; +var s0_256 = shaCommon.s0_256; +var s1_256 = shaCommon.s1_256; +var g0_256 = shaCommon.g0_256; +var g1_256 = shaCommon.g1_256; -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; +var BlockHash = common.BlockHash; -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; - checkListener(listener); +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); - events = this._events; - if (events === undefined) - return this; + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +module.exports = SHA256; - list = events[type]; - if (list === undefined) - return this; +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); - if (position < 0) - return this; + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; - if (position === 0) - list.shift(); - else { - spliceOne(list, position); - } + assert(this.k.length === W.length); + for (i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } - if (list.length === 1) - events[type] = list[0]; + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; - if (events.removeListener !== undefined) - this.emit('removeListener', type, originalListener || listener); - } +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; - return this; - }; +},{"../common":175,"../utils":185,"./common":184,"minimalistic-assert":192}],182:[function(require,module,exports){ +'use strict'; -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +var utils = require('../utils'); -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; +var SHA512 = require('./512'); - events = this._events; - if (events === undefined) - return this; +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); - // not listening for removeListener, no need to emit - if (events.removeListener === undefined) { - if (arguments.length === 0) { - this._events = Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== undefined) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else - delete events[type]; - } - return this; - } + SHA512.call(this); + this.h = [ + 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +module.exports = SHA384; - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = Object.create(null); - this._eventsCount = 0; - return this; - } +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; - listeners = events[type]; +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners !== undefined) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } +},{"../utils":185,"./512":183}],183:[function(require,module,exports){ +'use strict'; - return this; - }; +var utils = require('../utils'); +var common = require('../common'); +var assert = require('minimalistic-assert'); -function _listeners(target, type, unwrap) { - var events = target._events; +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; - if (events === undefined) - return []; +var BlockHash = common.BlockHash; - var evlistener = events[type]; - if (evlistener === undefined) - return []; +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); - return unwrap ? - unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); } +utils.inherits(SHA512, BlockHash); +module.exports = SHA512; -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); } }; -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); - if (events !== undefined) { - var evlistener = events[type]; + var W = this.W; - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener !== undefined) { - return evlistener.length; - } - } + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; - return 0; -} + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; -}; + var T1_hi = sum64_5_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); -function spliceOne(list, index) { - for (; index + 1 < list.length; index++) - list[index] = list[index + 1]; - list.pop(); -} + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} + hh = gh; + hl = gl; -function once(emitter, name) { - return new Promise(function (resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } + gh = fh; + gl = fl; - function resolver() { - if (typeof emitter.removeListener === 'function') { - emitter.removeListener('error', errorListener); - } - resolve([].slice.call(arguments)); - }; + fh = eh; + fl = el; - eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); - if (name !== 'error') { - addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); - } - }); -} + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); -function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if (typeof emitter.on === 'function') { - eventTargetAgnosticAddListener(emitter, 'error', handler, flags); - } -} + dh = ch; + dl = cl; -function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if (typeof emitter.on === 'function') { - if (flags.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === 'function') { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen for `error` events here. - emitter.addEventListener(name, function wrapListener(arg) { - // IE does not have builtin `{ once: true }` support so we - // have to do it manually. - if (flags.once) { - emitter.removeEventListener(name, wrapListener); - } - listener(arg); - }); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } -} + ch = bh; + cl = bl; -},{}],161:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer -var MD5 = require('md5.js') + bh = ah; + bl = al; -/* eslint-disable camelcase */ -function EVP_BytesToKey (password, salt, keyBits, ivLen) { - if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary') - if (salt) { - if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary') - if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length') + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); } - var keyLen = keyBits / 8 - var key = Buffer.alloc(keyLen) - var iv = Buffer.alloc(ivLen || 0) - var tmp = Buffer.alloc(0) - - while (keyLen > 0 || ivLen > 0) { - var hash = new MD5() - hash.update(tmp) - hash.update(password) - if (salt) hash.update(salt) - tmp = hash.digest() - - var used = 0 - - if (keyLen > 0) { - var keyStart = key.length - keyLen - used = Math.min(keyLen, tmp.length) - tmp.copy(key, keyStart, 0, used) - keyLen -= used - } + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; - if (used < tmp.length && ivLen > 0) { - var ivStart = iv.length - ivLen - var length = Math.min(ivLen, tmp.length - used) - tmp.copy(iv, ivStart, used, used + length) - ivLen -= length - } - } +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; - tmp.fill(0) - return { key: key, iv: iv } +function ch64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; } -module.exports = EVP_BytesToKey +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} -},{"md5.js":194,"safe-buffer":225}],162:[function(require,module,exports){ -'use strict'; +function maj64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} -/* ! - * Chai - getFuncName utility - * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com> - * MIT Licensed - */ +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} -/** - * ### .getFuncName(constructorFn) - * - * Returns the name of a function. - * When a non-function instance is passed, returns `null`. - * This also includes a polyfill function if `aFunc.name` is not defined. - * - * @name getFuncName - * @param {Function} funct - * @namespace Utils - * @api public - */ +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 -var toString = Function.prototype.toString; -var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; -function getFuncName(aFunc) { - if (typeof aFunc !== 'function') { - return null; - } + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} - var name = ''; - if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { - // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined - var match = toString.call(aFunc).match(functionNameMatch); - if (match) { - name = match[1]; - } - } else { - // If we've got a `name` property we just use it - name = aFunc.name; - } +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 - return name; + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; } -module.exports = getFuncName; - -},{}],163:[function(require,module,exports){ -'use strict' -var Buffer = require('safe-buffer').Buffer -var Transform = require('readable-stream').Transform -var inherits = require('inherits') +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 -function throwIfNotStringOrBuffer (val, prefix) { - if (!Buffer.isBuffer(val) && typeof val !== 'string') { - throw new TypeError(prefix + ' must be a string or a buffer') - } + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; } -function HashBase (blockSize) { - Transform.call(this) - - this._block = Buffer.allocUnsafe(blockSize) - this._blockSize = blockSize - this._blockOffset = 0 - this._length = [0, 0, 0, 0] +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 - this._finalized = false + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; } -inherits(HashBase, Transform) - -HashBase.prototype._transform = function (chunk, encoding, callback) { - var error = null - try { - this.update(chunk, encoding) - } catch (err) { - error = err - } +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); - callback(error) + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; } -HashBase.prototype._flush = function (callback) { - var error = null - try { - this.push(this.digest()) - } catch (err) { - error = err - } +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); - callback(error) + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; } -HashBase.prototype.update = function (data, encoding) { - throwIfNotStringOrBuffer(data, 'Data') - if (this._finalized) throw new Error('Digest already called') - if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); - // consume data - var block = this._block - var offset = 0 - while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] - this._update() - this._blockOffset = 0 - } - while (offset < data.length) block[this._blockOffset++] = data[offset++] + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} - // update length - for (var j = 0, carry = data.length * 8; carry > 0; ++j) { - this._length[j] += carry - carry = (this._length[j] / 0x0100000000) | 0 - if (carry > 0) this._length[j] -= 0x0100000000 * carry - } +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); - return this + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; } -HashBase.prototype._update = function () { - throw new Error('_update is not implemented') -} +},{"../common":175,"../utils":185,"minimalistic-assert":192}],184:[function(require,module,exports){ +'use strict'; -HashBase.prototype.digest = function (encoding) { - if (this._finalized) throw new Error('Digest already called') - this._finalized = true +var utils = require('../utils'); +var rotr32 = utils.rotr32; - var digest = this._digest() - if (encoding !== undefined) digest = digest.toString(encoding) +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} +exports.ft_1 = ft_1; - // reset state - this._block.fill(0) - this._blockOffset = 0 - for (var i = 0; i < 4; ++i) this._length[i] = 0 +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} +exports.ch32 = ch32; - return digest +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); } +exports.maj32 = maj32; -HashBase.prototype._digest = function () { - throw new Error('_digest is not implemented') +function p32(x, y, z) { + return x ^ y ^ z; } +exports.p32 = p32; -module.exports = HashBase +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} +exports.s0_256 = s0_256; -},{"inherits":193,"readable-stream":178,"safe-buffer":225}],164:[function(require,module,exports){ -arguments[4][71][0].apply(exports,arguments) -},{"dup":71}],165:[function(require,module,exports){ -arguments[4][72][0].apply(exports,arguments) -},{"./_stream_readable":167,"./_stream_writable":169,"_process":212,"dup":72,"inherits":193}],166:[function(require,module,exports){ -arguments[4][73][0].apply(exports,arguments) -},{"./_stream_transform":168,"dup":73,"inherits":193}],167:[function(require,module,exports){ -arguments[4][74][0].apply(exports,arguments) -},{"../errors":164,"./_stream_duplex":165,"./internal/streams/async_iterator":170,"./internal/streams/buffer_list":171,"./internal/streams/destroy":172,"./internal/streams/from":174,"./internal/streams/state":176,"./internal/streams/stream":177,"_process":212,"buffer":88,"dup":74,"events":160,"inherits":193,"string_decoder/":250,"util":43}],168:[function(require,module,exports){ -arguments[4][75][0].apply(exports,arguments) -},{"../errors":164,"./_stream_duplex":165,"dup":75,"inherits":193}],169:[function(require,module,exports){ -arguments[4][76][0].apply(exports,arguments) -},{"../errors":164,"./_stream_duplex":165,"./internal/streams/destroy":172,"./internal/streams/state":176,"./internal/streams/stream":177,"_process":212,"buffer":88,"dup":76,"inherits":193,"util-deprecate":253}],170:[function(require,module,exports){ -arguments[4][77][0].apply(exports,arguments) -},{"./end-of-stream":173,"_process":212,"dup":77}],171:[function(require,module,exports){ -arguments[4][78][0].apply(exports,arguments) -},{"buffer":88,"dup":78,"util":43}],172:[function(require,module,exports){ -arguments[4][79][0].apply(exports,arguments) -},{"_process":212,"dup":79}],173:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"../../../errors":164,"dup":80}],174:[function(require,module,exports){ -arguments[4][81][0].apply(exports,arguments) -},{"dup":81}],175:[function(require,module,exports){ -arguments[4][82][0].apply(exports,arguments) -},{"../../../errors":164,"./end-of-stream":173,"dup":82}],176:[function(require,module,exports){ -arguments[4][83][0].apply(exports,arguments) -},{"../../../errors":164,"dup":83}],177:[function(require,module,exports){ -arguments[4][84][0].apply(exports,arguments) -},{"dup":84,"events":160}],178:[function(require,module,exports){ -arguments[4][85][0].apply(exports,arguments) -},{"./lib/_stream_duplex.js":165,"./lib/_stream_passthrough.js":166,"./lib/_stream_readable.js":167,"./lib/_stream_transform.js":168,"./lib/_stream_writable.js":169,"./lib/internal/streams/end-of-stream.js":173,"./lib/internal/streams/pipeline.js":175,"dup":85}],179:[function(require,module,exports){ -var hash = exports; +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} +exports.s1_256 = s1_256; -hash.utils = require('./hash/utils'); -hash.common = require('./hash/common'); -hash.sha = require('./hash/sha'); -hash.ripemd = require('./hash/ripemd'); -hash.hmac = require('./hash/hmac'); +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} +exports.g0_256 = g0_256; -// Proxy hash functions to the main object -hash.sha1 = hash.sha.sha1; -hash.sha256 = hash.sha.sha256; -hash.sha224 = hash.sha.sha224; -hash.sha384 = hash.sha.sha384; -hash.sha512 = hash.sha.sha512; -hash.ripemd160 = hash.ripemd.ripemd160; +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} +exports.g1_256 = g1_256; -},{"./hash/common":180,"./hash/hmac":181,"./hash/ripemd":182,"./hash/sha":183,"./hash/utils":190}],180:[function(require,module,exports){ +},{"../utils":185}],185:[function(require,module,exports){ 'use strict'; -var utils = require('./utils'); var assert = require('minimalistic-assert'); +var inherits = require('inherits'); -function BlockHash() { - this.pending = null; - this.pendingTotal = 0; - this.blockSize = this.constructor.blockSize; - this.outSize = this.constructor.outSize; - this.hmacStrength = this.constructor.hmacStrength; - this.padLength = this.constructor.padLength / 8; - this.endian = 'big'; +exports.inherits = inherits; - this._delta8 = this.blockSize / 8; - this._delta32 = this.blockSize / 32; +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; } -exports.BlockHash = BlockHash; - -BlockHash.prototype.update = function update(msg, enc) { - // Convert message to array, pad it, and join into 32bit blocks - msg = utils.toArray(msg, enc); - if (!this.pending) - this.pending = msg; - else - this.pending = this.pending.concat(msg); - this.pendingTotal += msg.length; - - // Enough data, try updating - if (this.pending.length >= this._delta8) { - msg = this.pending; - // Process pending data in blocks - var r = msg.length % this._delta8; - this.pending = msg.slice(msg.length - r, msg.length); - if (this.pending.length === 0) - this.pending = null; - - msg = utils.join32(msg, 0, msg.length - r, this.endian); - for (var i = 0; i < msg.length; i += this._delta32) - this._update(msg, i, i + this._delta32); +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + // Inspired by stringToUtf8ByteArray() in closure-library by Google + // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 + // Apache License 2.0 + // https://github.com/google/closure-library/blob/master/LICENSE + var p = 0; + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = (c >> 6) | 192; + res[p++] = (c & 63) | 128; + } else if (isSurrogatePair(msg, i)) { + c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); + res[p++] = (c >> 18) | 240; + res[p++] = ((c >> 12) & 63) | 128; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } else { + res[p++] = (c >> 12) | 224; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; } + return res; +} +exports.toArray = toArray; - return this; -}; - -BlockHash.prototype.digest = function digest(enc) { - this.update(this._pad()); - assert(this.pending === null); +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +exports.toHex = toHex; - return this._digest(enc); -}; +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +exports.htonl = htonl; -BlockHash.prototype._pad = function pad() { - var len = this.pendingTotal; - var bytes = this._delta8; - var k = bytes - ((len + this.padLength) % bytes); - var res = new Array(k + this.padLength); - res[0] = 0x80; - for (var i = 1; i < k; i++) - res[i] = 0; +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +exports.toHex32 = toHex32; - // Append length - len <<= 3; - if (this.endian === 'big') { - for (var t = 8; t < this.padLength; t++) - res[i++] = 0; +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +exports.zero2 = zero2; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = (len >>> 24) & 0xff; - res[i++] = (len >>> 16) & 0xff; - res[i++] = (len >>> 8) & 0xff; - res[i++] = len & 0xff; - } else { - res[i++] = len & 0xff; - res[i++] = (len >>> 8) & 0xff; - res[i++] = (len >>> 16) & 0xff; - res[i++] = (len >>> 24) & 0xff; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; - res[i++] = 0; +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +exports.zero8 = zero8; - for (t = 8; t < this.padLength; t++) - res[i++] = 0; +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; } - return res; -}; +} +exports.join32 = join32; -},{"./utils":190,"minimalistic-assert":197}],181:[function(require,module,exports){ -'use strict'; +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +exports.split32 = split32; -var utils = require('./utils'); -var assert = require('minimalistic-assert'); +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +exports.rotr32 = rotr32; -function Hmac(hash, key, enc) { - if (!(this instanceof Hmac)) - return new Hmac(hash, key, enc); - this.Hash = hash; - this.blockSize = hash.blockSize / 8; - this.outSize = hash.outSize / 8; - this.inner = null; - this.outer = null; +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +exports.rotl32 = rotl32; - this._init(utils.toArray(key, enc)); +function sum32(a, b) { + return (a + b) >>> 0; } -module.exports = Hmac; +exports.sum32 = sum32; -Hmac.prototype._init = function init(key) { - // Shorten key, if needed - if (key.length > this.blockSize) - key = new this.Hash().update(key).digest(); - assert(key.length <= this.blockSize); +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +exports.sum32_3 = sum32_3; - // Add padding to key - for (var i = key.length; i < this.blockSize; i++) - key.push(0); +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +exports.sum32_4 = sum32_4; - for (i = 0; i < key.length; i++) - key[i] ^= 0x36; - this.inner = new this.Hash().update(key); +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +exports.sum32_5 = sum32_5; - // 0x36 ^ 0x5c = 0x6a - for (i = 0; i < key.length; i++) - key[i] ^= 0x6a; - this.outer = new this.Hash().update(key); -}; +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; -Hmac.prototype.update = function update(msg, enc) { - this.inner.update(msg, enc); - return this; -}; + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; -Hmac.prototype.digest = function digest(enc) { - this.outer.update(this.inner.digest()); - return this.outer.digest(enc); -}; +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +} +exports.sum64_hi = sum64_hi; -},{"./utils":190,"minimalistic-assert":197}],182:[function(require,module,exports){ -'use strict'; +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +} +exports.sum64_lo = sum64_lo; -var utils = require('./utils'); -var common = require('./common'); +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; -var rotl32 = utils.rotl32; -var sum32 = utils.sum32; -var sum32_3 = utils.sum32_3; -var sum32_4 = utils.sum32_4; -var BlockHash = common.BlockHash; + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +} +exports.sum64_4_hi = sum64_4_hi; -function RIPEMD160() { - if (!(this instanceof RIPEMD160)) - return new RIPEMD160(); +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +} +exports.sum64_4_lo = sum64_4_lo; - BlockHash.call(this); +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; - this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; - this.endian = 'little'; + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; } -utils.inherits(RIPEMD160, BlockHash); -exports.ripemd160 = RIPEMD160; - -RIPEMD160.blockSize = 512; -RIPEMD160.outSize = 160; -RIPEMD160.hmacStrength = 192; -RIPEMD160.padLength = 64; +exports.sum64_5_hi = sum64_5_hi; -RIPEMD160.prototype._update = function update(msg, start) { - var A = this.h[0]; - var B = this.h[1]; - var C = this.h[2]; - var D = this.h[3]; - var E = this.h[4]; - var Ah = A; - var Bh = B; - var Ch = C; - var Dh = D; - var Eh = E; - for (var j = 0; j < 80; j++) { - var T = sum32( - rotl32( - sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), - s[j]), - E); - A = E; - E = D; - D = rotl32(C, 10); - C = B; - B = T; - T = sum32( - rotl32( - sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), - sh[j]), - Eh); - Ah = Eh; - Eh = Dh; - Dh = rotl32(Ch, 10); - Ch = Bh; - Bh = T; - } - T = sum32_3(this.h[1], C, Dh); - this.h[1] = sum32_3(this.h[2], D, Eh); - this.h[2] = sum32_3(this.h[3], E, Ah); - this.h[3] = sum32_3(this.h[4], A, Bh); - this.h[4] = sum32_3(this.h[0], B, Ch); - this.h[0] = T; -}; +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; -RIPEMD160.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'little'); - else - return utils.split32(this.h, 'little'); -}; + return lo >>> 0; +} +exports.sum64_5_lo = sum64_5_lo; -function f(j, x, y, z) { - if (j <= 15) - return x ^ y ^ z; - else if (j <= 31) - return (x & y) | ((~x) & z); - else if (j <= 47) - return (x | (~y)) ^ z; - else if (j <= 63) - return (x & z) | (y & (~z)); - else - return x ^ (y | (~z)); +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; } +exports.rotr64_hi = rotr64_hi; -function K(j) { - if (j <= 15) - return 0x00000000; - else if (j <= 31) - return 0x5a827999; - else if (j <= 47) - return 0x6ed9eba1; - else if (j <= 63) - return 0x8f1bbcdc; - else - return 0xa953fd4e; +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; } +exports.rotr64_lo = rotr64_lo; -function Kh(j) { - if (j <= 15) - return 0x50a28be6; - else if (j <= 31) - return 0x5c4dd124; - else if (j <= 47) - return 0x6d703ef3; - else if (j <= 63) - return 0x7a6d76e9; - else - return 0x00000000; +function shr64_hi(ah, al, num) { + return ah >>> num; } +exports.shr64_hi = shr64_hi; -var r = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 -]; +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.shr64_lo = shr64_lo; -var rh = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 -]; +},{"inherits":188,"minimalistic-assert":192}],186:[function(require,module,exports){ +'use strict'; -var s = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 -]; +var hash = require('hash.js'); +var utils = require('minimalistic-crypto-utils'); +var assert = require('minimalistic-assert'); -var sh = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 -]; +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; -},{"./common":180,"./utils":190}],183:[function(require,module,exports){ -'use strict'; + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; -exports.sha1 = require('./sha/1'); -exports.sha224 = require('./sha/224'); -exports.sha256 = require('./sha/256'); -exports.sha384 = require('./sha/384'); -exports.sha512 = require('./sha/512'); + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; -},{"./sha/1":184,"./sha/224":185,"./sha/256":186,"./sha/384":187,"./sha/512":188}],184:[function(require,module,exports){ -'use strict'; + var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex'); + var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex'); + var pers = utils.toArray(options.pers, options.persEnc || 'hex'); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; -var utils = require('../utils'); -var common = require('../common'); -var shaCommon = require('./common'); +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); -var rotl32 = utils.rotl32; -var sum32 = utils.sum32; -var sum32_5 = utils.sum32_5; -var ft_1 = shaCommon.ft_1; -var BlockHash = common.BlockHash; + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } -var sha1_K = [ - 0x5A827999, 0x6ED9EBA1, - 0x8F1BBCDC, 0xCA62C1D6 -]; + this._update(seed); + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; -function SHA1() { - if (!(this instanceof SHA1)) - return new SHA1(); +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; - BlockHash.call(this); - this.h = [ - 0x67452301, 0xefcdab89, 0x98badcfe, - 0x10325476, 0xc3d2e1f0 ]; - this.W = new Array(80); -} +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; -utils.inherits(SHA1, BlockHash); -module.exports = SHA1; + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; -SHA1.blockSize = 512; -SHA1.outSize = 160; -SHA1.hmacStrength = 80; -SHA1.padLength = 64; +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } -SHA1.prototype._update = function _update(msg, start) { - var W = this.W; + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); - for (var i = 0; i < 16; i++) - W[i] = msg[start + i]; + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); - for(; i < W.length; i++) - W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + this._update(entropy.concat(add || [])); + this._reseed = 1; +}; - var a = this.h[0]; - var b = this.h[1]; - var c = this.h[2]; - var d = this.h[3]; - var e = this.h[4]; +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this._reseed > this.reseedInterval) + throw new Error('Reseed is required'); - for (i = 0; i < W.length; i++) { - var s = ~~(i / 20); - var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); - e = d; - d = c; - c = rotl32(b, 30); - b = a; - a = t; + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; } - this.h[0] = sum32(this.h[0], a); - this.h[1] = sum32(this.h[1], b); - this.h[2] = sum32(this.h[2], c); - this.h[3] = sum32(this.h[3], d); - this.h[4] = sum32(this.h[4], e); -}; + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc || 'hex'); + this._update(add); + } -SHA1.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this._reseed++; + return utils.encode(res, enc); }; -},{"../common":180,"../utils":190,"./common":189}],185:[function(require,module,exports){ -'use strict'; +},{"hash.js":174,"minimalistic-assert":192,"minimalistic-crypto-utils":193}],187:[function(require,module,exports){ +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] -var utils = require('../utils'); -var SHA256 = require('./256'); + i += d -function SHA224() { - if (!(this instanceof SHA224)) - return new SHA224(); + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - SHA256.call(this); - this.h = [ - 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, - 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } -utils.inherits(SHA224, SHA256); -module.exports = SHA224; -SHA224.blockSize = 512; -SHA224.outSize = 224; -SHA224.hmacStrength = 192; -SHA224.padLength = 64; +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 -SHA224.prototype._digest = function digest(enc) { - // Just truncate output - if (enc === 'hex') - return utils.toHex32(this.h.slice(0, 7), 'big'); - else - return utils.split32(this.h.slice(0, 7), 'big'); -}; + value = Math.abs(value) + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } -},{"../utils":190,"./256":186}],186:[function(require,module,exports){ -'use strict'; + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } -var utils = require('../utils'); -var common = require('../common'); -var shaCommon = require('./common'); -var assert = require('minimalistic-assert'); + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} -var sum32 = utils.sum32; -var sum32_4 = utils.sum32_4; -var sum32_5 = utils.sum32_5; -var ch32 = shaCommon.ch32; -var maj32 = shaCommon.maj32; -var s0_256 = shaCommon.s0_256; -var s1_256 = shaCommon.s1_256; -var g0_256 = shaCommon.g0_256; -var g1_256 = shaCommon.g1_256; + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} -var BlockHash = common.BlockHash; + buffer[offset + i - d] |= s * 128 +} -var sha256_K = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -]; +},{}],188:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} -function SHA256() { - if (!(this instanceof SHA256)) - return new SHA256(); +},{}],189:[function(require,module,exports){ +'use strict' +var inherits = require('inherits') +var HashBase = require('hash-base') +var Buffer = require('safe-buffer').Buffer - BlockHash.call(this); - this.h = [ - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 - ]; - this.k = sha256_K; - this.W = new Array(64); +var ARRAY16 = new Array(16) + +function MD5 () { + HashBase.call(this, 64) + + // state + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 } -utils.inherits(SHA256, BlockHash); -module.exports = SHA256; -SHA256.blockSize = 512; -SHA256.outSize = 256; -SHA256.hmacStrength = 192; -SHA256.padLength = 64; +inherits(MD5, HashBase) -SHA256.prototype._update = function _update(msg, start) { - var W = this.W; +MD5.prototype._update = function () { + var M = ARRAY16 + for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4) - for (var i = 0; i < 16; i++) - W[i] = msg[start + i]; - for (; i < W.length; i++) - W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + var a = this._a + var b = this._b + var c = this._c + var d = this._d - var a = this.h[0]; - var b = this.h[1]; - var c = this.h[2]; - var d = this.h[3]; - var e = this.h[4]; - var f = this.h[5]; - var g = this.h[6]; - var h = this.h[7]; + a = fnF(a, b, c, d, M[0], 0xd76aa478, 7) + d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12) + c = fnF(c, d, a, b, M[2], 0x242070db, 17) + b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22) + a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7) + d = fnF(d, a, b, c, M[5], 0x4787c62a, 12) + c = fnF(c, d, a, b, M[6], 0xa8304613, 17) + b = fnF(b, c, d, a, M[7], 0xfd469501, 22) + a = fnF(a, b, c, d, M[8], 0x698098d8, 7) + d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12) + c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17) + b = fnF(b, c, d, a, M[11], 0x895cd7be, 22) + a = fnF(a, b, c, d, M[12], 0x6b901122, 7) + d = fnF(d, a, b, c, M[13], 0xfd987193, 12) + c = fnF(c, d, a, b, M[14], 0xa679438e, 17) + b = fnF(b, c, d, a, M[15], 0x49b40821, 22) - assert(this.k.length === W.length); - for (i = 0; i < W.length; i++) { - var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); - var T2 = sum32(s0_256(a), maj32(a, b, c)); - h = g; - g = f; - f = e; - e = sum32(d, T1); - d = c; - c = b; - b = a; - a = sum32(T1, T2); - } + a = fnG(a, b, c, d, M[1], 0xf61e2562, 5) + d = fnG(d, a, b, c, M[6], 0xc040b340, 9) + c = fnG(c, d, a, b, M[11], 0x265e5a51, 14) + b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20) + a = fnG(a, b, c, d, M[5], 0xd62f105d, 5) + d = fnG(d, a, b, c, M[10], 0x02441453, 9) + c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14) + b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20) + a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5) + d = fnG(d, a, b, c, M[14], 0xc33707d6, 9) + c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14) + b = fnG(b, c, d, a, M[8], 0x455a14ed, 20) + a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5) + d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9) + c = fnG(c, d, a, b, M[7], 0x676f02d9, 14) + b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20) - this.h[0] = sum32(this.h[0], a); - this.h[1] = sum32(this.h[1], b); - this.h[2] = sum32(this.h[2], c); - this.h[3] = sum32(this.h[3], d); - this.h[4] = sum32(this.h[4], e); - this.h[5] = sum32(this.h[5], f); - this.h[6] = sum32(this.h[6], g); - this.h[7] = sum32(this.h[7], h); -}; + a = fnH(a, b, c, d, M[5], 0xfffa3942, 4) + d = fnH(d, a, b, c, M[8], 0x8771f681, 11) + c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16) + b = fnH(b, c, d, a, M[14], 0xfde5380c, 23) + a = fnH(a, b, c, d, M[1], 0xa4beea44, 4) + d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11) + c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16) + b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23) + a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4) + d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11) + c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16) + b = fnH(b, c, d, a, M[6], 0x04881d05, 23) + a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4) + d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11) + c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16) + b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23) + + a = fnI(a, b, c, d, M[0], 0xf4292244, 6) + d = fnI(d, a, b, c, M[7], 0x432aff97, 10) + c = fnI(c, d, a, b, M[14], 0xab9423a7, 15) + b = fnI(b, c, d, a, M[5], 0xfc93a039, 21) + a = fnI(a, b, c, d, M[12], 0x655b59c3, 6) + d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10) + c = fnI(c, d, a, b, M[10], 0xffeff47d, 15) + b = fnI(b, c, d, a, M[1], 0x85845dd1, 21) + a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6) + d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10) + c = fnI(c, d, a, b, M[6], 0xa3014314, 15) + b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21) + a = fnI(a, b, c, d, M[4], 0xf7537e82, 6) + d = fnI(d, a, b, c, M[11], 0xbd3af235, 10) + c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15) + b = fnI(b, c, d, a, M[9], 0xeb86d391, 21) + + this._a = (this._a + a) | 0 + this._b = (this._b + b) | 0 + this._c = (this._c + c) | 0 + this._d = (this._d + d) | 0 +} + +MD5.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset++] = 0x80 + if (this._blockOffset > 56) { + this._block.fill(0, this._blockOffset, 64) + this._update() + this._blockOffset = 0 + } -SHA256.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); -}; + this._block.fill(0, this._blockOffset, 56) + this._block.writeUInt32LE(this._length[0], 56) + this._block.writeUInt32LE(this._length[1], 60) + this._update() -},{"../common":180,"../utils":190,"./common":189,"minimalistic-assert":197}],187:[function(require,module,exports){ -'use strict'; + // produce result + var buffer = Buffer.allocUnsafe(16) + buffer.writeInt32LE(this._a, 0) + buffer.writeInt32LE(this._b, 4) + buffer.writeInt32LE(this._c, 8) + buffer.writeInt32LE(this._d, 12) + return buffer +} -var utils = require('../utils'); +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} -var SHA512 = require('./512'); +function fnF (a, b, c, d, m, k, s) { + return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0 +} -function SHA384() { - if (!(this instanceof SHA384)) - return new SHA384(); +function fnG (a, b, c, d, m, k, s) { + return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0 +} - SHA512.call(this); - this.h = [ - 0xcbbb9d5d, 0xc1059ed8, - 0x629a292a, 0x367cd507, - 0x9159015a, 0x3070dd17, - 0x152fecd8, 0xf70e5939, - 0x67332667, 0xffc00b31, - 0x8eb44a87, 0x68581511, - 0xdb0c2e0d, 0x64f98fa7, - 0x47b5481d, 0xbefa4fa4 ]; +function fnH (a, b, c, d, m, k, s) { + return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0 } -utils.inherits(SHA384, SHA512); -module.exports = SHA384; -SHA384.blockSize = 1024; -SHA384.outSize = 384; -SHA384.hmacStrength = 192; -SHA384.padLength = 128; +function fnI (a, b, c, d, m, k, s) { + return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0 +} -SHA384.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h.slice(0, 12), 'big'); - else - return utils.split32(this.h.slice(0, 12), 'big'); -}; +module.exports = MD5 -},{"../utils":190,"./512":188}],188:[function(require,module,exports){ -'use strict'; +},{"hash-base":158,"inherits":188,"safe-buffer":219}],190:[function(require,module,exports){ +var bn = require('bn.js'); +var brorand = require('brorand'); -var utils = require('../utils'); -var common = require('../common'); -var assert = require('minimalistic-assert'); +function MillerRabin(rand) { + this.rand = rand || new brorand.Rand(); +} +module.exports = MillerRabin; -var rotr64_hi = utils.rotr64_hi; -var rotr64_lo = utils.rotr64_lo; -var shr64_hi = utils.shr64_hi; -var shr64_lo = utils.shr64_lo; -var sum64 = utils.sum64; -var sum64_hi = utils.sum64_hi; -var sum64_lo = utils.sum64_lo; -var sum64_4_hi = utils.sum64_4_hi; -var sum64_4_lo = utils.sum64_4_lo; -var sum64_5_hi = utils.sum64_5_hi; -var sum64_5_lo = utils.sum64_5_lo; +MillerRabin.create = function create(rand) { + return new MillerRabin(rand); +}; -var BlockHash = common.BlockHash; +MillerRabin.prototype._randbelow = function _randbelow(n) { + var len = n.bitLength(); + var min_bytes = Math.ceil(len / 8); -var sha512_K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -]; + // Generage random bytes until a number less than n is found. + // This ensures that 0..n-1 have an equal probability of being selected. + do + var a = new bn(this.rand.generate(min_bytes)); + while (a.cmp(n) >= 0); -function SHA512() { - if (!(this instanceof SHA512)) - return new SHA512(); + return a; +}; - BlockHash.call(this); - this.h = [ - 0x6a09e667, 0xf3bcc908, - 0xbb67ae85, 0x84caa73b, - 0x3c6ef372, 0xfe94f82b, - 0xa54ff53a, 0x5f1d36f1, - 0x510e527f, 0xade682d1, - 0x9b05688c, 0x2b3e6c1f, - 0x1f83d9ab, 0xfb41bd6b, - 0x5be0cd19, 0x137e2179 ]; - this.k = sha512_K; - this.W = new Array(160); -} -utils.inherits(SHA512, BlockHash); -module.exports = SHA512; +MillerRabin.prototype._randrange = function _randrange(start, stop) { + // Generate a random number greater than or equal to start and less than stop. + var size = stop.sub(start); + return start.add(this._randbelow(size)); +}; -SHA512.blockSize = 1024; -SHA512.outSize = 512; -SHA512.hmacStrength = 192; -SHA512.padLength = 128; +MillerRabin.prototype.test = function test(n, k, cb) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); -SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { - var W = this.W; + if (!k) + k = Math.max(1, (len / 48) | 0); - // 32 x 32bit words - for (var i = 0; i < 32; i++) - W[i] = msg[start + i]; - for (; i < W.length; i += 2) { - var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 - var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); - var c1_hi = W[i - 14]; // i - 7 - var c1_lo = W[i - 13]; - var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 - var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); - var c3_hi = W[i - 32]; // i - 16 - var c3_lo = W[i - 31]; + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); - W[i] = sum64_4_hi( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo); - W[i + 1] = sum64_4_lo( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo); - } -}; + var rn1 = n1.toRed(red); -SHA512.prototype._update = function _update(msg, start) { - this._prepareBlock(msg, start); + var prime = true; + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); + if (cb) + cb(a); - var W = this.W; + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; - var ah = this.h[0]; - var al = this.h[1]; - var bh = this.h[2]; - var bl = this.h[3]; - var ch = this.h[4]; - var cl = this.h[5]; - var dh = this.h[6]; - var dl = this.h[7]; - var eh = this.h[8]; - var el = this.h[9]; - var fh = this.h[10]; - var fl = this.h[11]; - var gh = this.h[12]; - var gl = this.h[13]; - var hh = this.h[14]; - var hl = this.h[15]; + for (var i = 1; i < s; i++) { + x = x.redSqr(); - assert(this.k.length === W.length); - for (var i = 0; i < W.length; i += 2) { - var c0_hi = hh; - var c0_lo = hl; - var c1_hi = s1_512_hi(eh, el); - var c1_lo = s1_512_lo(eh, el); - var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); - var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); - var c3_hi = this.k[i]; - var c3_lo = this.k[i + 1]; - var c4_hi = W[i]; - var c4_lo = W[i + 1]; + if (x.cmp(rone) === 0) + return false; + if (x.cmp(rn1) === 0) + break; + } - var T1_hi = sum64_5_hi( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo, - c4_hi, c4_lo); - var T1_lo = sum64_5_lo( - c0_hi, c0_lo, - c1_hi, c1_lo, - c2_hi, c2_lo, - c3_hi, c3_lo, - c4_hi, c4_lo); + if (i === s) + return false; + } - c0_hi = s0_512_hi(ah, al); - c0_lo = s0_512_lo(ah, al); - c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); - c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + return prime; +}; - var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); - var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); +MillerRabin.prototype.getDivisor = function getDivisor(n, k) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); - hh = gh; - hl = gl; + if (!k) + k = Math.max(1, (len / 48) | 0); - gh = fh; - gl = fl; + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); - fh = eh; - fl = el; + var rn1 = n1.toRed(red); - eh = sum64_hi(dh, dl, T1_hi, T1_lo); - el = sum64_lo(dl, dl, T1_hi, T1_lo); + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); - dh = ch; - dl = cl; + var g = n.gcd(a); + if (g.cmpn(1) !== 0) + return g; - ch = bh; - cl = bl; + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; - bh = ah; - bl = al; + for (var i = 1; i < s; i++) { + x = x.redSqr(); - ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); - al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + if (x.cmp(rone) === 0) + return x.fromRed().subn(1).gcd(n); + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) { + x = x.redSqr(); + return x.fromRed().subn(1).gcd(n); + } } - sum64(this.h, 0, ah, al); - sum64(this.h, 2, bh, bl); - sum64(this.h, 4, ch, cl); - sum64(this.h, 6, dh, dl); - sum64(this.h, 8, eh, el); - sum64(this.h, 10, fh, fl); - sum64(this.h, 12, gh, gl); - sum64(this.h, 14, hh, hl); + return false; }; -SHA512.prototype._digest = function digest(enc) { - if (enc === 'hex') - return utils.toHex32(this.h, 'big'); - else - return utils.split32(this.h, 'big'); -}; +},{"bn.js":191,"brorand":38}],191:[function(require,module,exports){ +arguments[4][33][0].apply(exports,arguments) +},{"buffer":39,"dup":33}],192:[function(require,module,exports){ +module.exports = assert; -function ch64_hi(xh, xl, yh, yl, zh) { - var r = (xh & yh) ^ ((~xh) & zh); - if (r < 0) - r += 0x100000000; - return r; +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); } -function ch64_lo(xh, xl, yh, yl, zh, zl) { - var r = (xl & yl) ^ ((~xl) & zl); - if (r < 0) - r += 0x100000000; - return r; +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; + +},{}],193:[function(require,module,exports){ +'use strict'; + +var utils = exports; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg !== 'string') { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + return res; + } + if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } else { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } + return res; } +utils.toArray = toArray; -function maj64_hi(xh, xl, yh, yl, zh) { - var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); - if (r < 0) - r += 0x100000000; - return r; +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; } +utils.zero2 = zero2; -function maj64_lo(xh, xl, yh, yl, zh, zl) { - var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); - if (r < 0) - r += 0x100000000; - return r; +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; } +utils.toHex = toHex; -function s0_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 28); - var c1_hi = rotr64_hi(xl, xh, 2); // 34 - var c2_hi = rotr64_hi(xl, xh, 7); // 39 +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; +},{}],194:[function(require,module,exports){ +module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", +"2.16.840.1.101.3.4.1.2": "aes-128-cbc", +"2.16.840.1.101.3.4.1.3": "aes-128-ofb", +"2.16.840.1.101.3.4.1.4": "aes-128-cfb", +"2.16.840.1.101.3.4.1.21": "aes-192-ecb", +"2.16.840.1.101.3.4.1.22": "aes-192-cbc", +"2.16.840.1.101.3.4.1.23": "aes-192-ofb", +"2.16.840.1.101.3.4.1.24": "aes-192-cfb", +"2.16.840.1.101.3.4.1.41": "aes-256-ecb", +"2.16.840.1.101.3.4.1.42": "aes-256-cbc", +"2.16.840.1.101.3.4.1.43": "aes-256-ofb", +"2.16.840.1.101.3.4.1.44": "aes-256-cfb" } +},{}],195:[function(require,module,exports){ +// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js +// Fedor, you are amazing. +'use strict' -function s0_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 28); - var c1_lo = rotr64_lo(xl, xh, 2); // 34 - var c2_lo = rotr64_lo(xl, xh, 7); // 39 +var asn1 = require('asn1.js') - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} +exports.certificate = require('./certificate') -function s1_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 14); - var c1_hi = rotr64_hi(xh, xl, 18); - var c2_hi = rotr64_hi(xl, xh, 9); // 41 +var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('modulus').int(), + this.key('publicExponent').int(), + this.key('privateExponent').int(), + this.key('prime1').int(), + this.key('prime2').int(), + this.key('exponent1').int(), + this.key('exponent2').int(), + this.key('coefficient').int() + ) +}) +exports.RSAPrivateKey = RSAPrivateKey - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} +var RSAPublicKey = asn1.define('RSAPublicKey', function () { + this.seq().obj( + this.key('modulus').int(), + this.key('publicExponent').int() + ) +}) +exports.RSAPublicKey = RSAPublicKey -function s1_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 14); - var c1_lo = rotr64_lo(xh, xl, 18); - var c2_lo = rotr64_lo(xl, xh, 9); // 41 +var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ) +}) +exports.PublicKey = PublicKey - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('none').null_().optional(), + this.key('curve').objid().optional(), + this.key('params').seq().obj( + this.key('p').int(), + this.key('q').int(), + this.key('g').int() + ).optional() + ) +}) -function g0_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 1); - var c1_hi = rotr64_hi(xh, xl, 8); - var c2_hi = shr64_hi(xh, xl, 7); +var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { + this.seq().obj( + this.key('version').int(), + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPrivateKey').octstr() + ) +}) +exports.PrivateKey = PrivateKeyInfo +var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { + this.seq().obj( + this.key('algorithm').seq().obj( + this.key('id').objid(), + this.key('decrypt').seq().obj( + this.key('kde').seq().obj( + this.key('id').objid(), + this.key('kdeparams').seq().obj( + this.key('salt').octstr(), + this.key('iters').int() + ) + ), + this.key('cipher').seq().obj( + this.key('algo').objid(), + this.key('iv').octstr() + ) + ) + ), + this.key('subjectPrivateKey').octstr() + ) +}) - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} +exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo -function g0_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 1); - var c1_lo = rotr64_lo(xh, xl, 8); - var c2_lo = shr64_lo(xh, xl, 7); +var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('p').int(), + this.key('q').int(), + this.key('g').int(), + this.key('pub_key').int(), + this.key('priv_key').int() + ) +}) +exports.DSAPrivateKey = DSAPrivateKey - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} +exports.DSAparam = asn1.define('DSAparam', function () { + this.int() +}) -function g1_512_hi(xh, xl) { - var c0_hi = rotr64_hi(xh, xl, 19); - var c1_hi = rotr64_hi(xl, xh, 29); // 61 - var c2_hi = shr64_hi(xh, xl, 6); +var ECPrivateKey = asn1.define('ECPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('privateKey').octstr(), + this.key('parameters').optional().explicit(0).use(ECParameters), + this.key('publicKey').optional().explicit(1).bitstr() + ) +}) +exports.ECPrivateKey = ECPrivateKey - var r = c0_hi ^ c1_hi ^ c2_hi; - if (r < 0) - r += 0x100000000; - return r; -} +var ECParameters = asn1.define('ECParameters', function () { + this.choice({ + namedCurve: this.objid() + }) +}) -function g1_512_lo(xh, xl) { - var c0_lo = rotr64_lo(xh, xl, 19); - var c1_lo = rotr64_lo(xl, xh, 29); // 61 - var c2_lo = shr64_lo(xh, xl, 6); +exports.signature = asn1.define('signature', function () { + this.seq().obj( + this.key('r').int(), + this.key('s').int() + ) +}) - var r = c0_lo ^ c1_lo ^ c2_lo; - if (r < 0) - r += 0x100000000; - return r; -} +},{"./certificate":196,"asn1.js":19}],196:[function(require,module,exports){ +// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js +// thanks to @Rantanen -},{"../common":180,"../utils":190,"minimalistic-assert":197}],189:[function(require,module,exports){ -'use strict'; +'use strict' -var utils = require('../utils'); -var rotr32 = utils.rotr32; +var asn = require('asn1.js') -function ft_1(s, x, y, z) { - if (s === 0) - return ch32(x, y, z); - if (s === 1 || s === 3) - return p32(x, y, z); - if (s === 2) - return maj32(x, y, z); -} -exports.ft_1 = ft_1; +var Time = asn.define('Time', function () { + this.choice({ + utcTime: this.utctime(), + generalTime: this.gentime() + }) +}) -function ch32(x, y, z) { - return (x & y) ^ ((~x) & z); -} -exports.ch32 = ch32; +var AttributeTypeValue = asn.define('AttributeTypeValue', function () { + this.seq().obj( + this.key('type').objid(), + this.key('value').any() + ) +}) -function maj32(x, y, z) { - return (x & y) ^ (x & z) ^ (y & z); -} -exports.maj32 = maj32; +var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('parameters').optional(), + this.key('curve').objid().optional() + ) +}) -function p32(x, y, z) { - return x ^ y ^ z; -} -exports.p32 = p32; +var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ) +}) -function s0_256(x) { - return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); -} -exports.s0_256 = s0_256; +var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () { + this.setof(AttributeTypeValue) +}) -function s1_256(x) { - return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); -} -exports.s1_256 = s1_256; +var RDNSequence = asn.define('RDNSequence', function () { + this.seqof(RelativeDistinguishedName) +}) -function g0_256(x) { - return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); -} -exports.g0_256 = g0_256; +var Name = asn.define('Name', function () { + this.choice({ + rdnSequence: this.use(RDNSequence) + }) +}) -function g1_256(x) { - return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); -} -exports.g1_256 = g1_256; +var Validity = asn.define('Validity', function () { + this.seq().obj( + this.key('notBefore').use(Time), + this.key('notAfter').use(Time) + ) +}) -},{"../utils":190}],190:[function(require,module,exports){ -'use strict'; +var Extension = asn.define('Extension', function () { + this.seq().obj( + this.key('extnID').objid(), + this.key('critical').bool().def(false), + this.key('extnValue').octstr() + ) +}) -var assert = require('minimalistic-assert'); -var inherits = require('inherits'); +var TBSCertificate = asn.define('TBSCertificate', function () { + this.seq().obj( + this.key('version').explicit(0).int().optional(), + this.key('serialNumber').int(), + this.key('signature').use(AlgorithmIdentifier), + this.key('issuer').use(Name), + this.key('validity').use(Validity), + this.key('subject').use(Name), + this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), + this.key('issuerUniqueID').implicit(1).bitstr().optional(), + this.key('subjectUniqueID').implicit(2).bitstr().optional(), + this.key('extensions').explicit(3).seqof(Extension).optional() + ) +}) -exports.inherits = inherits; +var X509Certificate = asn.define('X509Certificate', function () { + this.seq().obj( + this.key('tbsCertificate').use(TBSCertificate), + this.key('signatureAlgorithm').use(AlgorithmIdentifier), + this.key('signatureValue').bitstr() + ) +}) -function isSurrogatePair(msg, i) { - if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { - return false; - } - if (i < 0 || i + 1 >= msg.length) { - return false; - } - return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; -} +module.exports = X509Certificate -function toArray(msg, enc) { - if (Array.isArray(msg)) - return msg.slice(); - if (!msg) - return []; - var res = []; - if (typeof msg === 'string') { - if (!enc) { - // Inspired by stringToUtf8ByteArray() in closure-library by Google - // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 - // Apache License 2.0 - // https://github.com/google/closure-library/blob/master/LICENSE - var p = 0; - for (var i = 0; i < msg.length; i++) { - var c = msg.charCodeAt(i); - if (c < 128) { - res[p++] = c; - } else if (c < 2048) { - res[p++] = (c >> 6) | 192; - res[p++] = (c & 63) | 128; - } else if (isSurrogatePair(msg, i)) { - c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); - res[p++] = (c >> 18) | 240; - res[p++] = ((c >> 12) & 63) | 128; - res[p++] = ((c >> 6) & 63) | 128; - res[p++] = (c & 63) | 128; - } else { - res[p++] = (c >> 12) | 224; - res[p++] = ((c >> 6) & 63) | 128; - res[p++] = (c & 63) | 128; - } - } - } else if (enc === 'hex') { - msg = msg.replace(/[^a-z0-9]+/ig, ''); - if (msg.length % 2 !== 0) - msg = '0' + msg; - for (i = 0; i < msg.length; i += 2) - res.push(parseInt(msg[i] + msg[i + 1], 16)); - } +},{"asn1.js":19}],197:[function(require,module,exports){ +// adapted from https://github.com/apatil/pemstrip +var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m +var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m +var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m +var evp = require('evp_bytestokey') +var ciphers = require('browserify-aes') +var Buffer = require('safe-buffer').Buffer +module.exports = function (okey, password) { + var key = okey.toString() + var match = key.match(findProc) + var decrypted + if (!match) { + var match2 = key.match(fullRegex) + decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64') } else { - for (i = 0; i < msg.length; i++) - res[i] = msg[i] | 0; + var suite = 'aes' + match[1] + var iv = Buffer.from(match[2], 'hex') + var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64') + var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key + var out = [] + var cipher = ciphers.createDecipheriv(suite, cipherKey, iv) + out.push(cipher.update(cipherText)) + out.push(cipher.final()) + decrypted = Buffer.concat(out) + } + var tag = key.match(startRegex)[1] + return { + tag: tag, + data: decrypted } - return res; } -exports.toArray = toArray; -function toHex(msg) { - var res = ''; - for (var i = 0; i < msg.length; i++) - res += zero2(msg[i].toString(16)); - return res; -} -exports.toHex = toHex; +},{"browserify-aes":42,"evp_bytestokey":156,"safe-buffer":219}],198:[function(require,module,exports){ +var asn1 = require('./asn1') +var aesid = require('./aesid.json') +var fixProc = require('./fixProc') +var ciphers = require('browserify-aes') +var compat = require('pbkdf2') +var Buffer = require('safe-buffer').Buffer +module.exports = parseKeys -function htonl(w) { - var res = (w >>> 24) | - ((w >>> 8) & 0xff00) | - ((w << 8) & 0xff0000) | - ((w & 0xff) << 24); - return res >>> 0; -} -exports.htonl = htonl; +function parseKeys (buffer) { + var password + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase + buffer = buffer.key + } + if (typeof buffer === 'string') { + buffer = Buffer.from(buffer) + } -function toHex32(msg, endian) { - var res = ''; - for (var i = 0; i < msg.length; i++) { - var w = msg[i]; - if (endian === 'little') - w = htonl(w); - res += zero8(w.toString(16)); + var stripped = fixProc(buffer, password) + + var type = stripped.tag + var data = stripped.data + var subtype, ndata + switch (type) { + case 'CERTIFICATE': + ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo + // falls through + case 'PUBLIC KEY': + if (!ndata) { + ndata = asn1.PublicKey.decode(data, 'der') + } + subtype = ndata.algorithm.algorithm.join('.') + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der') + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey + return { + type: 'ec', + data: ndata + } + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der') + return { + type: 'dsa', + data: ndata.algorithm.params + } + default: throw new Error('unknown key id ' + subtype) + } + // throw new Error('unknown key type ' + type) + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der') + data = decrypt(data, password) + // falls through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der') + subtype = ndata.algorithm.algorithm.join('.') + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der') + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + } + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der') + return { + type: 'dsa', + params: ndata.algorithm.params + } + default: throw new Error('unknown key id ' + subtype) + } + // throw new Error('unknown key type ' + type) + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der') + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der') + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + } + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der') + return { + curve: data.parameters.value, + privateKey: data.privateKey + } + default: throw new Error('unknown key type ' + type) } - return res; } -exports.toHex32 = toHex32; - -function zero2(word) { - if (word.length === 1) - return '0' + word; - else - return word; +parseKeys.signature = asn1.signature +function decrypt (data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt + var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10) + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')] + var iv = data.algorithm.decrypt.cipher.iv + var cipherText = data.subjectPrivateKey + var keylen = parseInt(algo.split('-')[1], 10) / 8 + var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1') + var cipher = ciphers.createDecipheriv(algo, key, iv) + var out = [] + out.push(cipher.update(cipherText)) + out.push(cipher.final()) + return Buffer.concat(out) } -exports.zero2 = zero2; -function zero8(word) { - if (word.length === 7) - return '0' + word; - else if (word.length === 6) - return '00' + word; - else if (word.length === 5) - return '000' + word; - else if (word.length === 4) - return '0000' + word; - else if (word.length === 3) - return '00000' + word; - else if (word.length === 2) - return '000000' + word; - else if (word.length === 1) - return '0000000' + word; - else - return word; -} -exports.zero8 = zero8; +},{"./aesid.json":194,"./asn1":195,"./fixProc":197,"browserify-aes":42,"pbkdf2":200,"safe-buffer":219}],199:[function(require,module,exports){ +'use strict'; -function join32(msg, start, end, endian) { - var len = end - start; - assert(len % 4 === 0); - var res = new Array(len / 4); - for (var i = 0, k = start; i < res.length; i++, k += 4) { - var w; - if (endian === 'big') - w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; - else - w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; - res[i] = w >>> 0; - } - return res; -} -exports.join32 = join32; +/* ! + * Chai - pathval utility + * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> + * @see https://github.com/logicalparadox/filtr + * MIT Licensed + */ -function split32(msg, endian) { - var res = new Array(msg.length * 4); - for (var i = 0, k = 0; i < msg.length; i++, k += 4) { - var m = msg[i]; - if (endian === 'big') { - res[k] = m >>> 24; - res[k + 1] = (m >>> 16) & 0xff; - res[k + 2] = (m >>> 8) & 0xff; - res[k + 3] = m & 0xff; - } else { - res[k + 3] = m >>> 24; - res[k + 2] = (m >>> 16) & 0xff; - res[k + 1] = (m >>> 8) & 0xff; - res[k] = m & 0xff; - } - } - return res; -} -exports.split32 = split32; +/** + * ### .hasProperty(object, name) + * + * This allows checking whether an object has own + * or inherited from prototype chain named property. + * + * Basically does the same thing as the `in` + * operator but works properly with null/undefined values + * and other primitives. + * + * var obj = { + * arr: ['a', 'b', 'c'] + * , str: 'Hello' + * } + * + * The following would be the results. + * + * hasProperty(obj, 'str'); // true + * hasProperty(obj, 'constructor'); // true + * hasProperty(obj, 'bar'); // false + * + * hasProperty(obj.str, 'length'); // true + * hasProperty(obj.str, 1); // true + * hasProperty(obj.str, 5); // false + * + * hasProperty(obj.arr, 'length'); // true + * hasProperty(obj.arr, 2); // true + * hasProperty(obj.arr, 3); // false + * + * @param {Object} object + * @param {String|Symbol} name + * @returns {Boolean} whether it exists + * @namespace Utils + * @name hasProperty + * @api public + */ -function rotr32(w, b) { - return (w >>> b) | (w << (32 - b)); -} -exports.rotr32 = rotr32; +function hasProperty(obj, name) { + if (typeof obj === 'undefined' || obj === null) { + return false; + } -function rotl32(w, b) { - return (w << b) | (w >>> (32 - b)); + // The `in` operator does not work with primitives. + return name in Object(obj); } -exports.rotl32 = rotl32; -function sum32(a, b) { - return (a + b) >>> 0; -} -exports.sum32 = sum32; +/* ! + * ## parsePath(path) + * + * Helper function used to parse string object + * paths. Use in conjunction with `internalGetPathValue`. + * + * var parsed = parsePath('myobject.property.subprop'); + * + * ### Paths: + * + * * Can be infinitely deep and nested. + * * Arrays are also valid using the formal `myobject.document[3].property`. + * * Literal dots and brackets (not delimiter) must be backslash-escaped. + * + * @param {String} path + * @returns {Object} parsed + * @api private + */ -function sum32_3(a, b, c) { - return (a + b + c) >>> 0; -} -exports.sum32_3 = sum32_3; +function parsePath(path) { + var str = path.replace(/([^\\])\[/g, '$1.['); + var parts = str.match(/(\\\.|[^.]+?)+/g); + return parts.map(function mapMatches(value) { + if ( + value === 'constructor' || + value === '__proto__' || + value === 'prototype' + ) { + return {}; + } + var regexp = /^\[(\d+)\]$/; + var mArr = regexp.exec(value); + var parsed = null; + if (mArr) { + parsed = { i: parseFloat(mArr[1]) }; + } else { + parsed = { p: value.replace(/\\([.[\]])/g, '$1') }; + } -function sum32_4(a, b, c, d) { - return (a + b + c + d) >>> 0; + return parsed; + }); } -exports.sum32_4 = sum32_4; -function sum32_5(a, b, c, d, e) { - return (a + b + c + d + e) >>> 0; -} -exports.sum32_5 = sum32_5; +/* ! + * ## internalGetPathValue(obj, parsed[, pathDepth]) + * + * Helper companion function for `.parsePath` that returns + * the value located at the parsed address. + * + * var value = getPathValue(obj, parsed); + * + * @param {Object} object to search against + * @param {Object} parsed definition from `parsePath`. + * @param {Number} depth (nesting level) of the property we want to retrieve + * @returns {Object|Undefined} value + * @api private + */ -function sum64(buf, pos, ah, al) { - var bh = buf[pos]; - var bl = buf[pos + 1]; +function internalGetPathValue(obj, parsed, pathDepth) { + var temporaryValue = obj; + var res = null; + pathDepth = typeof pathDepth === 'undefined' ? parsed.length : pathDepth; - var lo = (al + bl) >>> 0; - var hi = (lo < al ? 1 : 0) + ah + bh; - buf[pos] = hi >>> 0; - buf[pos + 1] = lo; -} -exports.sum64 = sum64; + for (var i = 0; i < pathDepth; i++) { + var part = parsed[i]; + if (temporaryValue) { + if (typeof part.p === 'undefined') { + temporaryValue = temporaryValue[part.i]; + } else { + temporaryValue = temporaryValue[part.p]; + } -function sum64_hi(ah, al, bh, bl) { - var lo = (al + bl) >>> 0; - var hi = (lo < al ? 1 : 0) + ah + bh; - return hi >>> 0; -} -exports.sum64_hi = sum64_hi; + if (i === pathDepth - 1) { + res = temporaryValue; + } + } + } -function sum64_lo(ah, al, bh, bl) { - var lo = al + bl; - return lo >>> 0; + return res; } -exports.sum64_lo = sum64_lo; -function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { - var carry = 0; - var lo = al; - lo = (lo + bl) >>> 0; - carry += lo < al ? 1 : 0; - lo = (lo + cl) >>> 0; - carry += lo < cl ? 1 : 0; - lo = (lo + dl) >>> 0; - carry += lo < dl ? 1 : 0; +/* ! + * ## internalSetPathValue(obj, value, parsed) + * + * Companion function for `parsePath` that sets + * the value located at a parsed address. + * + * internalSetPathValue(obj, 'value', parsed); + * + * @param {Object} object to search and define on + * @param {*} value to use upon set + * @param {Object} parsed definition from `parsePath` + * @api private + */ - var hi = ah + bh + ch + dh + carry; - return hi >>> 0; -} -exports.sum64_4_hi = sum64_4_hi; +function internalSetPathValue(obj, val, parsed) { + var tempObj = obj; + var pathDepth = parsed.length; + var part = null; + // Here we iterate through every part of the path + for (var i = 0; i < pathDepth; i++) { + var propName = null; + var propVal = null; + part = parsed[i]; -function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { - var lo = al + bl + cl + dl; - return lo >>> 0; + // If it's the last part of the path, we set the 'propName' value with the property name + if (i === pathDepth - 1) { + propName = typeof part.p === 'undefined' ? part.i : part.p; + // Now we set the property with the name held by 'propName' on object with the desired val + tempObj[propName] = val; + } else if (typeof part.p !== 'undefined' && tempObj[part.p]) { + tempObj = tempObj[part.p]; + } else if (typeof part.i !== 'undefined' && tempObj[part.i]) { + tempObj = tempObj[part.i]; + } else { + // If the obj doesn't have the property we create one with that name to define it + var next = parsed[i + 1]; + // Here we set the name of the property which will be defined + propName = typeof part.p === 'undefined' ? part.i : part.p; + // Here we decide if this property will be an array or a new object + propVal = typeof next.p === 'undefined' ? [] : {}; + tempObj[propName] = propVal; + tempObj = tempObj[propName]; + } + } } -exports.sum64_4_lo = sum64_4_lo; - -function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { - var carry = 0; - var lo = al; - lo = (lo + bl) >>> 0; - carry += lo < al ? 1 : 0; - lo = (lo + cl) >>> 0; - carry += lo < cl ? 1 : 0; - lo = (lo + dl) >>> 0; - carry += lo < dl ? 1 : 0; - lo = (lo + el) >>> 0; - carry += lo < el ? 1 : 0; - var hi = ah + bh + ch + dh + eh + carry; - return hi >>> 0; -} -exports.sum64_5_hi = sum64_5_hi; +/** + * ### .getPathInfo(object, path) + * + * This allows the retrieval of property info in an + * object given a string path. + * + * The path info consists of an object with the + * following properties: + * + * * parent - The parent object of the property referenced by `path` + * * name - The name of the final property, a number if it was an array indexer + * * value - The value of the property, if it exists, otherwise `undefined` + * * exists - Whether the property exists or not + * + * @param {Object} object + * @param {String} path + * @returns {Object} info + * @namespace Utils + * @name getPathInfo + * @api public + */ -function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { - var lo = al + bl + cl + dl + el; +function getPathInfo(obj, path) { + var parsed = parsePath(path); + var last = parsed[parsed.length - 1]; + var info = { + parent: + parsed.length > 1 ? + internalGetPathValue(obj, parsed, parsed.length - 1) : + obj, + name: last.p || last.i, + value: internalGetPathValue(obj, parsed), + }; + info.exists = hasProperty(info.parent, info.name); - return lo >>> 0; + return info; } -exports.sum64_5_lo = sum64_5_lo; -function rotr64_hi(ah, al, num) { - var r = (al << (32 - num)) | (ah >>> num); - return r >>> 0; -} -exports.rotr64_hi = rotr64_hi; +/** + * ### .getPathValue(object, path) + * + * This allows the retrieval of values in an + * object given a string path. + * + * var obj = { + * prop1: { + * arr: ['a', 'b', 'c'] + * , str: 'Hello' + * } + * , prop2: { + * arr: [ { nested: 'Universe' } ] + * , str: 'Hello again!' + * } + * } + * + * The following would be the results. + * + * getPathValue(obj, 'prop1.str'); // Hello + * getPathValue(obj, 'prop1.att[2]'); // b + * getPathValue(obj, 'prop2.arr[0].nested'); // Universe + * + * @param {Object} object + * @param {String} path + * @returns {Object} value or `undefined` + * @namespace Utils + * @name getPathValue + * @api public + */ -function rotr64_lo(ah, al, num) { - var r = (ah << (32 - num)) | (al >>> num); - return r >>> 0; +function getPathValue(obj, path) { + var info = getPathInfo(obj, path); + return info.value; } -exports.rotr64_lo = rotr64_lo; -function shr64_hi(ah, al, num) { - return ah >>> num; -} -exports.shr64_hi = shr64_hi; +/** + * ### .setPathValue(object, path, value) + * + * Define the value in an object at a given string path. + * + * ```js + * var obj = { + * prop1: { + * arr: ['a', 'b', 'c'] + * , str: 'Hello' + * } + * , prop2: { + * arr: [ { nested: 'Universe' } ] + * , str: 'Hello again!' + * } + * }; + * ``` + * + * The following would be acceptable. + * + * ```js + * var properties = require('tea-properties'); + * properties.set(obj, 'prop1.str', 'Hello Universe!'); + * properties.set(obj, 'prop1.arr[2]', 'B'); + * properties.set(obj, 'prop2.arr[0].nested.value', { hello: 'universe' }); + * ``` + * + * @param {Object} object + * @param {String} path + * @param {Mixed} value + * @api private + */ -function shr64_lo(ah, al, num) { - var r = (ah << (32 - num)) | (al >>> num); - return r >>> 0; +function setPathValue(obj, path, val) { + var parsed = parsePath(path); + internalSetPathValue(obj, val, parsed); + return obj; } -exports.shr64_lo = shr64_lo; - -},{"inherits":193,"minimalistic-assert":197}],191:[function(require,module,exports){ -'use strict'; -var hash = require('hash.js'); -var utils = require('minimalistic-crypto-utils'); -var assert = require('minimalistic-assert'); +module.exports = { + hasProperty: hasProperty, + getPathInfo: getPathInfo, + getPathValue: getPathValue, + setPathValue: setPathValue, +}; -function HmacDRBG(options) { - if (!(this instanceof HmacDRBG)) - return new HmacDRBG(options); - this.hash = options.hash; - this.predResist = !!options.predResist; +},{}],200:[function(require,module,exports){ +exports.pbkdf2 = require('./lib/async') +exports.pbkdf2Sync = require('./lib/sync') - this.outLen = this.hash.outSize; - this.minEntropy = options.minEntropy || this.hash.hmacStrength; +},{"./lib/async":201,"./lib/sync":204}],201:[function(require,module,exports){ +(function (global){(function (){ +var Buffer = require('safe-buffer').Buffer - this._reseed = null; - this.reseedInterval = null; - this.K = null; - this.V = null; +var checkParameters = require('./precondition') +var defaultEncoding = require('./default-encoding') +var sync = require('./sync') +var toBuffer = require('./to-buffer') - var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex'); - var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex'); - var pers = utils.toArray(options.pers, options.persEnc || 'hex'); - assert(entropy.length >= (this.minEntropy / 8), - 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); - this._init(entropy, nonce, pers); +var ZERO_BUF +var subtle = global.crypto && global.crypto.subtle +var toBrowser = { + sha: 'SHA-1', + 'sha-1': 'SHA-1', + sha1: 'SHA-1', + sha256: 'SHA-256', + 'sha-256': 'SHA-256', + sha384: 'SHA-384', + 'sha-384': 'SHA-384', + 'sha-512': 'SHA-512', + sha512: 'SHA-512' +} +var checks = [] +function checkNative (algo) { + if (global.process && !global.process.browser) { + return Promise.resolve(false) + } + if (!subtle || !subtle.importKey || !subtle.deriveBits) { + return Promise.resolve(false) + } + if (checks[algo] !== undefined) { + return checks[algo] + } + ZERO_BUF = ZERO_BUF || Buffer.alloc(8) + var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo) + .then(function () { + return true + }).catch(function () { + return false + }) + checks[algo] = prom + return prom +} +var nextTick +function getNextTick () { + if (nextTick) { + return nextTick + } + if (global.process && global.process.nextTick) { + nextTick = global.process.nextTick + } else if (global.queueMicrotask) { + nextTick = global.queueMicrotask + } else if (global.setImmediate) { + nextTick = global.setImmediate + } else { + nextTick = global.setTimeout + } + return nextTick +} +function browserPbkdf2 (password, salt, iterations, length, algo) { + return subtle.importKey( + 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits'] + ).then(function (key) { + return subtle.deriveBits({ + name: 'PBKDF2', + salt: salt, + iterations: iterations, + hash: { + name: algo + } + }, key, length << 3) + }).then(function (res) { + return Buffer.from(res) + }) } -module.exports = HmacDRBG; - -HmacDRBG.prototype._init = function init(entropy, nonce, pers) { - var seed = entropy.concat(nonce).concat(pers); - this.K = new Array(this.outLen / 8); - this.V = new Array(this.outLen / 8); - for (var i = 0; i < this.V.length; i++) { - this.K[i] = 0x00; - this.V[i] = 0x01; +function resolvePromise (promise, callback) { + promise.then(function (out) { + getNextTick()(function () { + callback(null, out) + }) + }, function (e) { + getNextTick()(function () { + callback(e) + }) + }) +} +module.exports = function (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined } - this._update(seed); - this._reseed = 1; - this.reseedInterval = 0x1000000000000; // 2^48 -}; + digest = digest || 'sha1' + var algo = toBrowser[digest.toLowerCase()] -HmacDRBG.prototype._hmac = function hmac() { - return new hash.hmac(this.hash, this.K); -}; + if (!algo || typeof global.Promise !== 'function') { + getNextTick()(function () { + var out + try { + out = sync(password, salt, iterations, keylen, digest) + } catch (e) { + return callback(e) + } + callback(null, out) + }) + return + } -HmacDRBG.prototype._update = function update(seed) { - var kmac = this._hmac() - .update(this.V) - .update([ 0x00 ]); - if (seed) - kmac = kmac.update(seed); - this.K = kmac.digest(); - this.V = this._hmac().update(this.V).digest(); - if (!seed) - return; + checkParameters(iterations, keylen) + password = toBuffer(password, defaultEncoding, 'Password') + salt = toBuffer(salt, defaultEncoding, 'Salt') + if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2') - this.K = this._hmac() - .update(this.V) - .update([ 0x01 ]) - .update(seed) - .digest(); - this.V = this._hmac().update(this.V).digest(); -}; + resolvePromise(checkNative(algo).then(function (resp) { + if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo) -HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { - // Optional entropy enc - if (typeof entropyEnc !== 'string') { - addEnc = add; - add = entropyEnc; - entropyEnc = null; - } + return sync(password, salt, iterations, keylen, digest) + }), callback) +} - entropy = utils.toArray(entropy, entropyEnc); - add = utils.toArray(add, addEnc); +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./default-encoding":202,"./precondition":203,"./sync":204,"./to-buffer":205,"safe-buffer":219}],202:[function(require,module,exports){ +(function (process,global){(function (){ +var defaultEncoding +/* istanbul ignore next */ +if (global.process && global.process.browser) { + defaultEncoding = 'utf-8' +} else if (global.process && global.process.version) { + var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) - assert(entropy.length >= (this.minEntropy / 8), - 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' +} else { + defaultEncoding = 'utf-8' +} +module.exports = defaultEncoding - this._update(entropy.concat(add || [])); - this._reseed = 1; -}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":206}],203:[function(require,module,exports){ +var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs -HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { - if (this._reseed > this.reseedInterval) - throw new Error('Reseed is required'); +module.exports = function (iterations, keylen) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } - // Optional encoding - if (typeof enc !== 'string') { - addEnc = add; - add = enc; - enc = null; + if (iterations < 0) { + throw new TypeError('Bad iterations') } - // Optional additional data - if (add) { - add = utils.toArray(add, addEnc || 'hex'); - this._update(add); + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') } - var temp = []; - while (temp.length < len) { - this.V = this._hmac().update(this.V).digest(); - temp = temp.concat(this.V); + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length') } +} - var res = temp.slice(0, len); - this._update(add); - this._reseed++; - return utils.encode(res, enc); -}; +},{}],204:[function(require,module,exports){ +var md5 = require('create-hash/md5') +var RIPEMD160 = require('ripemd160') +var sha = require('sha.js') +var Buffer = require('safe-buffer').Buffer -},{"hash.js":179,"minimalistic-assert":197,"minimalistic-crypto-utils":198}],192:[function(require,module,exports){ -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] +var checkParameters = require('./precondition') +var defaultEncoding = require('./default-encoding') +var toBuffer = require('./to-buffer') - i += d +var ZEROS = Buffer.alloc(128) +var sizes = { + md5: 16, + sha1: 20, + sha224: 28, + sha256: 32, + sha384: 48, + sha512: 64, + rmd160: 20, + ripemd160: 20 +} - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} +function Hmac (alg, key, saltLen) { + var hash = getDigest(alg) + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + if (key.length > blocksize) { + key = hash(key) + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias + var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]) + var opad = Buffer.allocUnsafe(blocksize + sizes[alg]) + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) + + var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4) + ipad.copy(ipad1, 0, 0, blocksize) + this.ipad1 = ipad1 + this.ipad2 = ipad + this.opad = opad + this.alg = alg + this.blocksize = blocksize + this.hash = hash + this.size = sizes[alg] } -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 +Hmac.prototype.run = function (data, ipad) { + data.copy(ipad, this.blocksize) + var h = this.hash(ipad) + h.copy(this.opad, this.blocksize) + return this.hash(this.opad) +} - value = Math.abs(value) +function getDigest (alg) { + function shaFunc (data) { + return sha(alg).update(data).digest() + } + function rmd160Func (data) { + return new RIPEMD160().update(data).digest() + } - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } + if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func + if (alg === 'md5') return md5 + return shaFunc +} - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } +function pbkdf2 (password, salt, iterations, keylen, digest) { + checkParameters(iterations, keylen) + password = toBuffer(password, defaultEncoding, 'Password') + salt = toBuffer(salt, defaultEncoding, 'Salt') - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + digest = digest || 'sha1' - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + var hmac = new Hmac(digest, password, salt.length) - buffer[offset + i - d] |= s * 128 -} + var DK = Buffer.allocUnsafe(keylen) + var block1 = Buffer.allocUnsafe(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) -},{}],193:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} + var destPos = 0 + var hLen = sizes[digest] + var l = Math.ceil(keylen / hLen) -},{}],194:[function(require,module,exports){ -'use strict' -var inherits = require('inherits') -var HashBase = require('hash-base') -var Buffer = require('safe-buffer').Buffer + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) -var ARRAY16 = new Array(16) + var T = hmac.run(block1, hmac.ipad1) + var U = T -function MD5 () { - HashBase.call(this, 64) + for (var j = 1; j < iterations; j++) { + U = hmac.run(U, hmac.ipad2) + for (var k = 0; k < hLen; k++) T[k] ^= U[k] + } - // state - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 + T.copy(DK, destPos) + destPos += hLen + } + + return DK } -inherits(MD5, HashBase) +module.exports = pbkdf2 -MD5.prototype._update = function () { - var M = ARRAY16 - for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4) +},{"./default-encoding":202,"./precondition":203,"./to-buffer":205,"create-hash/md5":122,"ripemd160":218,"safe-buffer":219,"sha.js":222}],205:[function(require,module,exports){ +var Buffer = require('safe-buffer').Buffer - var a = this._a - var b = this._b - var c = this._c - var d = this._d +module.exports = function (thing, encoding, name) { + if (Buffer.isBuffer(thing)) { + return thing + } else if (typeof thing === 'string') { + return Buffer.from(thing, encoding) + } else if (ArrayBuffer.isView(thing)) { + return Buffer.from(thing.buffer) + } else { + throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView') + } +} - a = fnF(a, b, c, d, M[0], 0xd76aa478, 7) - d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12) - c = fnF(c, d, a, b, M[2], 0x242070db, 17) - b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22) - a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7) - d = fnF(d, a, b, c, M[5], 0x4787c62a, 12) - c = fnF(c, d, a, b, M[6], 0xa8304613, 17) - b = fnF(b, c, d, a, M[7], 0xfd469501, 22) - a = fnF(a, b, c, d, M[8], 0x698098d8, 7) - d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12) - c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17) - b = fnF(b, c, d, a, M[11], 0x895cd7be, 22) - a = fnF(a, b, c, d, M[12], 0x6b901122, 7) - d = fnF(d, a, b, c, M[13], 0xfd987193, 12) - c = fnF(c, d, a, b, M[14], 0xa679438e, 17) - b = fnF(b, c, d, a, M[15], 0x49b40821, 22) +},{"safe-buffer":219}],206:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; - a = fnG(a, b, c, d, M[1], 0xf61e2562, 5) - d = fnG(d, a, b, c, M[6], 0xc040b340, 9) - c = fnG(c, d, a, b, M[11], 0x265e5a51, 14) - b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20) - a = fnG(a, b, c, d, M[5], 0xd62f105d, 5) - d = fnG(d, a, b, c, M[10], 0x02441453, 9) - c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14) - b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20) - a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5) - d = fnG(d, a, b, c, M[14], 0xc33707d6, 9) - c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14) - b = fnG(b, c, d, a, M[8], 0x455a14ed, 20) - a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5) - d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9) - c = fnG(c, d, a, b, M[7], 0x676f02d9, 14) - b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20) +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - a = fnH(a, b, c, d, M[5], 0xfffa3942, 4) - d = fnH(d, a, b, c, M[8], 0x8771f681, 11) - c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16) - b = fnH(b, c, d, a, M[14], 0xfde5380c, 23) - a = fnH(a, b, c, d, M[1], 0xa4beea44, 4) - d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11) - c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16) - b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23) - a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4) - d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11) - c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16) - b = fnH(b, c, d, a, M[6], 0x04881d05, 23) - a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4) - d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11) - c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16) - b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23) +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - a = fnI(a, b, c, d, M[0], 0xf4292244, 6) - d = fnI(d, a, b, c, M[7], 0x432aff97, 10) - c = fnI(c, d, a, b, M[14], 0xab9423a7, 15) - b = fnI(b, c, d, a, M[5], 0xfc93a039, 21) - a = fnI(a, b, c, d, M[12], 0x655b59c3, 6) - d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10) - c = fnI(c, d, a, b, M[10], 0xffeff47d, 15) - b = fnI(b, c, d, a, M[1], 0x85845dd1, 21) - a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6) - d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10) - c = fnI(c, d, a, b, M[6], 0xa3014314, 15) - b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21) - a = fnI(a, b, c, d, M[4], 0xf7537e82, 6) - d = fnI(d, a, b, c, M[11], 0xbd3af235, 10) - c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15) - b = fnI(b, c, d, a, M[9], 0xeb86d391, 21) - this._a = (this._a + a) | 0 - this._b = (this._b + b) | 0 - this._c = (this._c + c) | 0 - this._d = (this._d + d) | 0 } +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } -MD5.prototype._digest = function () { - // create padding and handle blocks - this._block[this._blockOffset++] = 0x80 - if (this._blockOffset > 56) { - this._block.fill(0, this._blockOffset, 64) - this._update() - this._blockOffset = 0 - } - this._block.fill(0, this._blockOffset, 56) - this._block.writeUInt32LE(this._length[0], 56) - this._block.writeUInt32LE(this._length[1], 60) - this._update() - // produce result - var buffer = Buffer.allocUnsafe(16) - buffer.writeInt32LE(this._a, 0) - buffer.writeInt32LE(this._b, 4) - buffer.writeInt32LE(this._c, 8) - buffer.writeInt32LE(this._d, 12) - return buffer } +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; -function rotl (x, n) { - return (x << n) | (x >>> (32 - n)) +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } } -function fnF (a, b, c, d, m, k, s) { - return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0 -} +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; -function fnG (a, b, c, d, m, k, s) { - return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0 + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); } -function fnH (a, b, c, d, m, k, s) { - return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0 -} +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; -function fnI (a, b, c, d, m, k, s) { - return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0 +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; } +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; -module.exports = MD5 +function noop() {} -},{"hash-base":163,"inherits":193,"safe-buffer":225}],195:[function(require,module,exports){ -var bn = require('bn.js'); -var brorand = require('brorand'); +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; -function MillerRabin(rand) { - this.rand = rand || new brorand.Rand(); -} -module.exports = MillerRabin; +process.listeners = function (name) { return [] } -MillerRabin.create = function create(rand) { - return new MillerRabin(rand); +process.binding = function (name) { + throw new Error('process.binding is not supported'); }; -MillerRabin.prototype._randbelow = function _randbelow(n) { - var len = n.bitLength(); - var min_bytes = Math.ceil(len / 8); +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - // Generage random bytes until a number less than n is found. - // This ensures that 0..n-1 have an equal probability of being selected. - do - var a = new bn(this.rand.generate(min_bytes)); - while (a.cmp(n) >= 0); +},{}],207:[function(require,module,exports){ +exports.publicEncrypt = require('./publicEncrypt') +exports.privateDecrypt = require('./privateDecrypt') - return a; -}; +exports.privateEncrypt = function privateEncrypt (key, buf) { + return exports.publicEncrypt(key, buf, true) +} -MillerRabin.prototype._randrange = function _randrange(start, stop) { - // Generate a random number greater than or equal to start and less than stop. - var size = stop.sub(start); - return start.add(this._randbelow(size)); -}; +exports.publicDecrypt = function publicDecrypt (key, buf) { + return exports.privateDecrypt(key, buf, true) +} -MillerRabin.prototype.test = function test(n, k, cb) { - var len = n.bitLength(); - var red = bn.mont(n); - var rone = new bn(1).toRed(red); +},{"./privateDecrypt":210,"./publicEncrypt":211}],208:[function(require,module,exports){ +var createHash = require('create-hash') +var Buffer = require('safe-buffer').Buffer - if (!k) - k = Math.max(1, (len / 48) | 0); +module.exports = function (seed, len) { + var t = Buffer.alloc(0) + var i = 0 + var c + while (t.length < len) { + c = i2ops(i++) + t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]) + } + return t.slice(0, len) +} - // Find d and s, (n - 1) = (2 ^ s) * d; - var n1 = n.subn(1); - for (var s = 0; !n1.testn(s); s++) {} - var d = n.shrn(s); +function i2ops (c) { + var out = Buffer.allocUnsafe(4) + out.writeUInt32BE(c, 0) + return out +} - var rn1 = n1.toRed(red); +},{"create-hash":121,"safe-buffer":219}],209:[function(require,module,exports){ +arguments[4][33][0].apply(exports,arguments) +},{"buffer":39,"dup":33}],210:[function(require,module,exports){ +var parseKeys = require('parse-asn1') +var mgf = require('./mgf') +var xor = require('./xor') +var BN = require('bn.js') +var crt = require('browserify-rsa') +var createHash = require('create-hash') +var withPublic = require('./withPublic') +var Buffer = require('safe-buffer').Buffer - var prime = true; - for (; k > 0; k--) { - var a = this._randrange(new bn(2), n1); - if (cb) - cb(a); +module.exports = function privateDecrypt (privateKey, enc, reverse) { + var padding + if (privateKey.padding) { + padding = privateKey.padding + } else if (reverse) { + padding = 1 + } else { + padding = 4 + } - var x = a.toRed(red).redPow(d); - if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) - continue; + var key = parseKeys(privateKey) + var k = key.modulus.byteLength() + if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) { + throw new Error('decryption error') + } + var msg + if (reverse) { + msg = withPublic(new BN(enc), key) + } else { + msg = crt(enc, key) + } + var zBuffer = Buffer.alloc(k - msg.length) + msg = Buffer.concat([zBuffer, msg], k) + if (padding === 4) { + return oaep(key, msg) + } else if (padding === 1) { + return pkcs1(key, msg, reverse) + } else if (padding === 3) { + return msg + } else { + throw new Error('unknown padding') + } +} - for (var i = 1; i < s; i++) { - x = x.redSqr(); +function oaep (key, msg) { + var k = key.modulus.byteLength() + var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() + var hLen = iHash.length + if (msg[0] !== 0) { + throw new Error('decryption error') + } + var maskedSeed = msg.slice(1, hLen + 1) + var maskedDb = msg.slice(hLen + 1) + var seed = xor(maskedSeed, mgf(maskedDb, hLen)) + var db = xor(maskedDb, mgf(seed, k - hLen - 1)) + if (compare(iHash, db.slice(0, hLen))) { + throw new Error('decryption error') + } + var i = hLen + while (db[i] === 0) { + i++ + } + if (db[i++] !== 1) { + throw new Error('decryption error') + } + return db.slice(i) +} - if (x.cmp(rone) === 0) - return false; - if (x.cmp(rn1) === 0) - break; +function pkcs1 (key, msg, reverse) { + var p1 = msg.slice(0, 2) + var i = 2 + var status = 0 + while (msg[i++] !== 0) { + if (i >= msg.length) { + status++ + break } + } + var ps = msg.slice(2, i - 1) - if (i === s) - return false; + if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) { + status++ + } + if (ps.length < 8) { + status++ + } + if (status) { + throw new Error('decryption error') + } + return msg.slice(i) +} +function compare (a, b) { + a = Buffer.from(a) + b = Buffer.from(b) + var dif = 0 + var len = a.length + if (a.length !== b.length) { + dif++ + len = Math.min(a.length, b.length) + } + var i = -1 + while (++i < len) { + dif += (a[i] ^ b[i]) } + return dif +} - return prime; -}; +},{"./mgf":208,"./withPublic":212,"./xor":213,"bn.js":209,"browserify-rsa":60,"create-hash":121,"parse-asn1":198,"safe-buffer":219}],211:[function(require,module,exports){ +var parseKeys = require('parse-asn1') +var randomBytes = require('randombytes') +var createHash = require('create-hash') +var mgf = require('./mgf') +var xor = require('./xor') +var BN = require('bn.js') +var withPublic = require('./withPublic') +var crt = require('browserify-rsa') +var Buffer = require('safe-buffer').Buffer -MillerRabin.prototype.getDivisor = function getDivisor(n, k) { - var len = n.bitLength(); - var red = bn.mont(n); - var rone = new bn(1).toRed(red); +module.exports = function publicEncrypt (publicKey, msg, reverse) { + var padding + if (publicKey.padding) { + padding = publicKey.padding + } else if (reverse) { + padding = 1 + } else { + padding = 4 + } + var key = parseKeys(publicKey) + var paddedMsg + if (padding === 4) { + paddedMsg = oaep(key, msg) + } else if (padding === 1) { + paddedMsg = pkcs1(key, msg, reverse) + } else if (padding === 3) { + paddedMsg = new BN(msg) + if (paddedMsg.cmp(key.modulus) >= 0) { + throw new Error('data too long for modulus') + } + } else { + throw new Error('unknown padding') + } + if (reverse) { + return crt(paddedMsg, key) + } else { + return withPublic(paddedMsg, key) + } +} - if (!k) - k = Math.max(1, (len / 48) | 0); +function oaep (key, msg) { + var k = key.modulus.byteLength() + var mLen = msg.length + var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() + var hLen = iHash.length + var hLen2 = 2 * hLen + if (mLen > k - hLen2 - 2) { + throw new Error('message too long') + } + var ps = Buffer.alloc(k - mLen - hLen2 - 2) + var dblen = k - hLen - 1 + var seed = randomBytes(hLen) + var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen)) + var maskedSeed = xor(seed, mgf(maskedDb, hLen)) + return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k)) +} +function pkcs1 (key, msg, reverse) { + var mLen = msg.length + var k = key.modulus.byteLength() + if (mLen > k - 11) { + throw new Error('message too long') + } + var ps + if (reverse) { + ps = Buffer.alloc(k - mLen - 3, 0xff) + } else { + ps = nonZero(k - mLen - 3) + } + return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k)) +} +function nonZero (len) { + var out = Buffer.allocUnsafe(len) + var i = 0 + var cache = randomBytes(len * 2) + var cur = 0 + var num + while (i < len) { + if (cur === cache.length) { + cache = randomBytes(len * 2) + cur = 0 + } + num = cache[cur++] + if (num) { + out[i++] = num + } + } + return out +} - // Find d and s, (n - 1) = (2 ^ s) * d; - var n1 = n.subn(1); - for (var s = 0; !n1.testn(s); s++) {} - var d = n.shrn(s); +},{"./mgf":208,"./withPublic":212,"./xor":213,"bn.js":209,"browserify-rsa":60,"create-hash":121,"parse-asn1":198,"randombytes":216,"safe-buffer":219}],212:[function(require,module,exports){ +var BN = require('bn.js') +var Buffer = require('safe-buffer').Buffer - var rn1 = n1.toRed(red); +function withPublic (paddedMsg, key) { + return Buffer.from(paddedMsg + .toRed(BN.mont(key.modulus)) + .redPow(new BN(key.publicExponent)) + .fromRed() + .toArray()) +} - for (; k > 0; k--) { - var a = this._randrange(new bn(2), n1); +module.exports = withPublic - var g = n.gcd(a); - if (g.cmpn(1) !== 0) - return g; +},{"bn.js":209,"safe-buffer":219}],213:[function(require,module,exports){ +module.exports = function xor (a, b) { + var len = a.length + var i = -1 + while (++i < len) { + a[i] ^= b[i] + } + return a +} - var x = a.toRed(red).redPow(d); - if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) - continue; +},{}],214:[function(require,module,exports){ +(function (Buffer){(function (){ +/** + * Copyright (c) 2020, Peculiar Ventures, All rights reserved. + */ - for (var i = 1; i < s; i++) { - x = x.redSqr(); +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pvtsutils = {})); +}(this, (function (exports) { 'use strict'; - if (x.cmp(rone) === 0) - return x.fromRed().subn(1).gcd(n); - if (x.cmp(rn1) === 0) - break; - } + class BufferSourceConverter { + static isArrayBuffer(data) { + return Object.prototype.toString.call(data) === '[object ArrayBuffer]'; + } + static toArrayBuffer(data) { + const buf = this.toUint8Array(data); + if (buf.byteOffset || buf.length) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); + } + return buf.buffer; + } + static toUint8Array(data) { + return this.toView(data, Uint8Array); + } + static toView(data, type) { + if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) { + return new type(data.buffer, data.byteOffset, data.byteLength); + } + if (this.isArrayBuffer(data)) { + return new type(data); + } + if (this.isArrayBufferView(data)) { + return new type(data.buffer, data.byteOffset, data.byteLength); + } + throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + static isBufferSource(data) { + return this.isArrayBufferView(data) + || this.isArrayBuffer(data); + } + static isArrayBufferView(data) { + return ArrayBuffer.isView(data) + || (data && this.isArrayBuffer(data.buffer)); + } + } - if (i === s) { - x = x.redSqr(); - return x.fromRed().subn(1).gcd(n); - } + class Convert { + static isHex(data) { + return typeof data === "string" + && /^[a-z0-9]+$/i.test(data); + } + static isBase64(data) { + return typeof data === "string" + && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data); + } + static isBase64Url(data) { + return typeof data === "string" + && /^[a-zA-Z0-9-_]+$/i.test(data); + } + static ToString(buffer, enc = "utf8") { + const buf = BufferSourceConverter.toUint8Array(buffer); + switch (enc.toLowerCase()) { + case "utf8": + return this.ToUtf8String(buf); + case "binary": + return this.ToBinary(buf); + case "hex": + return this.ToHex(buf); + case "base64": + return this.ToBase64(buf); + case "base64url": + return this.ToBase64Url(buf); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static FromString(str, enc = "utf8") { + if (!str) { + return new ArrayBuffer(0); + } + switch (enc.toLowerCase()) { + case "utf8": + return this.FromUtf8String(str); + case "binary": + return this.FromBinary(str); + case "hex": + return this.FromHex(str); + case "base64": + return this.FromBase64(str); + case "base64url": + return this.FromBase64Url(str); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static ToBase64(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + if (typeof btoa !== "undefined") { + const binary = this.ToString(buf, "binary"); + return btoa(binary); + } + else { + return Buffer.from(buf).toString("base64"); + } + } + static FromBase64(base64) { + const formatted = this.formatString(base64); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64(formatted)) { + throw new TypeError("Argument 'base64Text' is not Base64 encoded"); + } + if (typeof atob !== "undefined") { + return this.FromBinary(atob(formatted)); + } + else { + return new Uint8Array(Buffer.from(formatted, "base64")).buffer; + } + } + static FromBase64Url(base64url) { + const formatted = this.formatString(base64url); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64Url(formatted)) { + throw new TypeError("Argument 'base64url' is not Base64Url encoded"); + } + return this.FromBase64(this.Base64Padding(formatted.replace(/\-/g, "+").replace(/\_/g, "/"))); + } + static ToBase64Url(data) { + return this.ToBase64(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, ""); + } + static FromUtf8String(text) { + const s = unescape(encodeURIComponent(text)); + const uintArray = new Uint8Array(s.length); + for (let i = 0; i < s.length; i++) { + uintArray[i] = s.charCodeAt(i); + } + return uintArray.buffer; + } + static ToUtf8String(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let encodedString = ""; + for (let i = 0; i < buf.length; i++) { + encodedString += String.fromCharCode(buf[i]); + } + const decodedString = decodeURIComponent(escape(encodedString)); + return decodedString; + } + static FromBinary(text) { + const stringLength = text.length; + const resultView = new Uint8Array(stringLength); + for (let i = 0; i < stringLength; i++) { + resultView[i] = text.charCodeAt(i); + } + return resultView.buffer; + } + static ToBinary(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let res = ""; + for (let i = 0; i < buf.length; i++) { + res += String.fromCharCode(buf[i]); + } + return res; + } + static ToHex(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + const splitter = ""; + const res = []; + const len = buf.length; + for (let i = 0; i < len; i++) { + const char = buf[i].toString(16).padStart(2, "0"); + res.push(char); + } + return res.join(splitter); + } + static FromHex(hexString) { + let formatted = this.formatString(hexString); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isHex(formatted)) { + throw new TypeError("Argument 'hexString' is not HEX encoded"); + } + if (formatted.length % 2) { + formatted = `0${formatted}`; + } + const res = new Uint8Array(formatted.length / 2); + for (let i = 0; i < formatted.length; i = i + 2) { + const c = formatted.slice(i, i + 2); + res[i / 2] = parseInt(c, 16); + } + return res.buffer; + } + static Base64Padding(base64) { + const padCount = 4 - (base64.length % 4); + if (padCount < 4) { + for (let i = 0; i < padCount; i++) { + base64 += "="; + } + } + return base64; + } + static formatString(data) { + return (data === null || data === void 0 ? void 0 : data.replace(/[\n\r\t ]/g, "")) || ""; + } } - return false; -}; - -},{"bn.js":196,"brorand":42}],196:[function(require,module,exports){ -arguments[4][33][0].apply(exports,arguments) -},{"buffer":43,"dup":33}],197:[function(require,module,exports){ -module.exports = assert; + function assign(target, ...sources) { + const res = arguments[0]; + for (let i = 1; i < arguments.length; i++) { + const obj = arguments[i]; + for (const prop in obj) { + res[prop] = obj[prop]; + } + } + return res; + } + function combine(...buf) { + const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur); + const res = new Uint8Array(totalByteLength); + let currentPos = 0; + buf.map((item) => new Uint8Array(item)).forEach((arr) => { + for (const item2 of arr) { + res[currentPos++] = item2; + } + }); + return res.buffer; + } + function isEqual(bytes1, bytes2) { + if (!(bytes1 && bytes2)) { + return false; + } + if (bytes1.byteLength !== bytes2.byteLength) { + return false; + } + const b1 = new Uint8Array(bytes1); + const b2 = new Uint8Array(bytes2); + for (let i = 0; i < bytes1.byteLength; i++) { + if (b1[i] !== b2[i]) { + return false; + } + } + return true; + } -function assert(val, msg) { - if (!val) - throw new Error(msg || 'Assertion failed'); -} + exports.BufferSourceConverter = BufferSourceConverter; + exports.Convert = Convert; + exports.assign = assign; + exports.combine = combine; + exports.isEqual = isEqual; -assert.equal = function assertEqual(l, r, msg) { - if (l != r) - throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); -}; + Object.defineProperty(exports, '__esModule', { value: true }); -},{}],198:[function(require,module,exports){ -'use strict'; +}))); -var utils = exports; +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":83}],215:[function(require,module,exports){ +"use strict"; -function toArray(msg, enc) { - if (Array.isArray(msg)) - return msg.slice(); - if (!msg) - return []; - var res = []; - if (typeof msg !== 'string') { - for (var i = 0; i < msg.length; i++) - res[i] = msg[i] | 0; - return res; - } - if (enc === 'hex') { - msg = msg.replace(/[^a-z0-9]+/ig, ''); - if (msg.length % 2 !== 0) - msg = '0' + msg; - for (var i = 0; i < msg.length; i += 2) - res.push(parseInt(msg[i] + msg[i + 1], 16)); - } else { - for (var i = 0; i < msg.length; i++) { - var c = msg.charCodeAt(i); - var hi = c >> 8; - var lo = c & 0xff; - if (hi) - res.push(hi, lo); - else - res.push(lo); - } - } - return res; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getUTCDate = getUTCDate; +exports.getParametersValue = getParametersValue; +exports.bufferToHexCodes = bufferToHexCodes; +exports.checkBufferParams = checkBufferParams; +exports.utilFromBase = utilFromBase; +exports.utilToBase = utilToBase; +exports.utilConcatBuf = utilConcatBuf; +exports.utilConcatView = utilConcatView; +exports.utilDecodeTC = utilDecodeTC; +exports.utilEncodeTC = utilEncodeTC; +exports.isEqualBuffer = isEqualBuffer; +exports.padNumber = padNumber; +exports.toBase64 = toBase64; +exports.fromBase64 = fromBase64; +exports.arrayBufferToString = arrayBufferToString; +exports.stringToArrayBuffer = stringToArrayBuffer; +exports.nearestPowerOf2 = nearestPowerOf2; +exports.clearProps = clearProps; +//************************************************************************************** +/** + * Making UTC date from local date + * @param {Date} date Date to convert from + * @returns {Date} + */ +function getUTCDate(date) { + // noinspection NestedFunctionCallJS, MagicNumberJS + return new Date(date.getTime() + date.getTimezoneOffset() * 60000); } -utils.toArray = toArray; +//************************************************************************************** +// noinspection FunctionWithMultipleReturnPointsJS +/** + * Get value for input parameters, or set a default value + * @param {Object} parameters + * @param {string} name + * @param defaultValue + */ +function getParametersValue(parameters, name, defaultValue) { + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS + if (parameters instanceof Object === false) return defaultValue; -function zero2(word) { - if (word.length === 1) - return '0' + word; - else - return word; -} -utils.zero2 = zero2; + // noinspection NonBlockStatementBodyJS + if (name in parameters) return parameters[name]; -function toHex(msg) { - var res = ''; - for (var i = 0; i < msg.length; i++) - res += zero2(msg[i].toString(16)); - return res; + return defaultValue; } -utils.toHex = toHex; - -utils.encode = function encode(arr, enc) { - if (enc === 'hex') - return toHex(arr); - else - return arr; -}; - -},{}],199:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } +//************************************************************************************** +/** + * Converts "ArrayBuffer" into a hexdecimal string + * @param {ArrayBuffer} inputBuffer + * @param {number} [inputOffset=0] + * @param {number} [inputLength=inputBuffer.byteLength] + * @param {boolean} [insertSpace=false] + * @returns {string} + */ +function bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = inputBuffer.byteLength - inputOffset, insertSpace = false) { + let result = ""; - return Object(val); -} + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; -function shouldUseNative() { try { - if (!Object.assign) { - return false; - } + for (var _iterator = new Uint8Array(inputBuffer, inputOffset, inputLength)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + const item = _step.value; - // Detect buggy property enumeration order in older V8 versions. + // noinspection ChainedFunctionCallJS + const str = item.toString(16).toUpperCase(); - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS + if (str.length === 1) result += "0"; - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } + result += str; - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; + // noinspection NonBlockStatementBodyJS + if (insertSpace) result += " "; } - - return true; } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } + } finally { + if (_didIteratorError) { + throw _iteratorError; } } } - return to; -}; - -},{}],200:[function(require,module,exports){ -module.exports={"2.16.840.1.101.3.4.1.1": "aes-128-ecb", -"2.16.840.1.101.3.4.1.2": "aes-128-cbc", -"2.16.840.1.101.3.4.1.3": "aes-128-ofb", -"2.16.840.1.101.3.4.1.4": "aes-128-cfb", -"2.16.840.1.101.3.4.1.21": "aes-192-ecb", -"2.16.840.1.101.3.4.1.22": "aes-192-cbc", -"2.16.840.1.101.3.4.1.23": "aes-192-ofb", -"2.16.840.1.101.3.4.1.24": "aes-192-cfb", -"2.16.840.1.101.3.4.1.41": "aes-256-ecb", -"2.16.840.1.101.3.4.1.42": "aes-256-cbc", -"2.16.840.1.101.3.4.1.43": "aes-256-ofb", -"2.16.840.1.101.3.4.1.44": "aes-256-cfb" + return result.trim(); } -},{}],201:[function(require,module,exports){ -// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js -// Fedor, you are amazing. -'use strict' - -var asn1 = require('asn1.js') - -exports.certificate = require('./certificate') - -var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('modulus').int(), - this.key('publicExponent').int(), - this.key('privateExponent').int(), - this.key('prime1').int(), - this.key('prime2').int(), - this.key('exponent1').int(), - this.key('exponent2').int(), - this.key('coefficient').int() - ) -}) -exports.RSAPrivateKey = RSAPrivateKey - -var RSAPublicKey = asn1.define('RSAPublicKey', function () { - this.seq().obj( - this.key('modulus').int(), - this.key('publicExponent').int() - ) -}) -exports.RSAPublicKey = RSAPublicKey - -var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { - this.seq().obj( - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPublicKey').bitstr() - ) -}) -exports.PublicKey = PublicKey - -var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { - this.seq().obj( - this.key('algorithm').objid(), - this.key('none').null_().optional(), - this.key('curve').objid().optional(), - this.key('params').seq().obj( - this.key('p').int(), - this.key('q').int(), - this.key('g').int() - ).optional() - ) -}) - -var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { - this.seq().obj( - this.key('version').int(), - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPrivateKey').octstr() - ) -}) -exports.PrivateKey = PrivateKeyInfo -var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { - this.seq().obj( - this.key('algorithm').seq().obj( - this.key('id').objid(), - this.key('decrypt').seq().obj( - this.key('kde').seq().obj( - this.key('id').objid(), - this.key('kdeparams').seq().obj( - this.key('salt').octstr(), - this.key('iters').int() - ) - ), - this.key('cipher').seq().obj( - this.key('algo').objid(), - this.key('iv').octstr() - ) - ) - ), - this.key('subjectPrivateKey').octstr() - ) -}) - -exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo - -var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('p').int(), - this.key('q').int(), - this.key('g').int(), - this.key('pub_key').int(), - this.key('priv_key').int() - ) -}) -exports.DSAPrivateKey = DSAPrivateKey - -exports.DSAparam = asn1.define('DSAparam', function () { - this.int() -}) - -var ECPrivateKey = asn1.define('ECPrivateKey', function () { - this.seq().obj( - this.key('version').int(), - this.key('privateKey').octstr(), - this.key('parameters').optional().explicit(0).use(ECParameters), - this.key('publicKey').optional().explicit(1).bitstr() - ) -}) -exports.ECPrivateKey = ECPrivateKey - -var ECParameters = asn1.define('ECParameters', function () { - this.choice({ - namedCurve: this.objid() - }) -}) - -exports.signature = asn1.define('signature', function () { - this.seq().obj( - this.key('r').int(), - this.key('s').int() - ) -}) - -},{"./certificate":202,"asn1.js":19}],202:[function(require,module,exports){ -// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js -// thanks to @Rantanen - -'use strict' - -var asn = require('asn1.js') - -var Time = asn.define('Time', function () { - this.choice({ - utcTime: this.utctime(), - generalTime: this.gentime() - }) -}) - -var AttributeTypeValue = asn.define('AttributeTypeValue', function () { - this.seq().obj( - this.key('type').objid(), - this.key('value').any() - ) -}) - -var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () { - this.seq().obj( - this.key('algorithm').objid(), - this.key('parameters').optional(), - this.key('curve').objid().optional() - ) -}) - -var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () { - this.seq().obj( - this.key('algorithm').use(AlgorithmIdentifier), - this.key('subjectPublicKey').bitstr() - ) -}) - -var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () { - this.setof(AttributeTypeValue) -}) - -var RDNSequence = asn.define('RDNSequence', function () { - this.seqof(RelativeDistinguishedName) -}) - -var Name = asn.define('Name', function () { - this.choice({ - rdnSequence: this.use(RDNSequence) - }) -}) - -var Validity = asn.define('Validity', function () { - this.seq().obj( - this.key('notBefore').use(Time), - this.key('notAfter').use(Time) - ) -}) - -var Extension = asn.define('Extension', function () { - this.seq().obj( - this.key('extnID').objid(), - this.key('critical').bool().def(false), - this.key('extnValue').octstr() - ) -}) - -var TBSCertificate = asn.define('TBSCertificate', function () { - this.seq().obj( - this.key('version').explicit(0).int().optional(), - this.key('serialNumber').int(), - this.key('signature').use(AlgorithmIdentifier), - this.key('issuer').use(Name), - this.key('validity').use(Validity), - this.key('subject').use(Name), - this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), - this.key('issuerUniqueID').implicit(1).bitstr().optional(), - this.key('subjectUniqueID').implicit(2).bitstr().optional(), - this.key('extensions').explicit(3).seqof(Extension).optional() - ) -}) - -var X509Certificate = asn.define('X509Certificate', function () { - this.seq().obj( - this.key('tbsCertificate').use(TBSCertificate), - this.key('signatureAlgorithm').use(AlgorithmIdentifier), - this.key('signatureValue').bitstr() - ) -}) - -module.exports = X509Certificate +//************************************************************************************** +// noinspection JSValidateJSDoc, FunctionWithMultipleReturnPointsJS +/** + * Check input "ArrayBuffer" for common functions + * @param {LocalBaseBlock} baseBlock + * @param {ArrayBuffer} inputBuffer + * @param {number} inputOffset + * @param {number} inputLength + * @returns {boolean} + */ +function checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { + // noinspection ConstantOnRightSideOfComparisonJS + if (inputBuffer instanceof ArrayBuffer === false) { + // noinspection JSUndefinedPropertyAssignment + baseBlock.error = "Wrong parameter: inputBuffer must be \"ArrayBuffer\""; + return false; + } -},{"asn1.js":19}],203:[function(require,module,exports){ -// adapted from https://github.com/apatil/pemstrip -var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m -var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m -var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m -var evp = require('evp_bytestokey') -var ciphers = require('browserify-aes') -var Buffer = require('safe-buffer').Buffer -module.exports = function (okey, password) { - var key = okey.toString() - var match = key.match(findProc) - var decrypted - if (!match) { - var match2 = key.match(fullRegex) - decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64') - } else { - var suite = 'aes' + match[1] - var iv = Buffer.from(match[2], 'hex') - var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64') - var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key - var out = [] - var cipher = ciphers.createDecipheriv(suite, cipherKey, iv) - out.push(cipher.update(cipherText)) - out.push(cipher.final()) - decrypted = Buffer.concat(out) - } - var tag = key.match(startRegex)[1] - return { - tag: tag, - data: decrypted - } -} + // noinspection ConstantOnRightSideOfComparisonJS + if (inputBuffer.byteLength === 0) { + // noinspection JSUndefinedPropertyAssignment + baseBlock.error = "Wrong parameter: inputBuffer has zero length"; + return false; + } -},{"browserify-aes":46,"evp_bytestokey":161,"safe-buffer":225}],204:[function(require,module,exports){ -var asn1 = require('./asn1') -var aesid = require('./aesid.json') -var fixProc = require('./fixProc') -var ciphers = require('browserify-aes') -var compat = require('pbkdf2') -var Buffer = require('safe-buffer').Buffer -module.exports = parseKeys + // noinspection ConstantOnRightSideOfComparisonJS + if (inputOffset < 0) { + // noinspection JSUndefinedPropertyAssignment + baseBlock.error = "Wrong parameter: inputOffset less than zero"; + return false; + } -function parseKeys (buffer) { - var password - if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { - password = buffer.passphrase - buffer = buffer.key - } - if (typeof buffer === 'string') { - buffer = Buffer.from(buffer) - } + // noinspection ConstantOnRightSideOfComparisonJS + if (inputLength < 0) { + // noinspection JSUndefinedPropertyAssignment + baseBlock.error = "Wrong parameter: inputLength less than zero"; + return false; + } - var stripped = fixProc(buffer, password) + // noinspection ConstantOnRightSideOfComparisonJS + if (inputBuffer.byteLength - inputOffset - inputLength < 0) { + // noinspection JSUndefinedPropertyAssignment + baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return false; + } - var type = stripped.tag - var data = stripped.data - var subtype, ndata - switch (type) { - case 'CERTIFICATE': - ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo - // falls through - case 'PUBLIC KEY': - if (!ndata) { - ndata = asn1.PublicKey.decode(data, 'der') - } - subtype = ndata.algorithm.algorithm.join('.') - switch (subtype) { - case '1.2.840.113549.1.1.1': - return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der') - case '1.2.840.10045.2.1': - ndata.subjectPrivateKey = ndata.subjectPublicKey - return { - type: 'ec', - data: ndata - } - case '1.2.840.10040.4.1': - ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der') - return { - type: 'dsa', - data: ndata.algorithm.params - } - default: throw new Error('unknown key id ' + subtype) - } - // throw new Error('unknown key type ' + type) - case 'ENCRYPTED PRIVATE KEY': - data = asn1.EncryptedPrivateKey.decode(data, 'der') - data = decrypt(data, password) - // falls through - case 'PRIVATE KEY': - ndata = asn1.PrivateKey.decode(data, 'der') - subtype = ndata.algorithm.algorithm.join('.') - switch (subtype) { - case '1.2.840.113549.1.1.1': - return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der') - case '1.2.840.10045.2.1': - return { - curve: ndata.algorithm.curve, - privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey - } - case '1.2.840.10040.4.1': - ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der') - return { - type: 'dsa', - params: ndata.algorithm.params - } - default: throw new Error('unknown key id ' + subtype) - } - // throw new Error('unknown key type ' + type) - case 'RSA PUBLIC KEY': - return asn1.RSAPublicKey.decode(data, 'der') - case 'RSA PRIVATE KEY': - return asn1.RSAPrivateKey.decode(data, 'der') - case 'DSA PRIVATE KEY': - return { - type: 'dsa', - params: asn1.DSAPrivateKey.decode(data, 'der') - } - case 'EC PRIVATE KEY': - data = asn1.ECPrivateKey.decode(data, 'der') - return { - curve: data.parameters.value, - privateKey: data.privateKey - } - default: throw new Error('unknown key type ' + type) - } -} -parseKeys.signature = asn1.signature -function decrypt (data, password) { - var salt = data.algorithm.decrypt.kde.kdeparams.salt - var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10) - var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')] - var iv = data.algorithm.decrypt.cipher.iv - var cipherText = data.subjectPrivateKey - var keylen = parseInt(algo.split('-')[1], 10) / 8 - var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1') - var cipher = ciphers.createDecipheriv(algo, key, iv) - var out = [] - out.push(cipher.update(cipherText)) - out.push(cipher.final()) - return Buffer.concat(out) + return true; } +//************************************************************************************** +// noinspection FunctionWithMultipleReturnPointsJS +/** + * Convert number from 2^base to 2^10 + * @param {Uint8Array} inputBuffer + * @param {number} inputBase + * @returns {number} + */ +function utilFromBase(inputBuffer, inputBase) { + let result = 0; -},{"./aesid.json":200,"./asn1":201,"./fixProc":203,"browserify-aes":46,"pbkdf2":206,"safe-buffer":225}],205:[function(require,module,exports){ -'use strict'; + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS + if (inputBuffer.length === 1) return inputBuffer[0]; -/* ! - * Chai - pathval utility - * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com> - * @see https://github.com/logicalparadox/filtr - * MIT Licensed - */ + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS + for (let i = inputBuffer.length - 1; i >= 0; i--) result += inputBuffer[inputBuffer.length - 1 - i] * Math.pow(2, inputBase * i); -/** - * ### .hasProperty(object, name) - * - * This allows checking whether an object has own - * or inherited from prototype chain named property. - * - * Basically does the same thing as the `in` - * operator but works properly with null/undefined values - * and other primitives. - * - * var obj = { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * - * The following would be the results. - * - * hasProperty(obj, 'str'); // true - * hasProperty(obj, 'constructor'); // true - * hasProperty(obj, 'bar'); // false - * - * hasProperty(obj.str, 'length'); // true - * hasProperty(obj.str, 1); // true - * hasProperty(obj.str, 5); // false - * - * hasProperty(obj.arr, 'length'); // true - * hasProperty(obj.arr, 2); // true - * hasProperty(obj.arr, 3); // false - * - * @param {Object} object - * @param {String|Symbol} name - * @returns {Boolean} whether it exists - * @namespace Utils - * @name hasProperty - * @api public + return result; +} +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS, FunctionWithMultipleReturnPointsJS +/** + * Convert number from 2^10 to 2^base + * @param {!number} value The number to convert + * @param {!number} base The base for 2^base + * @param {number} [reserved=0] Pre-defined number of bytes in output array (-1 = limited by function itself) + * @returns {ArrayBuffer} */ +function utilToBase(value, base, reserved = -1) { + const internalReserved = reserved; + let internalValue = value; -function hasProperty(obj, name) { - if (typeof obj === 'undefined' || obj === null) { - return false; - } + let result = 0; + let biggest = Math.pow(2, base); - // The `in` operator does not work with primitives. - return name in Object(obj); -} + // noinspection ConstantOnRightSideOfComparisonJS + for (let i = 1; i < 8; i++) { + if (value < biggest) { + let retBuf; -/* ! - * ## parsePath(path) - * - * Helper function used to parse string object - * paths. Use in conjunction with `internalGetPathValue`. - * - * var parsed = parsePath('myobject.property.subprop'); - * - * ### Paths: - * - * * Can be infinitely deep and nested. - * * Arrays are also valid using the formal `myobject.document[3].property`. - * * Literal dots and brackets (not delimiter) must be backslash-escaped. - * - * @param {String} path - * @returns {Object} parsed - * @api private - */ + // noinspection ConstantOnRightSideOfComparisonJS + if (internalReserved < 0) { + retBuf = new ArrayBuffer(i); + result = i; + } else { + // noinspection NonBlockStatementBodyJS + if (internalReserved < i) return new ArrayBuffer(0); -function parsePath(path) { - var str = path.replace(/([^\\])\[/g, '$1.['); - var parts = str.match(/(\\\.|[^.]+?)+/g); - return parts.map(function mapMatches(value) { - if ( - value === 'constructor' || - value === '__proto__' || - value === 'prototype' - ) { - return {}; - } - var regexp = /^\[(\d+)\]$/; - var mArr = regexp.exec(value); - var parsed = null; - if (mArr) { - parsed = { i: parseFloat(mArr[1]) }; - } else { - parsed = { p: value.replace(/\\([.[\]])/g, '$1') }; - } + retBuf = new ArrayBuffer(internalReserved); - return parsed; - }); -} + result = internalReserved; + } -/* ! - * ## internalGetPathValue(obj, parsed[, pathDepth]) - * - * Helper companion function for `.parsePath` that returns - * the value located at the parsed address. - * - * var value = getPathValue(obj, parsed); - * - * @param {Object} object to search against - * @param {Object} parsed definition from `parsePath`. - * @param {Number} depth (nesting level) of the property we want to retrieve - * @returns {Object|Undefined} value - * @api private - */ + const retView = new Uint8Array(retBuf); -function internalGetPathValue(obj, parsed, pathDepth) { - var temporaryValue = obj; - var res = null; - pathDepth = typeof pathDepth === 'undefined' ? parsed.length : pathDepth; + // noinspection ConstantOnRightSideOfComparisonJS + for (let j = i - 1; j >= 0; j--) { + const basis = Math.pow(2, j * base); - for (var i = 0; i < pathDepth; i++) { - var part = parsed[i]; - if (temporaryValue) { - if (typeof part.p === 'undefined') { - temporaryValue = temporaryValue[part.i]; - } else { - temporaryValue = temporaryValue[part.p]; - } + retView[result - j - 1] = Math.floor(internalValue / basis); + internalValue -= retView[result - j - 1] * basis; + } - if (i === pathDepth - 1) { - res = temporaryValue; - } - } - } + return retBuf; + } - return res; -} + biggest *= Math.pow(2, base); + } -/* ! - * ## internalSetPathValue(obj, value, parsed) - * - * Companion function for `parsePath` that sets - * the value located at a parsed address. - * - * internalSetPathValue(obj, 'value', parsed); - * - * @param {Object} object to search and define on - * @param {*} value to use upon set - * @param {Object} parsed definition from `parsePath` - * @api private + return new ArrayBuffer(0); +} +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS +/** + * Concatenate two ArrayBuffers + * @param {...ArrayBuffer} buffers Set of ArrayBuffer */ +function utilConcatBuf(...buffers) { + //region Initial variables + let outputLength = 0; + let prevLength = 0; + //endregion -function internalSetPathValue(obj, val, parsed) { - var tempObj = obj; - var pathDepth = parsed.length; - var part = null; - // Here we iterate through every part of the path - for (var i = 0; i < pathDepth; i++) { - var propName = null; - var propVal = null; - part = parsed[i]; + //region Calculate output length - // If it's the last part of the path, we set the 'propName' value with the property name - if (i === pathDepth - 1) { - propName = typeof part.p === 'undefined' ? part.i : part.p; - // Now we set the property with the name held by 'propName' on object with the desired val - tempObj[propName] = val; - } else if (typeof part.p !== 'undefined' && tempObj[part.p]) { - tempObj = tempObj[part.p]; - } else if (typeof part.i !== 'undefined' && tempObj[part.i]) { - tempObj = tempObj[part.i]; - } else { - // If the obj doesn't have the property we create one with that name to define it - var next = parsed[i + 1]; - // Here we set the name of the property which will be defined - propName = typeof part.p === 'undefined' ? part.i : part.p; - // Here we decide if this property will be an array or a new object - propVal = typeof next.p === 'undefined' ? [] : {}; - tempObj[propName] = propVal; - tempObj = tempObj[propName]; - } - } -} + // noinspection NonBlockStatementBodyJS + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; -/** - * ### .getPathInfo(object, path) - * - * This allows the retrieval of property info in an - * object given a string path. - * - * The path info consists of an object with the - * following properties: - * - * * parent - The parent object of the property referenced by `path` - * * name - The name of the final property, a number if it was an array indexer - * * value - The value of the property, if it exists, otherwise `undefined` - * * exists - Whether the property exists or not - * - * @param {Object} object - * @param {String} path - * @returns {Object} info - * @namespace Utils - * @name getPathInfo - * @api public - */ + try { + for (var _iterator2 = buffers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + const buffer = _step2.value; -function getPathInfo(obj, path) { - var parsed = parsePath(path); - var last = parsed[parsed.length - 1]; - var info = { - parent: - parsed.length > 1 ? - internalGetPathValue(obj, parsed, parsed.length - 1) : - obj, - name: last.p || last.i, - value: internalGetPathValue(obj, parsed), - }; - info.exists = hasProperty(info.parent, info.name); + outputLength += buffer.byteLength; + } //endregion + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } - return info; -} + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); -/** - * ### .getPathValue(object, path) - * - * This allows the retrieval of values in an - * object given a string path. - * - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * } - * - * The following would be the results. - * - * getPathValue(obj, 'prop1.str'); // Hello - * getPathValue(obj, 'prop1.att[2]'); // b - * getPathValue(obj, 'prop2.arr[0].nested'); // Universe - * - * @param {Object} object - * @param {String} path - * @returns {Object} value or `undefined` - * @namespace Utils - * @name getPathValue - * @api public + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = buffers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + const buffer = _step3.value; + + // noinspection NestedFunctionCallJS + retView.set(new Uint8Array(buffer), prevLength); + prevLength += buffer.byteLength; + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + return retBuf; +} +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS +/** + * Concatenate two Uint8Array + * @param {...Uint8Array} views Set of Uint8Array */ +function utilConcatView(...views) { + //region Initial variables + let outputLength = 0; + let prevLength = 0; + //endregion + + //region Calculate output length + // noinspection NonBlockStatementBodyJS + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; + + try { + for (var _iterator4 = views[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + const view = _step4.value; + + outputLength += view.length; + } //endregion + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4.return) { + _iterator4.return(); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } + } + + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); -function getPathValue(obj, path) { - var info = getPathInfo(obj, path); - return info.value; -} + var _iteratorNormalCompletion5 = true; + var _didIteratorError5 = false; + var _iteratorError5 = undefined; -/** - * ### .setPathValue(object, path, value) - * - * Define the value in an object at a given string path. - * - * ```js - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * }; - * ``` - * - * The following would be acceptable. - * - * ```js - * var properties = require('tea-properties'); - * properties.set(obj, 'prop1.str', 'Hello Universe!'); - * properties.set(obj, 'prop1.arr[2]', 'B'); - * properties.set(obj, 'prop2.arr[0].nested.value', { hello: 'universe' }); - * ``` - * - * @param {Object} object - * @param {String} path - * @param {Mixed} value - * @api private - */ + try { + for (var _iterator5 = views[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { + const view = _step5.value; -function setPathValue(obj, path, val) { - var parsed = parsePath(path); - internalSetPathValue(obj, val, parsed); - return obj; + retView.set(view, prevLength); + prevLength += view.length; + } + } catch (err) { + _didIteratorError5 = true; + _iteratorError5 = err; + } finally { + try { + if (!_iteratorNormalCompletion5 && _iterator5.return) { + _iterator5.return(); + } + } finally { + if (_didIteratorError5) { + throw _iteratorError5; + } + } + } + + return retView; } +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS +/** + * Decoding of "two complement" values + * The function must be called in scope of instance of "hexBlock" class ("valueHex" and "warnings" properties must be present) + * @returns {number} + */ +function utilDecodeTC() { + const buf = new Uint8Array(this.valueHex); -module.exports = { - hasProperty: hasProperty, - getPathInfo: getPathInfo, - getPathValue: getPathValue, - setPathValue: setPathValue, -}; + // noinspection ConstantOnRightSideOfComparisonJS + if (this.valueHex.byteLength >= 2) { + //noinspection JSBitwiseOperatorUsage, ConstantOnRightSideOfComparisonJS, LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + const condition1 = buf[0] === 0xFF && buf[1] & 0x80; + // noinspection ConstantOnRightSideOfComparisonJS, LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + const condition2 = buf[0] === 0x00 && (buf[1] & 0x80) === 0x00; -},{}],206:[function(require,module,exports){ -exports.pbkdf2 = require('./lib/async') -exports.pbkdf2Sync = require('./lib/sync') + // noinspection NonBlockStatementBodyJS + if (condition1 || condition2) this.warnings.push("Needlessly long format"); + } -},{"./lib/async":207,"./lib/sync":210}],207:[function(require,module,exports){ -(function (global){(function (){ -var Buffer = require('safe-buffer').Buffer + //region Create big part of the integer + const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const bigIntView = new Uint8Array(bigIntBuffer); + // noinspection NonBlockStatementBodyJS + for (let i = 0; i < this.valueHex.byteLength; i++) bigIntView[i] = 0; -var checkParameters = require('./precondition') -var defaultEncoding = require('./default-encoding') -var sync = require('./sync') -var toBuffer = require('./to-buffer') + // noinspection MagicNumberJS, NonShortCircuitBooleanExpressionJS + bigIntView[0] = buf[0] & 0x80; // mask only the biggest bit -var ZERO_BUF -var subtle = global.crypto && global.crypto.subtle -var toBrowser = { - sha: 'SHA-1', - 'sha-1': 'SHA-1', - sha1: 'SHA-1', - sha256: 'SHA-256', - 'sha-256': 'SHA-256', - sha384: 'SHA-384', - 'sha-384': 'SHA-384', - 'sha-512': 'SHA-512', - sha512: 'SHA-512' -} -var checks = [] -function checkNative (algo) { - if (global.process && !global.process.browser) { - return Promise.resolve(false) - } - if (!subtle || !subtle.importKey || !subtle.deriveBits) { - return Promise.resolve(false) - } - if (checks[algo] !== undefined) { - return checks[algo] - } - ZERO_BUF = ZERO_BUF || Buffer.alloc(8) - var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo) - .then(function () { - return true - }).catch(function () { - return false - }) - checks[algo] = prom - return prom -} -var nextTick -function getNextTick () { - if (nextTick) { - return nextTick - } - if (global.process && global.process.nextTick) { - nextTick = global.process.nextTick - } else if (global.queueMicrotask) { - nextTick = global.queueMicrotask - } else if (global.setImmediate) { - nextTick = global.setImmediate - } else { - nextTick = global.setTimeout - } - return nextTick -} -function browserPbkdf2 (password, salt, iterations, length, algo) { - return subtle.importKey( - 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits'] - ).then(function (key) { - return subtle.deriveBits({ - name: 'PBKDF2', - salt: salt, - iterations: iterations, - hash: { - name: algo - } - }, key, length << 3) - }).then(function (res) { - return Buffer.from(res) - }) -} + const bigInt = utilFromBase(bigIntView, 8); + //endregion -function resolvePromise (promise, callback) { - promise.then(function (out) { - getNextTick()(function () { - callback(null, out) - }) - }, function (e) { - getNextTick()(function () { - callback(e) - }) - }) + //region Create small part of the integer + const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const smallIntView = new Uint8Array(smallIntBuffer); + // noinspection NonBlockStatementBodyJS + for (let j = 0; j < this.valueHex.byteLength; j++) smallIntView[j] = buf[j]; + + // noinspection MagicNumberJS + smallIntView[0] &= 0x7F; // mask biggest bit + + const smallInt = utilFromBase(smallIntView, 8); + //endregion + + return smallInt - bigInt; } -module.exports = function (password, salt, iterations, keylen, digest, callback) { - if (typeof digest === 'function') { - callback = digest - digest = undefined - } +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS, FunctionWithMultipleReturnPointsJS +/** + * Encode integer value to "two complement" format + * @param {number} value Value to encode + * @returns {ArrayBuffer} + */ +function utilEncodeTC(value) { + // noinspection ConstantOnRightSideOfComparisonJS, ConditionalExpressionJS + const modValue = value < 0 ? value * -1 : value; + let bigInt = 128; - digest = digest || 'sha1' - var algo = toBrowser[digest.toLowerCase()] + // noinspection ConstantOnRightSideOfComparisonJS + for (let i = 1; i < 8; i++) { + if (modValue <= bigInt) { + // noinspection ConstantOnRightSideOfComparisonJS + if (value < 0) { + const smallInt = bigInt - modValue; - if (!algo || typeof global.Promise !== 'function') { - getNextTick()(function () { - var out - try { - out = sync(password, salt, iterations, keylen, digest) - } catch (e) { - return callback(e) - } - callback(null, out) - }) - return - } + const retBuf = utilToBase(smallInt, 8, i); + const retView = new Uint8Array(retBuf); - checkParameters(iterations, keylen) - password = toBuffer(password, defaultEncoding, 'Password') - salt = toBuffer(salt, defaultEncoding, 'Salt') - if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2') + // noinspection MagicNumberJS + retView[0] |= 0x80; - resolvePromise(checkNative(algo).then(function (resp) { - if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo) + return retBuf; + } - return sync(password, salt, iterations, keylen, digest) - }), callback) -} + let retBuf = utilToBase(modValue, 8, i); + let retView = new Uint8Array(retBuf); -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./default-encoding":208,"./precondition":209,"./sync":210,"./to-buffer":211,"safe-buffer":225}],208:[function(require,module,exports){ -(function (process,global){(function (){ -var defaultEncoding -/* istanbul ignore next */ -if (global.process && global.process.browser) { - defaultEncoding = 'utf-8' -} else if (global.process && global.process.version) { - var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) + //noinspection JSBitwiseOperatorUsage, MagicNumberJS, NonShortCircuitBooleanExpressionJS + if (retView[0] & 0x80) { + //noinspection JSCheckFunctionSignatures + const tempBuf = retBuf.slice(0); + const tempView = new Uint8Array(tempBuf); - defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' -} else { - defaultEncoding = 'utf-8' -} -module.exports = defaultEncoding + retBuf = new ArrayBuffer(retBuf.byteLength + 1); + // noinspection ReuseOfLocalVariableJS + retView = new Uint8Array(retBuf); -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":212}],209:[function(require,module,exports){ -var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs + // noinspection NonBlockStatementBodyJS + for (let k = 0; k < tempBuf.byteLength; k++) retView[k + 1] = tempView[k]; -module.exports = function (iterations, keylen) { - if (typeof iterations !== 'number') { - throw new TypeError('Iterations not a number') - } + // noinspection MagicNumberJS + retView[0] = 0x00; + } - if (iterations < 0) { - throw new TypeError('Bad iterations') - } + return retBuf; + } - if (typeof keylen !== 'number') { - throw new TypeError('Key length not a number') - } + bigInt *= Math.pow(2, 8); + } - if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ - throw new TypeError('Bad key length') - } + return new ArrayBuffer(0); } +//************************************************************************************** +// noinspection FunctionWithMultipleReturnPointsJS, ParameterNamingConventionJS +/** + * Compare two array buffers + * @param {!ArrayBuffer} inputBuffer1 + * @param {!ArrayBuffer} inputBuffer2 + * @returns {boolean} + */ +function isEqualBuffer(inputBuffer1, inputBuffer2) { + // noinspection NonBlockStatementBodyJS + if (inputBuffer1.byteLength !== inputBuffer2.byteLength) return false; -},{}],210:[function(require,module,exports){ -var md5 = require('create-hash/md5') -var RIPEMD160 = require('ripemd160') -var sha = require('sha.js') -var Buffer = require('safe-buffer').Buffer + // noinspection LocalVariableNamingConventionJS + const view1 = new Uint8Array(inputBuffer1); + // noinspection LocalVariableNamingConventionJS + const view2 = new Uint8Array(inputBuffer2); -var checkParameters = require('./precondition') -var defaultEncoding = require('./default-encoding') -var toBuffer = require('./to-buffer') + for (let i = 0; i < view1.length; i++) { + // noinspection NonBlockStatementBodyJS + if (view1[i] !== view2[i]) return false; + } -var ZEROS = Buffer.alloc(128) -var sizes = { - md5: 16, - sha1: 20, - sha224: 28, - sha256: 32, - sha384: 48, - sha512: 64, - rmd160: 20, - ripemd160: 20 + return true; } +//************************************************************************************** +// noinspection FunctionWithMultipleReturnPointsJS +/** + * Pad input number with leade "0" if needed + * @returns {string} + * @param {number} inputNumber + * @param {number} fullLength + */ +function padNumber(inputNumber, fullLength) { + const str = inputNumber.toString(10); -function Hmac (alg, key, saltLen) { - var hash = getDigest(alg) - var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 + // noinspection NonBlockStatementBodyJS + if (fullLength < str.length) return ""; - if (key.length > blocksize) { - key = hash(key) - } else if (key.length < blocksize) { - key = Buffer.concat([key, ZEROS], blocksize) - } + const dif = fullLength - str.length; - var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]) - var opad = Buffer.allocUnsafe(blocksize + sizes[alg]) - for (var i = 0; i < blocksize; i++) { - ipad[i] = key[i] ^ 0x36 - opad[i] = key[i] ^ 0x5C - } + const padding = new Array(dif); + // noinspection NonBlockStatementBodyJS + for (let i = 0; i < dif; i++) padding[i] = "0"; - var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4) - ipad.copy(ipad1, 0, 0, blocksize) - this.ipad1 = ipad1 - this.ipad2 = ipad - this.opad = opad - this.alg = alg - this.blocksize = blocksize - this.hash = hash - this.size = sizes[alg] -} + const paddingString = padding.join(""); -Hmac.prototype.run = function (data, ipad) { - data.copy(ipad, this.blocksize) - var h = this.hash(ipad) - h.copy(this.opad, this.blocksize) - return this.hash(this.opad) + return paddingString.concat(str); } +//************************************************************************************** +const base64Template = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +const base64UrlTemplate = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; +//************************************************************************************** +// noinspection FunctionWithMultipleLoopsJS, OverlyComplexFunctionJS, FunctionTooLongJS, FunctionNamingConventionJS +/** + * Encode string into BASE64 (or "base64url") + * @param {string} input + * @param {boolean} useUrlTemplate If "true" then output would be encoded using "base64url" + * @param {boolean} skipPadding Skip BASE-64 padding or not + * @param {boolean} skipLeadingZeros Skip leading zeros in input data or not + * @returns {string} + */ +function toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) { + let i = 0; -function getDigest (alg) { - function shaFunc (data) { - return sha(alg).update(data).digest() - } - function rmd160Func (data) { - return new RIPEMD160().update(data).digest() - } + // noinspection LocalVariableNamingConventionJS + let flag1 = 0; + // noinspection LocalVariableNamingConventionJS + let flag2 = 0; - if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func - if (alg === 'md5') return md5 - return shaFunc -} + let output = ""; -function pbkdf2 (password, salt, iterations, keylen, digest) { - checkParameters(iterations, keylen) - password = toBuffer(password, defaultEncoding, 'Password') - salt = toBuffer(salt, defaultEncoding, 'Salt') + // noinspection ConditionalExpressionJS + const template = useUrlTemplate ? base64UrlTemplate : base64Template; - digest = digest || 'sha1' + if (skipLeadingZeros) { + let nonZeroPosition = 0; - var hmac = new Hmac(digest, password, salt.length) + for (let i = 0; i < input.length; i++) { + // noinspection ConstantOnRightSideOfComparisonJS + if (input.charCodeAt(i) !== 0) { + nonZeroPosition = i; + // noinspection BreakStatementJS + break; + } + } - var DK = Buffer.allocUnsafe(keylen) - var block1 = Buffer.allocUnsafe(salt.length + 4) - salt.copy(block1, 0, 0, salt.length) + // noinspection AssignmentToFunctionParameterJS + input = input.slice(nonZeroPosition); + } - var destPos = 0 - var hLen = sizes[digest] - var l = Math.ceil(keylen / hLen) + while (i < input.length) { + // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS + const chr1 = input.charCodeAt(i++); + // noinspection NonBlockStatementBodyJS + if (i >= input.length) flag1 = 1; + // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS + const chr2 = input.charCodeAt(i++); + // noinspection NonBlockStatementBodyJS + if (i >= input.length) flag2 = 1; + // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS + const chr3 = input.charCodeAt(i++); - for (var i = 1; i <= l; i++) { - block1.writeUInt32BE(i, salt.length) + // noinspection LocalVariableNamingConventionJS + const enc1 = chr1 >> 2; + // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + const enc2 = (chr1 & 0x03) << 4 | chr2 >> 4; + // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + let enc3 = (chr2 & 0x0F) << 2 | chr3 >> 6; + // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + let enc4 = chr3 & 0x3F; + + // noinspection ConstantOnRightSideOfComparisonJS + if (flag1 === 1) { + // noinspection NestedAssignmentJS, AssignmentResultUsedJS, MagicNumberJS + enc3 = enc4 = 64; + } else { + // noinspection ConstantOnRightSideOfComparisonJS + if (flag2 === 1) { + // noinspection MagicNumberJS + enc4 = 64; + } + } + + // noinspection NonBlockStatementBodyJS + if (skipPadding) { + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS + if (enc3 === 64) output += `${template.charAt(enc1)}${template.charAt(enc2)}`;else { + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS + if (enc4 === 64) output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`;else output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + } else output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + + return output; +} +//************************************************************************************** +// noinspection FunctionWithMoreThanThreeNegationsJS, FunctionWithMultipleLoopsJS, OverlyComplexFunctionJS, FunctionNamingConventionJS +/** + * Decode string from BASE64 (or "base64url") + * @param {string} input + * @param {boolean} [useUrlTemplate=false] If "true" then output would be encoded using "base64url" + * @param {boolean} [cutTailZeros=false] If "true" then cut tailing zeroz from function result + * @returns {string} + */ +function fromBase64(input, useUrlTemplate = false, cutTailZeros = false) { + // noinspection ConditionalExpressionJS + const template = useUrlTemplate ? base64UrlTemplate : base64Template; + + //region Aux functions + // noinspection FunctionWithMultipleReturnPointsJS, NestedFunctionJS + function indexof(toSearch) { + // noinspection ConstantOnRightSideOfComparisonJS, MagicNumberJS + for (let i = 0; i < 64; i++) { + // noinspection NonBlockStatementBodyJS + if (template.charAt(i) === toSearch) return i; + } + + // noinspection MagicNumberJS + return 64; + } + + // noinspection NestedFunctionJS + function test(incoming) { + // noinspection ConstantOnRightSideOfComparisonJS, ConditionalExpressionJS, MagicNumberJS + return incoming === 64 ? 0x00 : incoming; + } + //endregion - var T = hmac.run(block1, hmac.ipad1) - var U = T + let i = 0; - for (var j = 1; j < iterations; j++) { - U = hmac.run(U, hmac.ipad2) - for (var k = 0; k < hLen; k++) T[k] ^= U[k] - } + let output = ""; - T.copy(DK, destPos) - destPos += hLen - } + while (i < input.length) { + // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS + const enc1 = indexof(input.charAt(i++)); + // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS + const enc2 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); + // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS + const enc3 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); + // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS + const enc4 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); - return DK -} + // noinspection LocalVariableNamingConventionJS, NonShortCircuitBooleanExpressionJS + const chr1 = test(enc1) << 2 | test(enc2) >> 4; + // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + const chr2 = (test(enc2) & 0x0F) << 4 | test(enc3) >> 2; + // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS + const chr3 = (test(enc3) & 0x03) << 6 | test(enc4); -module.exports = pbkdf2 + output += String.fromCharCode(chr1); -},{"./default-encoding":208,"./precondition":209,"./to-buffer":211,"create-hash/md5":127,"ripemd160":224,"safe-buffer":225,"sha.js":228}],211:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS + if (enc3 !== 64) output += String.fromCharCode(chr2); -module.exports = function (thing, encoding, name) { - if (Buffer.isBuffer(thing)) { - return thing - } else if (typeof thing === 'string') { - return Buffer.from(thing, encoding) - } else if (ArrayBuffer.isView(thing)) { - return Buffer.from(thing.buffer) - } else { - throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView') - } -} + // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS + if (enc4 !== 64) output += String.fromCharCode(chr3); + } -},{"safe-buffer":225}],212:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; + if (cutTailZeros) { + const outputLength = output.length; + let nonZeroStart = -1; -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. + // noinspection ConstantOnRightSideOfComparisonJS + for (let i = outputLength - 1; i >= 0; i--) { + // noinspection ConstantOnRightSideOfComparisonJS + if (output.charCodeAt(i) !== 0) { + nonZeroStart = i; + // noinspection BreakStatementJS + break; + } + } -var cachedSetTimeout; -var cachedClearTimeout; + // noinspection NonBlockStatementBodyJS, NegatedIfStatementJS + if (nonZeroStart !== -1) output = output.slice(0, nonZeroStart + 1);else output = ""; + } -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); + return output; } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - +//************************************************************************************** +function arrayBufferToString(buffer) { + let resultString = ""; + const view = new Uint8Array(buffer); -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } + // noinspection NonBlockStatementBodyJS + var _iteratorNormalCompletion6 = true; + var _didIteratorError6 = false; + var _iteratorError6 = undefined; + try { + for (var _iterator6 = view[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { + const element = _step6.value; + resultString += String.fromCharCode(element); + } + } catch (err) { + _didIteratorError6 = true; + _iteratorError6 = err; + } finally { + try { + if (!_iteratorNormalCompletion6 && _iterator6.return) { + _iterator6.return(); + } + } finally { + if (_didIteratorError6) { + throw _iteratorError6; + } + } + } + return resultString; } -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; +//************************************************************************************** +function stringToArrayBuffer(str) { + const stringLength = str.length; -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} + const resultBuffer = new ArrayBuffer(stringLength); + const resultView = new Uint8Array(resultBuffer); -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + // noinspection NonBlockStatementBodyJS + for (let i = 0; i < stringLength; i++) resultView[i] = str.charCodeAt(i); - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); + return resultBuffer; } +//************************************************************************************** +const log2 = Math.log(2); +//************************************************************************************** +// noinspection FunctionNamingConventionJS +/** + * Get nearest to input length power of 2 + * @param {number} length Current length of existing array + * @returns {number} + */ +function nearestPowerOf2(length) { + const base = Math.log(length) / log2; -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; + const floor = Math.floor(base); + const round = Math.round(base); -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; + // noinspection ConditionalExpressionJS + return floor === round ? floor : round; } -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; +//************************************************************************************** +/** + * Delete properties by name from specified object + * @param {Object} object Object to delete properties from + * @param {Array.<string>} propsArray Array of properties names + */ +function clearProps(object, propsArray) { + var _iteratorNormalCompletion7 = true; + var _didIteratorError7 = false; + var _iteratorError7 = undefined; -process.listeners = function (name) { return [] } + try { + for (var _iterator7 = propsArray[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { + const prop = _step7.value; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + delete object[prop]; + } + } catch (err) { + _didIteratorError7 = true; + _iteratorError7 = err; + } finally { + try { + if (!_iteratorNormalCompletion7 && _iterator7.return) { + _iterator7.return(); + } + } finally { + if (_didIteratorError7) { + throw _iteratorError7; + } + } + } +} +//************************************************************************************** -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; +},{}],216:[function(require,module,exports){ +(function (process,global){(function (){ +'use strict' -},{}],213:[function(require,module,exports){ -exports.publicEncrypt = require('./publicEncrypt') -exports.privateDecrypt = require('./privateDecrypt') +// limit of Crypto.getRandomValues() +// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues +var MAX_BYTES = 65536 -exports.privateEncrypt = function privateEncrypt (key, buf) { - return exports.publicEncrypt(key, buf, true) -} +// Node supports requesting up to this number of bytes +// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48 +var MAX_UINT32 = 4294967295 -exports.publicDecrypt = function publicDecrypt (key, buf) { - return exports.privateDecrypt(key, buf, true) +function oldBrowser () { + throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') } -},{"./privateDecrypt":216,"./publicEncrypt":217}],214:[function(require,module,exports){ -var createHash = require('create-hash') var Buffer = require('safe-buffer').Buffer +var crypto = global.crypto || global.msCrypto -module.exports = function (seed, len) { - var t = Buffer.alloc(0) - var i = 0 - var c - while (t.length < len) { - c = i2ops(i++) - t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]) - } - return t.slice(0, len) +if (crypto && crypto.getRandomValues) { + module.exports = randomBytes +} else { + module.exports = oldBrowser } -function i2ops (c) { - var out = Buffer.allocUnsafe(4) - out.writeUInt32BE(c, 0) - return out -} +function randomBytes (size, cb) { + // phantomjs needs to throw + if (size > MAX_UINT32) throw new RangeError('requested too many random bytes') -},{"create-hash":126,"safe-buffer":225}],215:[function(require,module,exports){ -arguments[4][33][0].apply(exports,arguments) -},{"buffer":43,"dup":33}],216:[function(require,module,exports){ -var parseKeys = require('parse-asn1') -var mgf = require('./mgf') -var xor = require('./xor') -var BN = require('bn.js') -var crt = require('browserify-rsa') -var createHash = require('create-hash') -var withPublic = require('./withPublic') -var Buffer = require('safe-buffer').Buffer + var bytes = Buffer.allocUnsafe(size) -module.exports = function privateDecrypt (privateKey, enc, reverse) { - var padding - if (privateKey.padding) { - padding = privateKey.padding - } else if (reverse) { - padding = 1 - } else { - padding = 4 + if (size > 0) { // getRandomValues fails on IE if size == 0 + if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues + // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + for (var generated = 0; generated < size; generated += MAX_BYTES) { + // buffer.slice automatically checks if the end is past the end of + // the buffer so we don't have to here + crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES)) + } + } else { + crypto.getRandomValues(bytes) + } } - var key = parseKeys(privateKey) - var k = key.modulus.byteLength() - if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) { - throw new Error('decryption error') - } - var msg - if (reverse) { - msg = withPublic(new BN(enc), key) - } else { - msg = crt(enc, key) - } - var zBuffer = Buffer.alloc(k - msg.length) - msg = Buffer.concat([zBuffer, msg], k) - if (padding === 4) { - return oaep(key, msg) - } else if (padding === 1) { - return pkcs1(key, msg, reverse) - } else if (padding === 3) { - return msg - } else { - throw new Error('unknown padding') + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes) + }) } -} -function oaep (key, msg) { - var k = key.modulus.byteLength() - var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() - var hLen = iHash.length - if (msg[0] !== 0) { - throw new Error('decryption error') - } - var maskedSeed = msg.slice(1, hLen + 1) - var maskedDb = msg.slice(hLen + 1) - var seed = xor(maskedSeed, mgf(maskedDb, hLen)) - var db = xor(maskedDb, mgf(seed, k - hLen - 1)) - if (compare(iHash, db.slice(0, hLen))) { - throw new Error('decryption error') - } - var i = hLen - while (db[i] === 0) { - i++ - } - if (db[i++] !== 1) { - throw new Error('decryption error') - } - return db.slice(i) + return bytes } -function pkcs1 (key, msg, reverse) { - var p1 = msg.slice(0, 2) - var i = 2 - var status = 0 - while (msg[i++] !== 0) { - if (i >= msg.length) { - status++ - break - } - } - var ps = msg.slice(2, i - 1) +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":206,"safe-buffer":219}],217:[function(require,module,exports){ +(function (process,global){(function (){ +'use strict' - if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) { - status++ - } - if (ps.length < 8) { - status++ - } - if (status) { - throw new Error('decryption error') - } - return msg.slice(i) +function oldBrowser () { + throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') } -function compare (a, b) { - a = Buffer.from(a) - b = Buffer.from(b) - var dif = 0 - var len = a.length - if (a.length !== b.length) { - dif++ - len = Math.min(a.length, b.length) - } - var i = -1 - while (++i < len) { - dif += (a[i] ^ b[i]) +var safeBuffer = require('safe-buffer') +var randombytes = require('randombytes') +var Buffer = safeBuffer.Buffer +var kBufferMaxLength = safeBuffer.kMaxLength +var crypto = global.crypto || global.msCrypto +var kMaxUint32 = Math.pow(2, 32) - 1 +function assertOffset (offset, length) { + if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare + throw new TypeError('offset must be a number') } - return dif -} -},{"./mgf":214,"./withPublic":218,"./xor":219,"bn.js":215,"browserify-rsa":64,"create-hash":126,"parse-asn1":204,"safe-buffer":225}],217:[function(require,module,exports){ -var parseKeys = require('parse-asn1') -var randomBytes = require('randombytes') -var createHash = require('create-hash') -var mgf = require('./mgf') -var xor = require('./xor') -var BN = require('bn.js') -var withPublic = require('./withPublic') -var crt = require('browserify-rsa') -var Buffer = require('safe-buffer').Buffer - -module.exports = function publicEncrypt (publicKey, msg, reverse) { - var padding - if (publicKey.padding) { - padding = publicKey.padding - } else if (reverse) { - padding = 1 - } else { - padding = 4 - } - var key = parseKeys(publicKey) - var paddedMsg - if (padding === 4) { - paddedMsg = oaep(key, msg) - } else if (padding === 1) { - paddedMsg = pkcs1(key, msg, reverse) - } else if (padding === 3) { - paddedMsg = new BN(msg) - if (paddedMsg.cmp(key.modulus) >= 0) { - throw new Error('data too long for modulus') - } - } else { - throw new Error('unknown padding') + if (offset > kMaxUint32 || offset < 0) { + throw new TypeError('offset must be a uint32') } - if (reverse) { - return crt(paddedMsg, key) - } else { - return withPublic(paddedMsg, key) + + if (offset > kBufferMaxLength || offset > length) { + throw new RangeError('offset out of range') } } -function oaep (key, msg) { - var k = key.modulus.byteLength() - var mLen = msg.length - var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() - var hLen = iHash.length - var hLen2 = 2 * hLen - if (mLen > k - hLen2 - 2) { - throw new Error('message too long') +function assertSize (size, offset, length) { + if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare + throw new TypeError('size must be a number') + } + + if (size > kMaxUint32 || size < 0) { + throw new TypeError('size must be a uint32') + } + + if (size + offset > length || size > kBufferMaxLength) { + throw new RangeError('buffer too small') } - var ps = Buffer.alloc(k - mLen - hLen2 - 2) - var dblen = k - hLen - 1 - var seed = randomBytes(hLen) - var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen)) - var maskedSeed = xor(seed, mgf(maskedDb, hLen)) - return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k)) } -function pkcs1 (key, msg, reverse) { - var mLen = msg.length - var k = key.modulus.byteLength() - if (mLen > k - 11) { - throw new Error('message too long') +if ((crypto && crypto.getRandomValues) || !process.browser) { + exports.randomFill = randomFill + exports.randomFillSync = randomFillSync +} else { + exports.randomFill = oldBrowser + exports.randomFillSync = oldBrowser +} +function randomFill (buf, offset, size, cb) { + if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') } - var ps - if (reverse) { - ps = Buffer.alloc(k - mLen - 3, 0xff) - } else { - ps = nonZero(k - mLen - 3) + + if (typeof offset === 'function') { + cb = offset + offset = 0 + size = buf.length + } else if (typeof size === 'function') { + cb = size + size = buf.length - offset + } else if (typeof cb !== 'function') { + throw new TypeError('"cb" argument must be a function') } - return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k)) + assertOffset(offset, buf.length) + assertSize(size, offset, buf.length) + return actualFill(buf, offset, size, cb) } -function nonZero (len) { - var out = Buffer.allocUnsafe(len) - var i = 0 - var cache = randomBytes(len * 2) - var cur = 0 - var num - while (i < len) { - if (cur === cache.length) { - cache = randomBytes(len * 2) - cur = 0 - } - num = cache[cur++] - if (num) { - out[i++] = num + +function actualFill (buf, offset, size, cb) { + if (process.browser) { + var ourBuf = buf.buffer + var uint = new Uint8Array(ourBuf, offset, size) + crypto.getRandomValues(uint) + if (cb) { + process.nextTick(function () { + cb(null, buf) + }) + return } + return buf } - return out + if (cb) { + randombytes(size, function (err, bytes) { + if (err) { + return cb(err) + } + bytes.copy(buf, offset) + cb(null, buf) + }) + return + } + var bytes = randombytes(size) + bytes.copy(buf, offset) + return buf } +function randomFillSync (buf, offset, size) { + if (typeof offset === 'undefined') { + offset = 0 + } + if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') + } -},{"./mgf":214,"./withPublic":218,"./xor":219,"bn.js":215,"browserify-rsa":64,"create-hash":126,"parse-asn1":204,"randombytes":222,"safe-buffer":225}],218:[function(require,module,exports){ -var BN = require('bn.js') -var Buffer = require('safe-buffer').Buffer + assertOffset(offset, buf.length) -function withPublic (paddedMsg, key) { - return Buffer.from(paddedMsg - .toRed(BN.mont(key.modulus)) - .redPow(new BN(key.publicExponent)) - .fromRed() - .toArray()) + if (size === undefined) size = buf.length - offset + + assertSize(size, offset, buf.length) + + return actualFill(buf, offset, size) } -module.exports = withPublic +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":206,"randombytes":216,"safe-buffer":219}],218:[function(require,module,exports){ +'use strict' +var Buffer = require('buffer').Buffer +var inherits = require('inherits') +var HashBase = require('hash-base') -},{"bn.js":215,"safe-buffer":225}],219:[function(require,module,exports){ -module.exports = function xor (a, b) { - var len = a.length - var i = -1 - while (++i < len) { - a[i] ^= b[i] - } - return a +var ARRAY16 = new Array(16) + +var zl = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +] + +var zr = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +] + +var sl = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +] + +var sr = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +] + +var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] +var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000] + +function RIPEMD160 () { + HashBase.call(this, 64) + + // state + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 } -},{}],220:[function(require,module,exports){ -(function (Buffer){(function (){ -/** - * Copyright (c) 2020, Peculiar Ventures, All rights reserved. - */ +inherits(RIPEMD160, HashBase) -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pvtsutils = {})); -}(this, (function (exports) { 'use strict'; +RIPEMD160.prototype._update = function () { + var words = ARRAY16 + for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4) - class BufferSourceConverter { - static isArrayBuffer(data) { - return Object.prototype.toString.call(data) === '[object ArrayBuffer]'; - } - static toArrayBuffer(data) { - const buf = this.toUint8Array(data); - if (buf.byteOffset || buf.length) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); - } - return buf.buffer; - } - static toUint8Array(data) { - return this.toView(data, Uint8Array); - } - static toView(data, type) { - if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) { - return new type(data.buffer, data.byteOffset, data.byteLength); - } - if (this.isArrayBuffer(data)) { - return new type(data); - } - if (this.isArrayBufferView(data)) { - return new type(data.buffer, data.byteOffset, data.byteLength); - } - throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - static isBufferSource(data) { - return this.isArrayBufferView(data) - || this.isArrayBuffer(data); - } - static isArrayBufferView(data) { - return ArrayBuffer.isView(data) - || (data && this.isArrayBuffer(data.buffer)); - } - } + var al = this._a | 0 + var bl = this._b | 0 + var cl = this._c | 0 + var dl = this._d | 0 + var el = this._e | 0 - class Convert { - static isHex(data) { - return typeof data === "string" - && /^[a-z0-9]+$/i.test(data); - } - static isBase64(data) { - return typeof data === "string" - && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(data); - } - static isBase64Url(data) { - return typeof data === "string" - && /^[a-zA-Z0-9-_]+$/i.test(data); - } - static ToString(buffer, enc = "utf8") { - const buf = BufferSourceConverter.toUint8Array(buffer); - switch (enc.toLowerCase()) { - case "utf8": - return this.ToUtf8String(buf); - case "binary": - return this.ToBinary(buf); - case "hex": - return this.ToHex(buf); - case "base64": - return this.ToBase64(buf); - case "base64url": - return this.ToBase64Url(buf); - default: - throw new Error(`Unknown type of encoding '${enc}'`); - } - } - static FromString(str, enc = "utf8") { - if (!str) { - return new ArrayBuffer(0); - } - switch (enc.toLowerCase()) { - case "utf8": - return this.FromUtf8String(str); - case "binary": - return this.FromBinary(str); - case "hex": - return this.FromHex(str); - case "base64": - return this.FromBase64(str); - case "base64url": - return this.FromBase64Url(str); - default: - throw new Error(`Unknown type of encoding '${enc}'`); - } - } - static ToBase64(buffer) { - const buf = BufferSourceConverter.toUint8Array(buffer); - if (typeof btoa !== "undefined") { - const binary = this.ToString(buf, "binary"); - return btoa(binary); - } - else { - return Buffer.from(buf).toString("base64"); - } - } - static FromBase64(base64) { - const formatted = this.formatString(base64); - if (!formatted) { - return new ArrayBuffer(0); - } - if (!Convert.isBase64(formatted)) { - throw new TypeError("Argument 'base64Text' is not Base64 encoded"); - } - if (typeof atob !== "undefined") { - return this.FromBinary(atob(formatted)); - } - else { - return new Uint8Array(Buffer.from(formatted, "base64")).buffer; - } - } - static FromBase64Url(base64url) { - const formatted = this.formatString(base64url); - if (!formatted) { - return new ArrayBuffer(0); - } - if (!Convert.isBase64Url(formatted)) { - throw new TypeError("Argument 'base64url' is not Base64Url encoded"); - } - return this.FromBase64(this.Base64Padding(formatted.replace(/\-/g, "+").replace(/\_/g, "/"))); - } - static ToBase64Url(data) { - return this.ToBase64(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, ""); - } - static FromUtf8String(text) { - const s = unescape(encodeURIComponent(text)); - const uintArray = new Uint8Array(s.length); - for (let i = 0; i < s.length; i++) { - uintArray[i] = s.charCodeAt(i); - } - return uintArray.buffer; - } - static ToUtf8String(buffer) { - const buf = BufferSourceConverter.toUint8Array(buffer); - let encodedString = ""; - for (let i = 0; i < buf.length; i++) { - encodedString += String.fromCharCode(buf[i]); - } - const decodedString = decodeURIComponent(escape(encodedString)); - return decodedString; - } - static FromBinary(text) { - const stringLength = text.length; - const resultView = new Uint8Array(stringLength); - for (let i = 0; i < stringLength; i++) { - resultView[i] = text.charCodeAt(i); - } - return resultView.buffer; - } - static ToBinary(buffer) { - const buf = BufferSourceConverter.toUint8Array(buffer); - let res = ""; - for (let i = 0; i < buf.length; i++) { - res += String.fromCharCode(buf[i]); - } - return res; - } - static ToHex(buffer) { - const buf = BufferSourceConverter.toUint8Array(buffer); - const splitter = ""; - const res = []; - const len = buf.length; - for (let i = 0; i < len; i++) { - const char = buf[i].toString(16).padStart(2, "0"); - res.push(char); - } - return res.join(splitter); - } - static FromHex(hexString) { - let formatted = this.formatString(hexString); - if (!formatted) { - return new ArrayBuffer(0); - } - if (!Convert.isHex(formatted)) { - throw new TypeError("Argument 'hexString' is not HEX encoded"); - } - if (formatted.length % 2) { - formatted = `0${formatted}`; - } - const res = new Uint8Array(formatted.length / 2); - for (let i = 0; i < formatted.length; i = i + 2) { - const c = formatted.slice(i, i + 2); - res[i / 2] = parseInt(c, 16); - } - return res.buffer; - } - static Base64Padding(base64) { - const padCount = 4 - (base64.length % 4); - if (padCount < 4) { - for (let i = 0; i < padCount; i++) { - base64 += "="; - } - } - return base64; - } - static formatString(data) { - return (data === null || data === void 0 ? void 0 : data.replace(/[\n\r\t ]/g, "")) || ""; - } + var ar = this._a | 0 + var br = this._b | 0 + var cr = this._c | 0 + var dr = this._d | 0 + var er = this._e | 0 + + // computation + for (var i = 0; i < 80; i += 1) { + var tl + var tr + if (i < 16) { + tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]) + tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]) + } else if (i < 32) { + tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]) + tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]) + } else if (i < 48) { + tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]) + tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]) + } else if (i < 64) { + tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]) + tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]) + } else { // if (i<80) { + tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]) + tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]) + } + + al = el + el = dl + dl = rotl(cl, 10) + cl = bl + bl = tl + + ar = er + er = dr + dr = rotl(cr, 10) + cr = br + br = tr } - function assign(target, ...sources) { - const res = arguments[0]; - for (let i = 1; i < arguments.length; i++) { - const obj = arguments[i]; - for (const prop in obj) { - res[prop] = obj[prop]; - } - } - return res; - } - function combine(...buf) { - const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur); - const res = new Uint8Array(totalByteLength); - let currentPos = 0; - buf.map((item) => new Uint8Array(item)).forEach((arr) => { - for (const item2 of arr) { - res[currentPos++] = item2; - } - }); - return res.buffer; - } - function isEqual(bytes1, bytes2) { - if (!(bytes1 && bytes2)) { - return false; - } - if (bytes1.byteLength !== bytes2.byteLength) { - return false; - } - const b1 = new Uint8Array(bytes1); - const b2 = new Uint8Array(bytes2); - for (let i = 0; i < bytes1.byteLength; i++) { - if (b1[i] !== b2[i]) { - return false; - } - } - return true; + // update state + var t = (this._b + cl + dr) | 0 + this._b = (this._c + dl + er) | 0 + this._c = (this._d + el + ar) | 0 + this._d = (this._e + al + br) | 0 + this._e = (this._a + bl + cr) | 0 + this._a = t +} + +RIPEMD160.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset++] = 0x80 + if (this._blockOffset > 56) { + this._block.fill(0, this._blockOffset, 64) + this._update() + this._blockOffset = 0 } - exports.BufferSourceConverter = BufferSourceConverter; - exports.Convert = Convert; - exports.assign = assign; - exports.combine = combine; - exports.isEqual = isEqual; + this._block.fill(0, this._blockOffset, 56) + this._block.writeUInt32LE(this._length[0], 56) + this._block.writeUInt32LE(this._length[1], 60) + this._update() + + // produce result + var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20) + buffer.writeInt32LE(this._a, 0) + buffer.writeInt32LE(this._b, 4) + buffer.writeInt32LE(this._c, 8) + buffer.writeInt32LE(this._d, 12) + buffer.writeInt32LE(this._e, 16) + return buffer +} + +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} - Object.defineProperty(exports, '__esModule', { value: true }); +function fn1 (a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0 +} -}))); +function fn2 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0 +} -}).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":88}],221:[function(require,module,exports){ -"use strict"; +function fn3 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0 +} -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getUTCDate = getUTCDate; -exports.getParametersValue = getParametersValue; -exports.bufferToHexCodes = bufferToHexCodes; -exports.checkBufferParams = checkBufferParams; -exports.utilFromBase = utilFromBase; -exports.utilToBase = utilToBase; -exports.utilConcatBuf = utilConcatBuf; -exports.utilConcatView = utilConcatView; -exports.utilDecodeTC = utilDecodeTC; -exports.utilEncodeTC = utilEncodeTC; -exports.isEqualBuffer = isEqualBuffer; -exports.padNumber = padNumber; -exports.toBase64 = toBase64; -exports.fromBase64 = fromBase64; -exports.arrayBufferToString = arrayBufferToString; -exports.stringToArrayBuffer = stringToArrayBuffer; -exports.nearestPowerOf2 = nearestPowerOf2; -exports.clearProps = clearProps; -//************************************************************************************** -/** - * Making UTC date from local date - * @param {Date} date Date to convert from - * @returns {Date} - */ -function getUTCDate(date) { - // noinspection NestedFunctionCallJS, MagicNumberJS - return new Date(date.getTime() + date.getTimezoneOffset() * 60000); +function fn4 (a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0 } -//************************************************************************************** -// noinspection FunctionWithMultipleReturnPointsJS -/** - * Get value for input parameters, or set a default value - * @param {Object} parameters - * @param {string} name - * @param defaultValue - */ -function getParametersValue(parameters, name, defaultValue) { - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS - if (parameters instanceof Object === false) return defaultValue; - // noinspection NonBlockStatementBodyJS - if (name in parameters) return parameters[name]; +function fn5 (a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0 +} - return defaultValue; +module.exports = RIPEMD160 + +},{"buffer":83,"hash-base":158,"inherits":188}],219:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer } -//************************************************************************************** -/** - * Converts "ArrayBuffer" into a hexdecimal string - * @param {ArrayBuffer} inputBuffer - * @param {number} [inputOffset=0] - * @param {number} [inputLength=inputBuffer.byteLength] - * @param {boolean} [insertSpace=false] - * @returns {string} - */ -function bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = inputBuffer.byteLength - inputOffset, insertSpace = false) { - let result = ""; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} - try { - for (var _iterator = new Uint8Array(inputBuffer, inputOffset, inputLength)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - const item = _step.value; +SafeBuffer.prototype = Object.create(Buffer.prototype) - // noinspection ChainedFunctionCallJS - const str = item.toString(16).toUpperCase(); +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS - if (str.length === 1) result += "0"; +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} - result += str; +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} - // noinspection NonBlockStatementBodyJS - if (insertSpace) result += " "; - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} - return result.trim(); +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) } -//************************************************************************************** -// noinspection JSValidateJSDoc, FunctionWithMultipleReturnPointsJS -/** - * Check input "ArrayBuffer" for common functions - * @param {LocalBaseBlock} baseBlock - * @param {ArrayBuffer} inputBuffer - * @param {number} inputOffset - * @param {number} inputLength - * @returns {boolean} - */ -function checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { - // noinspection ConstantOnRightSideOfComparisonJS - if (inputBuffer instanceof ArrayBuffer === false) { - // noinspection JSUndefinedPropertyAssignment - baseBlock.error = "Wrong parameter: inputBuffer must be \"ArrayBuffer\""; - return false; - } - // noinspection ConstantOnRightSideOfComparisonJS - if (inputBuffer.byteLength === 0) { - // noinspection JSUndefinedPropertyAssignment - baseBlock.error = "Wrong parameter: inputBuffer has zero length"; - return false; - } +},{"buffer":83}],220:[function(require,module,exports){ +(function (process){(function (){ +/* eslint-disable node/no-deprecated-api */ - // noinspection ConstantOnRightSideOfComparisonJS - if (inputOffset < 0) { - // noinspection JSUndefinedPropertyAssignment - baseBlock.error = "Wrong parameter: inputOffset less than zero"; - return false; - } +'use strict' - // noinspection ConstantOnRightSideOfComparisonJS - if (inputLength < 0) { - // noinspection JSUndefinedPropertyAssignment - baseBlock.error = "Wrong parameter: inputLength less than zero"; - return false; - } +var buffer = require('buffer') +var Buffer = buffer.Buffer - // noinspection ConstantOnRightSideOfComparisonJS - if (inputBuffer.byteLength - inputOffset - inputLength < 0) { - // noinspection JSUndefinedPropertyAssignment - baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; - return false; - } +var safer = {} - return true; +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] } -//************************************************************************************** -// noinspection FunctionWithMultipleReturnPointsJS -/** - * Convert number from 2^base to 2^10 - * @param {Uint8Array} inputBuffer - * @param {number} inputBase - * @returns {number} - */ -function utilFromBase(inputBuffer, inputBase) { - let result = 0; - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS - if (inputBuffer.length === 1) return inputBuffer[0]; +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS - for (let i = inputBuffer.length - 1; i >= 0; i--) result += inputBuffer[inputBuffer.length - 1 - i] * Math.pow(2, inputBase * i); +safer.Buffer.prototype = Buffer.prototype - return result; +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } } -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS, FunctionWithMultipleReturnPointsJS -/** - * Convert number from 2^10 to 2^base - * @param {!number} value The number to convert - * @param {!number} base The base for 2^base - * @param {number} [reserved=0] Pre-defined number of bytes in output array (-1 = limited by function itself) - * @returns {ArrayBuffer} - */ -function utilToBase(value, base, reserved = -1) { - const internalReserved = reserved; - let internalValue = value; - - let result = 0; - let biggest = Math.pow(2, base); - // noinspection ConstantOnRightSideOfComparisonJS - for (let i = 1; i < 8; i++) { - if (value < biggest) { - let retBuf; +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} - // noinspection ConstantOnRightSideOfComparisonJS - if (internalReserved < 0) { - retBuf = new ArrayBuffer(i); - result = i; - } else { - // noinspection NonBlockStatementBodyJS - if (internalReserved < i) return new ArrayBuffer(0); +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} - retBuf = new ArrayBuffer(internalReserved); +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} - result = internalReserved; - } +module.exports = safer - const retView = new Uint8Array(retBuf); +}).call(this)}).call(this,require('_process')) +},{"_process":206,"buffer":83}],221:[function(require,module,exports){ +var Buffer = require('safe-buffer').Buffer - // noinspection ConstantOnRightSideOfComparisonJS - for (let j = i - 1; j >= 0; j--) { - const basis = Math.pow(2, j * base); +// prototype class for hash functions +function Hash (blockSize, finalSize) { + this._block = Buffer.alloc(blockSize) + this._finalSize = finalSize + this._blockSize = blockSize + this._len = 0 +} - retView[result - j - 1] = Math.floor(internalValue / basis); - internalValue -= retView[result - j - 1] * basis; - } +Hash.prototype.update = function (data, enc) { + if (typeof data === 'string') { + enc = enc || 'utf8' + data = Buffer.from(data, enc) + } - return retBuf; - } + var block = this._block + var blockSize = this._blockSize + var length = data.length + var accum = this._len - biggest *= Math.pow(2, base); - } + for (var offset = 0; offset < length;) { + var assigned = accum % blockSize + var remainder = Math.min(length - offset, blockSize - assigned) - return new ArrayBuffer(0); -} -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS -/** - * Concatenate two ArrayBuffers - * @param {...ArrayBuffer} buffers Set of ArrayBuffer - */ -function utilConcatBuf(...buffers) { - //region Initial variables - let outputLength = 0; - let prevLength = 0; - //endregion + for (var i = 0; i < remainder; i++) { + block[assigned + i] = data[offset + i] + } - //region Calculate output length + accum += remainder + offset += remainder - // noinspection NonBlockStatementBodyJS - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; + if ((accum % blockSize) === 0) { + this._update(block) + } + } - try { - for (var _iterator2 = buffers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - const buffer = _step2.value; + this._len += length + return this +} - outputLength += buffer.byteLength; - } //endregion - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } +Hash.prototype.digest = function (enc) { + var rem = this._len % this._blockSize - const retBuf = new ArrayBuffer(outputLength); - const retView = new Uint8Array(retBuf); + this._block[rem] = 0x80 - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; + // zero (rem + 1) trailing bits, where (rem + 1) is the smallest + // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize + this._block.fill(0, rem + 1) - try { - for (var _iterator3 = buffers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - const buffer = _step3.value; + if (rem >= this._finalSize) { + this._update(this._block) + this._block.fill(0) + } - // noinspection NestedFunctionCallJS - retView.set(new Uint8Array(buffer), prevLength); - prevLength += buffer.byteLength; - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } + var bits = this._len * 8 - return retBuf; -} -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS -/** - * Concatenate two Uint8Array - * @param {...Uint8Array} views Set of Uint8Array - */ -function utilConcatView(...views) { - //region Initial variables - let outputLength = 0; - let prevLength = 0; - //endregion + // uint32 + if (bits <= 0xffffffff) { + this._block.writeUInt32BE(bits, this._blockSize - 4) - //region Calculate output length - // noinspection NonBlockStatementBodyJS - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; + // uint64 + } else { + var lowBits = (bits & 0xffffffff) >>> 0 + var highBits = (bits - lowBits) / 0x100000000 - try { - for (var _iterator4 = views[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { - const view = _step4.value; + this._block.writeUInt32BE(highBits, this._blockSize - 8) + this._block.writeUInt32BE(lowBits, this._blockSize - 4) + } - outputLength += view.length; - } //endregion - } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; - } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } - } + this._update(this._block) + var hash = this._hash() - const retBuf = new ArrayBuffer(outputLength); - const retView = new Uint8Array(retBuf); + return enc ? hash.toString(enc) : hash +} - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; +Hash.prototype._update = function () { + throw new Error('_update must be implemented by subclass') +} - try { - for (var _iterator5 = views[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { - const view = _step5.value; +module.exports = Hash - retView.set(view, prevLength); - prevLength += view.length; - } - } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; - } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5.return) { - _iterator5.return(); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } - } - } +},{"safe-buffer":219}],222:[function(require,module,exports){ +var exports = module.exports = function SHA (algorithm) { + algorithm = algorithm.toLowerCase() - return retView; + var Algorithm = exports[algorithm] + if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') + + return new Algorithm() } -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS -/** - * Decoding of "two complement" values - * The function must be called in scope of instance of "hexBlock" class ("valueHex" and "warnings" properties must be present) - * @returns {number} - */ -function utilDecodeTC() { - const buf = new Uint8Array(this.valueHex); - // noinspection ConstantOnRightSideOfComparisonJS - if (this.valueHex.byteLength >= 2) { - //noinspection JSBitwiseOperatorUsage, ConstantOnRightSideOfComparisonJS, LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - const condition1 = buf[0] === 0xFF && buf[1] & 0x80; - // noinspection ConstantOnRightSideOfComparisonJS, LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - const condition2 = buf[0] === 0x00 && (buf[1] & 0x80) === 0x00; +exports.sha = require('./sha') +exports.sha1 = require('./sha1') +exports.sha224 = require('./sha224') +exports.sha256 = require('./sha256') +exports.sha384 = require('./sha384') +exports.sha512 = require('./sha512') - // noinspection NonBlockStatementBodyJS - if (condition1 || condition2) this.warnings.push("Needlessly long format"); - } +},{"./sha":223,"./sha1":224,"./sha224":225,"./sha256":226,"./sha384":227,"./sha512":228}],223:[function(require,module,exports){ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined + * in FIPS PUB 180-1 + * This source code is derived from sha1.js of the same repository. + * The difference between SHA-0 and SHA-1 is just a bitwise rotate left + * operation was added. + */ - //region Create big part of the integer - const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength); - const bigIntView = new Uint8Array(bigIntBuffer); - // noinspection NonBlockStatementBodyJS - for (let i = 0; i < this.valueHex.byteLength; i++) bigIntView[i] = 0; +var inherits = require('inherits') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer - // noinspection MagicNumberJS, NonShortCircuitBooleanExpressionJS - bigIntView[0] = buf[0] & 0x80; // mask only the biggest bit +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] - const bigInt = utilFromBase(bigIntView, 8); - //endregion +var W = new Array(80) - //region Create small part of the integer - const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength); - const smallIntView = new Uint8Array(smallIntBuffer); - // noinspection NonBlockStatementBodyJS - for (let j = 0; j < this.valueHex.byteLength; j++) smallIntView[j] = buf[j]; +function Sha () { + this.init() + this._w = W - // noinspection MagicNumberJS - smallIntView[0] &= 0x7F; // mask biggest bit + Hash.call(this, 64, 56) +} - const smallInt = utilFromBase(smallIntView, 8); - //endregion +inherits(Sha, Hash) - return smallInt - bigInt; +Sha.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this } -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS, FunctionWithMultipleReturnPointsJS -/** - * Encode integer value to "two complement" format - * @param {number} value Value to encode - * @returns {ArrayBuffer} - */ -function utilEncodeTC(value) { - // noinspection ConstantOnRightSideOfComparisonJS, ConditionalExpressionJS - const modValue = value < 0 ? value * -1 : value; - let bigInt = 128; - // noinspection ConstantOnRightSideOfComparisonJS - for (let i = 1; i < 8; i++) { - if (modValue <= bigInt) { - // noinspection ConstantOnRightSideOfComparisonJS - if (value < 0) { - const smallInt = bigInt - modValue; +function rotl5 (num) { + return (num << 5) | (num >>> 27) +} - const retBuf = utilToBase(smallInt, 8, i); - const retView = new Uint8Array(retBuf); +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} - // noinspection MagicNumberJS - retView[0] |= 0x80; +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} - return retBuf; - } +Sha.prototype._update = function (M) { + var W = this._w - let retBuf = utilToBase(modValue, 8, i); - let retView = new Uint8Array(retBuf); + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 - //noinspection JSBitwiseOperatorUsage, MagicNumberJS, NonShortCircuitBooleanExpressionJS - if (retView[0] & 0x80) { - //noinspection JSCheckFunctionSignatures - const tempBuf = retBuf.slice(0); - const tempView = new Uint8Array(tempBuf); + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] - retBuf = new ArrayBuffer(retBuf.byteLength + 1); - // noinspection ReuseOfLocalVariableJS - retView = new Uint8Array(retBuf); + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - // noinspection NonBlockStatementBodyJS - for (let k = 0; k < tempBuf.byteLength; k++) retView[k + 1] = tempView[k]; + e = d + d = c + c = rotl30(b) + b = a + a = t + } - // noinspection MagicNumberJS - retView[0] = 0x00; - } + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} - return retBuf; - } +Sha.prototype._hash = function () { + var H = Buffer.allocUnsafe(20) - bigInt *= Math.pow(2, 8); - } + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) - return new ArrayBuffer(0); + return H } -//************************************************************************************** -// noinspection FunctionWithMultipleReturnPointsJS, ParameterNamingConventionJS -/** - * Compare two array buffers - * @param {!ArrayBuffer} inputBuffer1 - * @param {!ArrayBuffer} inputBuffer2 - * @returns {boolean} + +module.exports = Sha + +},{"./hash":221,"inherits":188,"safe-buffer":219}],224:[function(require,module,exports){ +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. */ -function isEqualBuffer(inputBuffer1, inputBuffer2) { - // noinspection NonBlockStatementBodyJS - if (inputBuffer1.byteLength !== inputBuffer2.byteLength) return false; - // noinspection LocalVariableNamingConventionJS - const view1 = new Uint8Array(inputBuffer1); - // noinspection LocalVariableNamingConventionJS - const view2 = new Uint8Array(inputBuffer2); +var inherits = require('inherits') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer - for (let i = 0; i < view1.length; i++) { - // noinspection NonBlockStatementBodyJS - if (view1[i] !== view2[i]) return false; - } +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] - return true; +var W = new Array(80) + +function Sha1 () { + this.init() + this._w = W + + Hash.call(this, 64, 56) } -//************************************************************************************** -// noinspection FunctionWithMultipleReturnPointsJS -/** - * Pad input number with leade "0" if needed - * @returns {string} - * @param {number} inputNumber - * @param {number} fullLength - */ -function padNumber(inputNumber, fullLength) { - const str = inputNumber.toString(10); - // noinspection NonBlockStatementBodyJS - if (fullLength < str.length) return ""; +inherits(Sha1, Hash) - const dif = fullLength - str.length; +Sha1.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 - const padding = new Array(dif); - // noinspection NonBlockStatementBodyJS - for (let i = 0; i < dif; i++) padding[i] = "0"; + return this +} - const paddingString = padding.join(""); +function rotl1 (num) { + return (num << 1) | (num >>> 31) +} - return paddingString.concat(str); +function rotl5 (num) { + return (num << 5) | (num >>> 27) } -//************************************************************************************** -const base64Template = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; -const base64UrlTemplate = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; -//************************************************************************************** -// noinspection FunctionWithMultipleLoopsJS, OverlyComplexFunctionJS, FunctionTooLongJS, FunctionNamingConventionJS -/** - * Encode string into BASE64 (or "base64url") - * @param {string} input - * @param {boolean} useUrlTemplate If "true" then output would be encoded using "base64url" - * @param {boolean} skipPadding Skip BASE-64 padding or not - * @param {boolean} skipLeadingZeros Skip leading zeros in input data or not - * @returns {string} - */ -function toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) { - let i = 0; - // noinspection LocalVariableNamingConventionJS - let flag1 = 0; - // noinspection LocalVariableNamingConventionJS - let flag2 = 0; +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} - let output = ""; +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} - // noinspection ConditionalExpressionJS - const template = useUrlTemplate ? base64UrlTemplate : base64Template; +Sha1.prototype._update = function (M) { + var W = this._w - if (skipLeadingZeros) { - let nonZeroPosition = 0; + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 - for (let i = 0; i < input.length; i++) { - // noinspection ConstantOnRightSideOfComparisonJS - if (input.charCodeAt(i) !== 0) { - nonZeroPosition = i; - // noinspection BreakStatementJS - break; - } - } + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) - // noinspection AssignmentToFunctionParameterJS - input = input.slice(nonZeroPosition); - } + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - while (i < input.length) { - // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS - const chr1 = input.charCodeAt(i++); - // noinspection NonBlockStatementBodyJS - if (i >= input.length) flag1 = 1; - // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS - const chr2 = input.charCodeAt(i++); - // noinspection NonBlockStatementBodyJS - if (i >= input.length) flag2 = 1; - // noinspection LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS - const chr3 = input.charCodeAt(i++); + e = d + d = c + c = rotl30(b) + b = a + a = t + } - // noinspection LocalVariableNamingConventionJS - const enc1 = chr1 >> 2; - // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - const enc2 = (chr1 & 0x03) << 4 | chr2 >> 4; - // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - let enc3 = (chr2 & 0x0F) << 2 | chr3 >> 6; - // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - let enc4 = chr3 & 0x3F; + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} - // noinspection ConstantOnRightSideOfComparisonJS - if (flag1 === 1) { - // noinspection NestedAssignmentJS, AssignmentResultUsedJS, MagicNumberJS - enc3 = enc4 = 64; - } else { - // noinspection ConstantOnRightSideOfComparisonJS - if (flag2 === 1) { - // noinspection MagicNumberJS - enc4 = 64; - } - } +Sha1.prototype._hash = function () { + var H = Buffer.allocUnsafe(20) - // noinspection NonBlockStatementBodyJS - if (skipPadding) { - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS - if (enc3 === 64) output += `${template.charAt(enc1)}${template.charAt(enc2)}`;else { - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS - if (enc4 === 64) output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`;else output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; - } - } else output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; - } + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) - return output; + return H } -//************************************************************************************** -// noinspection FunctionWithMoreThanThreeNegationsJS, FunctionWithMultipleLoopsJS, OverlyComplexFunctionJS, FunctionNamingConventionJS -/** - * Decode string from BASE64 (or "base64url") - * @param {string} input - * @param {boolean} [useUrlTemplate=false] If "true" then output would be encoded using "base64url" - * @param {boolean} [cutTailZeros=false] If "true" then cut tailing zeroz from function result - * @returns {string} - */ -function fromBase64(input, useUrlTemplate = false, cutTailZeros = false) { - // noinspection ConditionalExpressionJS - const template = useUrlTemplate ? base64UrlTemplate : base64Template; - - //region Aux functions - // noinspection FunctionWithMultipleReturnPointsJS, NestedFunctionJS - function indexof(toSearch) { - // noinspection ConstantOnRightSideOfComparisonJS, MagicNumberJS - for (let i = 0; i < 64; i++) { - // noinspection NonBlockStatementBodyJS - if (template.charAt(i) === toSearch) return i; - } - // noinspection MagicNumberJS - return 64; - } +module.exports = Sha1 - // noinspection NestedFunctionJS - function test(incoming) { - // noinspection ConstantOnRightSideOfComparisonJS, ConditionalExpressionJS, MagicNumberJS - return incoming === 64 ? 0x00 : incoming; - } - //endregion +},{"./hash":221,"inherits":188,"safe-buffer":219}],225:[function(require,module,exports){ +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ - let i = 0; +var inherits = require('inherits') +var Sha256 = require('./sha256') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer - let output = ""; +var W = new Array(64) - while (i < input.length) { - // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, IncrementDecrementResultUsedJS - const enc1 = indexof(input.charAt(i++)); - // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS - const enc2 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); - // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS - const enc3 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); - // noinspection NestedFunctionCallJS, LocalVariableNamingConventionJS, ConditionalExpressionJS, MagicNumberJS, IncrementDecrementResultUsedJS - const enc4 = i >= input.length ? 0x00 : indexof(input.charAt(i++)); +function Sha224 () { + this.init() - // noinspection LocalVariableNamingConventionJS, NonShortCircuitBooleanExpressionJS - const chr1 = test(enc1) << 2 | test(enc2) >> 4; - // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - const chr2 = (test(enc2) & 0x0F) << 4 | test(enc3) >> 2; - // noinspection LocalVariableNamingConventionJS, MagicNumberJS, NonShortCircuitBooleanExpressionJS - const chr3 = (test(enc3) & 0x03) << 6 | test(enc4); + this._w = W // new Array(64) - output += String.fromCharCode(chr1); + Hash.call(this, 64, 56) +} - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS - if (enc3 !== 64) output += String.fromCharCode(chr2); +inherits(Sha224, Sha256) - // noinspection ConstantOnRightSideOfComparisonJS, NonBlockStatementBodyJS, MagicNumberJS - if (enc4 !== 64) output += String.fromCharCode(chr3); - } +Sha224.prototype.init = function () { + this._a = 0xc1059ed8 + this._b = 0x367cd507 + this._c = 0x3070dd17 + this._d = 0xf70e5939 + this._e = 0xffc00b31 + this._f = 0x68581511 + this._g = 0x64f98fa7 + this._h = 0xbefa4fa4 - if (cutTailZeros) { - const outputLength = output.length; - let nonZeroStart = -1; + return this +} - // noinspection ConstantOnRightSideOfComparisonJS - for (let i = outputLength - 1; i >= 0; i--) { - // noinspection ConstantOnRightSideOfComparisonJS - if (output.charCodeAt(i) !== 0) { - nonZeroStart = i; - // noinspection BreakStatementJS - break; - } - } +Sha224.prototype._hash = function () { + var H = Buffer.allocUnsafe(28) - // noinspection NonBlockStatementBodyJS, NegatedIfStatementJS - if (nonZeroStart !== -1) output = output.slice(0, nonZeroStart + 1);else output = ""; - } + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) - return output; + return H } -//************************************************************************************** -function arrayBufferToString(buffer) { - let resultString = ""; - const view = new Uint8Array(buffer); - // noinspection NonBlockStatementBodyJS - var _iteratorNormalCompletion6 = true; - var _didIteratorError6 = false; - var _iteratorError6 = undefined; +module.exports = Sha224 - try { - for (var _iterator6 = view[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { - const element = _step6.value; +},{"./hash":221,"./sha256":226,"inherits":188,"safe-buffer":219}],226:[function(require,module,exports){ +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ - resultString += String.fromCharCode(element); - } - } catch (err) { - _didIteratorError6 = true; - _iteratorError6 = err; - } finally { - try { - if (!_iteratorNormalCompletion6 && _iterator6.return) { - _iterator6.return(); - } - } finally { - if (_didIteratorError6) { - throw _iteratorError6; - } - } - } +var inherits = require('inherits') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer + +var K = [ + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +] - return resultString; -} -//************************************************************************************** -function stringToArrayBuffer(str) { - const stringLength = str.length; +var W = new Array(64) - const resultBuffer = new ArrayBuffer(stringLength); - const resultView = new Uint8Array(resultBuffer); +function Sha256 () { + this.init() - // noinspection NonBlockStatementBodyJS - for (let i = 0; i < stringLength; i++) resultView[i] = str.charCodeAt(i); + this._w = W // new Array(64) - return resultBuffer; + Hash.call(this, 64, 56) } -//************************************************************************************** -const log2 = Math.log(2); -//************************************************************************************** -// noinspection FunctionNamingConventionJS -/** - * Get nearest to input length power of 2 - * @param {number} length Current length of existing array - * @returns {number} - */ -function nearestPowerOf2(length) { - const base = Math.log(length) / log2; - - const floor = Math.floor(base); - const round = Math.round(base); - // noinspection ConditionalExpressionJS - return floor === round ? floor : round; -} -//************************************************************************************** -/** - * Delete properties by name from specified object - * @param {Object} object Object to delete properties from - * @param {Array.<string>} propsArray Array of properties names - */ -function clearProps(object, propsArray) { - var _iteratorNormalCompletion7 = true; - var _didIteratorError7 = false; - var _iteratorError7 = undefined; +inherits(Sha256, Hash) - try { - for (var _iterator7 = propsArray[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { - const prop = _step7.value; +Sha256.prototype.init = function () { + this._a = 0x6a09e667 + this._b = 0xbb67ae85 + this._c = 0x3c6ef372 + this._d = 0xa54ff53a + this._e = 0x510e527f + this._f = 0x9b05688c + this._g = 0x1f83d9ab + this._h = 0x5be0cd19 - delete object[prop]; - } - } catch (err) { - _didIteratorError7 = true; - _iteratorError7 = err; - } finally { - try { - if (!_iteratorNormalCompletion7 && _iterator7.return) { - _iterator7.return(); - } - } finally { - if (_didIteratorError7) { - throw _iteratorError7; - } - } - } + return this } -//************************************************************************************** -},{}],222:[function(require,module,exports){ -(function (process,global){(function (){ -'use strict' +function ch (x, y, z) { + return z ^ (x & (y ^ z)) +} -// limit of Crypto.getRandomValues() -// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues -var MAX_BYTES = 65536 +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} -// Node supports requesting up to this number of bytes -// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48 -var MAX_UINT32 = 4294967295 +function sigma0 (x) { + return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10) +} -function oldBrowser () { - throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') +function sigma1 (x) { + return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7) } -var Buffer = require('safe-buffer').Buffer -var crypto = global.crypto || global.msCrypto +function gamma0 (x) { + return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3) +} -if (crypto && crypto.getRandomValues) { - module.exports = randomBytes -} else { - module.exports = oldBrowser +function gamma1 (x) { + return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10) } -function randomBytes (size, cb) { - // phantomjs needs to throw - if (size > MAX_UINT32) throw new RangeError('requested too many random bytes') +Sha256.prototype._update = function (M) { + var W = this._w - var bytes = Buffer.allocUnsafe(size) + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + var f = this._f | 0 + var g = this._g | 0 + var h = this._h | 0 - if (size > 0) { // getRandomValues fails on IE if size == 0 - if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues - // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues - for (var generated = 0; generated < size; generated += MAX_BYTES) { - // buffer.slice automatically checks if the end is past the end of - // the buffer so we don't have to here - crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES)) - } - } else { - crypto.getRandomValues(bytes) - } - } + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0 - if (typeof cb === 'function') { - return process.nextTick(function () { - cb(null, bytes) - }) + for (var j = 0; j < 64; ++j) { + var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0 + var T2 = (sigma0(a) + maj(a, b, c)) | 0 + + h = g + g = f + f = e + e = (d + T1) | 0 + d = c + c = b + b = a + a = (T1 + T2) | 0 } - return bytes + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 + this._f = (f + this._f) | 0 + this._g = (g + this._g) | 0 + this._h = (h + this._h) | 0 } -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":212,"safe-buffer":225}],223:[function(require,module,exports){ -(function (process,global){(function (){ -'use strict' - -function oldBrowser () { - throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') -} -var safeBuffer = require('safe-buffer') -var randombytes = require('randombytes') -var Buffer = safeBuffer.Buffer -var kBufferMaxLength = safeBuffer.kMaxLength -var crypto = global.crypto || global.msCrypto -var kMaxUint32 = Math.pow(2, 32) - 1 -function assertOffset (offset, length) { - if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare - throw new TypeError('offset must be a number') - } +Sha256.prototype._hash = function () { + var H = Buffer.allocUnsafe(32) - if (offset > kMaxUint32 || offset < 0) { - throw new TypeError('offset must be a uint32') - } + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + H.writeInt32BE(this._h, 28) - if (offset > kBufferMaxLength || offset > length) { - throw new RangeError('offset out of range') - } + return H } -function assertSize (size, offset, length) { - if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare - throw new TypeError('size must be a number') - } +module.exports = Sha256 - if (size > kMaxUint32 || size < 0) { - throw new TypeError('size must be a uint32') - } +},{"./hash":221,"inherits":188,"safe-buffer":219}],227:[function(require,module,exports){ +var inherits = require('inherits') +var SHA512 = require('./sha512') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer - if (size + offset > length || size > kBufferMaxLength) { - throw new RangeError('buffer too small') - } -} -if ((crypto && crypto.getRandomValues) || !process.browser) { - exports.randomFill = randomFill - exports.randomFillSync = randomFillSync -} else { - exports.randomFill = oldBrowser - exports.randomFillSync = oldBrowser -} -function randomFill (buf, offset, size, cb) { - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } +var W = new Array(160) - if (typeof offset === 'function') { - cb = offset - offset = 0 - size = buf.length - } else if (typeof size === 'function') { - cb = size - size = buf.length - offset - } else if (typeof cb !== 'function') { - throw new TypeError('"cb" argument must be a function') - } - assertOffset(offset, buf.length) - assertSize(size, offset, buf.length) - return actualFill(buf, offset, size, cb) -} +function Sha384 () { + this.init() + this._w = W -function actualFill (buf, offset, size, cb) { - if (process.browser) { - var ourBuf = buf.buffer - var uint = new Uint8Array(ourBuf, offset, size) - crypto.getRandomValues(uint) - if (cb) { - process.nextTick(function () { - cb(null, buf) - }) - return - } - return buf - } - if (cb) { - randombytes(size, function (err, bytes) { - if (err) { - return cb(err) - } - bytes.copy(buf, offset) - cb(null, buf) - }) - return - } - var bytes = randombytes(size) - bytes.copy(buf, offset) - return buf + Hash.call(this, 128, 112) } -function randomFillSync (buf, offset, size) { - if (typeof offset === 'undefined') { - offset = 0 - } - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array') - } - assertOffset(offset, buf.length) +inherits(Sha384, SHA512) - if (size === undefined) size = buf.length - offset +Sha384.prototype.init = function () { + this._ah = 0xcbbb9d5d + this._bh = 0x629a292a + this._ch = 0x9159015a + this._dh = 0x152fecd8 + this._eh = 0x67332667 + this._fh = 0x8eb44a87 + this._gh = 0xdb0c2e0d + this._hh = 0x47b5481d - assertSize(size, offset, buf.length) + this._al = 0xc1059ed8 + this._bl = 0x367cd507 + this._cl = 0x3070dd17 + this._dl = 0xf70e5939 + this._el = 0xffc00b31 + this._fl = 0x68581511 + this._gl = 0x64f98fa7 + this._hl = 0xbefa4fa4 - return actualFill(buf, offset, size) + return this } -}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":212,"randombytes":222,"safe-buffer":225}],224:[function(require,module,exports){ -'use strict' -var Buffer = require('buffer').Buffer -var inherits = require('inherits') -var HashBase = require('hash-base') +Sha384.prototype._hash = function () { + var H = Buffer.allocUnsafe(48) -var ARRAY16 = new Array(16) + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } -var zl = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 -] + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) -var zr = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 -] + return H +} -var sl = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 -] +module.exports = Sha384 -var sr = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +},{"./hash":221,"./sha512":228,"inherits":188,"safe-buffer":219}],228:[function(require,module,exports){ +var inherits = require('inherits') +var Hash = require('./hash') +var Buffer = require('safe-buffer').Buffer + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 ] -var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] -var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000] +var W = new Array(160) -function RIPEMD160 () { - HashBase.call(this, 64) +function Sha512 () { + this.init() + this._w = W - // state - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 + Hash.call(this, 128, 112) } -inherits(RIPEMD160, HashBase) - -RIPEMD160.prototype._update = function () { - var words = ARRAY16 - for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4) - - var al = this._a | 0 - var bl = this._b | 0 - var cl = this._c | 0 - var dl = this._d | 0 - var el = this._e | 0 - - var ar = this._a | 0 - var br = this._b | 0 - var cr = this._c | 0 - var dr = this._d | 0 - var er = this._e | 0 - - // computation - for (var i = 0; i < 80; i += 1) { - var tl - var tr - if (i < 16) { - tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]) - tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]) - } else if (i < 32) { - tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]) - tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]) - } else if (i < 48) { - tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]) - tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]) - } else if (i < 64) { - tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]) - tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]) - } else { // if (i<80) { - tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]) - tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]) - } +inherits(Sha512, Hash) - al = el - el = dl - dl = rotl(cl, 10) - cl = bl - bl = tl +Sha512.prototype.init = function () { + this._ah = 0x6a09e667 + this._bh = 0xbb67ae85 + this._ch = 0x3c6ef372 + this._dh = 0xa54ff53a + this._eh = 0x510e527f + this._fh = 0x9b05688c + this._gh = 0x1f83d9ab + this._hh = 0x5be0cd19 - ar = er - er = dr - dr = rotl(cr, 10) - cr = br - br = tr - } + this._al = 0xf3bcc908 + this._bl = 0x84caa73b + this._cl = 0xfe94f82b + this._dl = 0x5f1d36f1 + this._el = 0xade682d1 + this._fl = 0x2b3e6c1f + this._gl = 0xfb41bd6b + this._hl = 0x137e2179 - // update state - var t = (this._b + cl + dr) | 0 - this._b = (this._c + dl + er) | 0 - this._c = (this._d + el + ar) | 0 - this._d = (this._e + al + br) | 0 - this._e = (this._a + bl + cr) | 0 - this._a = t + return this } -RIPEMD160.prototype._digest = function () { - // create padding and handle blocks - this._block[this._blockOffset++] = 0x80 - if (this._blockOffset > 56) { - this._block.fill(0, this._blockOffset, 64) - this._update() - this._blockOffset = 0 - } +function Ch (x, y, z) { + return z ^ (x & (y ^ z)) +} - this._block.fill(0, this._blockOffset, 56) - this._block.writeUInt32LE(this._length[0], 56) - this._block.writeUInt32LE(this._length[1], 60) - this._update() +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} - // produce result - var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20) - buffer.writeInt32LE(this._a, 0) - buffer.writeInt32LE(this._b, 4) - buffer.writeInt32LE(this._c, 8) - buffer.writeInt32LE(this._d, 12) - buffer.writeInt32LE(this._e, 16) - return buffer +function sigma0 (x, xl) { + return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25) } -function rotl (x, n) { - return (x << n) | (x >>> (32 - n)) +function sigma1 (x, xl) { + return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23) } -function fn1 (a, b, c, d, e, m, k, s) { - return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0 +function Gamma0 (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7) } -function fn2 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0 +function Gamma0l (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25) } -function fn3 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0 +function Gamma1 (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6) } -function fn4 (a, b, c, d, e, m, k, s) { - return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0 +function Gamma1l (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26) } -function fn5 (a, b, c, d, e, m, k, s) { - return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0 +function getCarry (a, b) { + return (a >>> 0) < (b >>> 0) ? 1 : 0 } -module.exports = RIPEMD160 +Sha512.prototype._update = function (M) { + var W = this._w -},{"buffer":88,"hash-base":163,"inherits":193}],225:[function(require,module,exports){ -/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer + var ah = this._ah | 0 + var bh = this._bh | 0 + var ch = this._ch | 0 + var dh = this._dh | 0 + var eh = this._eh | 0 + var fh = this._fh | 0 + var gh = this._gh | 0 + var hh = this._hh | 0 -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] + var al = this._al | 0 + var bl = this._bl | 0 + var cl = this._cl | 0 + var dl = this._dl | 0 + var el = this._el | 0 + var fl = this._fl | 0 + var gl = this._gl | 0 + var hl = this._hl | 0 + + for (var i = 0; i < 32; i += 2) { + W[i] = M.readInt32BE(i * 4) + W[i + 1] = M.readInt32BE(i * 4 + 4) } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} + for (; i < 160; i += 2) { + var xh = W[i - 15 * 2] + var xl = W[i - 15 * 2 + 1] + var gamma0 = Gamma0(xh, xl) + var gamma0l = Gamma0l(xl, xh) -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} + xh = W[i - 2 * 2] + xl = W[i - 2 * 2 + 1] + var gamma1 = Gamma1(xh, xl) + var gamma1l = Gamma1l(xl, xh) -SafeBuffer.prototype = Object.create(Buffer.prototype) + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7h = W[i - 7 * 2] + var Wi7l = W[i - 7 * 2 + 1] -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) + var Wi16h = W[i - 16 * 2] + var Wi16l = W[i - 16 * 2 + 1] -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} + var Wil = (gamma0l + Wi7l) | 0 + var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0 + Wil = (Wil + gamma1l) | 0 + Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0 + Wil = (Wil + Wi16l) | 0 + Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0 -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) + W[i] = Wih + W[i + 1] = Wil } - return buf -} -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') + for (var j = 0; j < 160; j += 2) { + Wih = W[j] + Wil = W[j + 1] + + var majh = maj(ah, bh, ch) + var majl = maj(al, bl, cl) + + var sigma0h = sigma0(ah, al) + var sigma0l = sigma0(al, ah) + var sigma1h = sigma1(eh, el) + var sigma1l = sigma1(el, eh) + + // t1 = h + sigma1 + ch + K[j] + W[j] + var Kih = K[j] + var Kil = K[j + 1] + + var chh = Ch(eh, fh, gh) + var chl = Ch(el, fl, gl) + + var t1l = (hl + sigma1l) | 0 + var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0 + t1l = (t1l + chl) | 0 + t1h = (t1h + chh + getCarry(t1l, chl)) | 0 + t1l = (t1l + Kil) | 0 + t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0 + t1l = (t1l + Wil) | 0 + t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0 + + // t2 = sigma0 + maj + var t2l = (sigma0l + majl) | 0 + var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0 + + hh = gh + hl = gl + gh = fh + gl = fl + fh = eh + fl = el + el = (dl + t1l) | 0 + eh = (dh + t1h + getCarry(el, dl)) | 0 + dh = ch + dl = cl + ch = bh + cl = bl + bh = ah + bl = al + al = (t1l + t2l) | 0 + ah = (t1h + t2h + getCarry(al, t1l)) | 0 } - return Buffer(size) + + this._al = (this._al + al) | 0 + this._bl = (this._bl + bl) | 0 + this._cl = (this._cl + cl) | 0 + this._dl = (this._dl + dl) | 0 + this._el = (this._el + el) | 0 + this._fl = (this._fl + fl) | 0 + this._gl = (this._gl + gl) | 0 + this._hl = (this._hl + hl) | 0 + + this._ah = (this._ah + ah + getCarry(this._al, al)) | 0 + this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0 + this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0 + this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0 + this._eh = (this._eh + eh + getCarry(this._el, el)) | 0 + this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0 + this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0 + this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0 } -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') +Sha512.prototype._hash = function () { + var H = Buffer.allocUnsafe(64) + + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) } - return buffer.SlowBuffer(size) + + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) + writeInt64BE(this._gh, this._gl, 48) + writeInt64BE(this._hh, this._hl, 56) + + return H } -},{"buffer":88}],226:[function(require,module,exports){ -(function (process){(function (){ -/* eslint-disable node/no-deprecated-api */ +module.exports = Sha512 -'use strict' +},{"./hash":221,"inherits":188,"safe-buffer":219}],229:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -var buffer = require('buffer') -var Buffer = buffer.Buffer +module.exports = Stream; -var safer = {} +var EE = require('events').EventEmitter; +var inherits = require('inherits'); -var key +inherits(Stream, EE); +Stream.Readable = require('readable-stream/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') -for (key in buffer) { - if (!buffer.hasOwnProperty(key)) continue - if (key === 'SlowBuffer' || key === 'Buffer') continue - safer[key] = buffer[key] -} +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; -var Safer = safer.Buffer = {} -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue - Safer[key] = Buffer[key] + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); } -safer.Buffer.prototype = Buffer.prototype +Stream.prototype.pipe = function(dest, options) { + var source = this; -if (!Safer.from || Safer.from === Uint8Array.from) { - Safer.from = function (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) - } - if (value && typeof value.length === 'undefined') { - throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } } - return Buffer(value, encodingOrOffset, length) } -} -if (!Safer.alloc) { - Safer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - var buf = Buffer(size) - if (!fill || fill.length === 0) { - buf.fill(0) - } else if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); } - return buf } -} -if (!safer.kStringMaxLength) { - try { - safer.kStringMaxLength = process.binding('buffer').kStringMaxLength - } catch (e) { - // we can't determine kStringMaxLength in environments where process.binding - // is unsupported, so let's not set it - } -} + dest.on('drain', ondrain); -if (!safer.constants) { - safer.constants = { - MAX_LENGTH: safer.kMaxLength + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); } - if (safer.kStringMaxLength) { - safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); } -} -module.exports = safer -}).call(this)}).call(this,require('_process')) -},{"_process":212,"buffer":88}],227:[function(require,module,exports){ -var Buffer = require('safe-buffer').Buffer + function onclose() { + if (didOnEnd) return; + didOnEnd = true; -// prototype class for hash functions -function Hash (blockSize, finalSize) { - this._block = Buffer.alloc(blockSize) - this._finalSize = finalSize - this._blockSize = blockSize - this._len = 0 -} + if (typeof dest.destroy === 'function') dest.destroy(); + } -Hash.prototype.update = function (data, enc) { - if (typeof data === 'string') { - enc = enc || 'utf8' - data = Buffer.from(data, enc) + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } } - var block = this._block - var blockSize = this._blockSize - var length = data.length - var accum = this._len + source.on('error', onerror); + dest.on('error', onerror); - for (var offset = 0; offset < length;) { - var assigned = accum % blockSize - var remainder = Math.min(length - offset, blockSize - assigned) + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); - for (var i = 0; i < remainder; i++) { - block[assigned + i] = data[offset + i] - } + source.removeListener('end', onend); + source.removeListener('close', onclose); - accum += remainder - offset += remainder + source.removeListener('error', onerror); + dest.removeListener('error', onerror); - if ((accum % blockSize) === 0) { - this._update(block) - } + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); } - this._len += length - return this -} + source.on('end', cleanup); + source.on('close', cleanup); -Hash.prototype.digest = function (enc) { - var rem = this._len % this._blockSize + dest.on('close', cleanup); - this._block[rem] = 0x80 + dest.emit('pipe', source); - // zero (rem + 1) trailing bits, where (rem + 1) is the smallest - // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize - this._block.fill(0, rem + 1) + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; - if (rem >= this._finalSize) { - this._update(this._block) - this._block.fill(0) +},{"events":155,"inherits":188,"readable-stream/lib/_stream_duplex.js":231,"readable-stream/lib/_stream_passthrough.js":232,"readable-stream/lib/_stream_readable.js":233,"readable-stream/lib/_stream_transform.js":234,"readable-stream/lib/_stream_writable.js":235,"readable-stream/lib/internal/streams/end-of-stream.js":239,"readable-stream/lib/internal/streams/pipeline.js":241}],230:[function(require,module,exports){ +arguments[4][67][0].apply(exports,arguments) +},{"dup":67}],231:[function(require,module,exports){ +arguments[4][68][0].apply(exports,arguments) +},{"./_stream_readable":233,"./_stream_writable":235,"_process":206,"dup":68,"inherits":188}],232:[function(require,module,exports){ +arguments[4][69][0].apply(exports,arguments) +},{"./_stream_transform":234,"dup":69,"inherits":188}],233:[function(require,module,exports){ +arguments[4][70][0].apply(exports,arguments) +},{"../errors":230,"./_stream_duplex":231,"./internal/streams/async_iterator":236,"./internal/streams/buffer_list":237,"./internal/streams/destroy":238,"./internal/streams/from":240,"./internal/streams/state":242,"./internal/streams/stream":243,"_process":206,"buffer":83,"dup":70,"events":155,"inherits":188,"string_decoder/":244,"util":39}],234:[function(require,module,exports){ +arguments[4][71][0].apply(exports,arguments) +},{"../errors":230,"./_stream_duplex":231,"dup":71,"inherits":188}],235:[function(require,module,exports){ +arguments[4][72][0].apply(exports,arguments) +},{"../errors":230,"./_stream_duplex":231,"./internal/streams/destroy":238,"./internal/streams/state":242,"./internal/streams/stream":243,"_process":206,"buffer":83,"dup":72,"inherits":188,"util-deprecate":247}],236:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"./end-of-stream":239,"_process":206,"dup":73}],237:[function(require,module,exports){ +arguments[4][74][0].apply(exports,arguments) +},{"buffer":83,"dup":74,"util":39}],238:[function(require,module,exports){ +arguments[4][75][0].apply(exports,arguments) +},{"_process":206,"dup":75}],239:[function(require,module,exports){ +arguments[4][76][0].apply(exports,arguments) +},{"../../../errors":230,"dup":76}],240:[function(require,module,exports){ +arguments[4][77][0].apply(exports,arguments) +},{"dup":77}],241:[function(require,module,exports){ +arguments[4][78][0].apply(exports,arguments) +},{"../../../errors":230,"./end-of-stream":239,"dup":78}],242:[function(require,module,exports){ +arguments[4][79][0].apply(exports,arguments) +},{"../../../errors":230,"dup":79}],243:[function(require,module,exports){ +arguments[4][80][0].apply(exports,arguments) +},{"dup":80,"events":155}],244:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/*<replacement>*/ + +var Buffer = require('safe-buffer').Buffer; +/*</replacement>*/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} - var bits = this._len * 8 +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; - // uint32 - if (bits <= 0xffffffff) { - this._block.writeUInt32BE(bits, this._blockSize - 4) +StringDecoder.prototype.end = utf8End; - // uint64 - } else { - var lowBits = (bits & 0xffffffff) >>> 0 - var highBits = (bits - lowBits) / 0x100000000 +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; - this._block.writeUInt32BE(highBits, this._blockSize - 8) - this._block.writeUInt32BE(lowBits, this._blockSize - 4) +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; - this._update(this._block) - var hash = this._hash() - - return enc ? hash.toString(enc) : hash +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; } -Hash.prototype._update = function () { - throw new Error('_update must be implemented by subclass') +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; } -module.exports = Hash - -},{"safe-buffer":225}],228:[function(require,module,exports){ -var exports = module.exports = function SHA (algorithm) { - algorithm = algorithm.toLowerCase() - - var Algorithm = exports[algorithm] - if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') - - return new Algorithm() +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } } -exports.sha = require('./sha') -exports.sha1 = require('./sha1') -exports.sha224 = require('./sha224') -exports.sha256 = require('./sha256') -exports.sha384 = require('./sha384') -exports.sha512 = require('./sha512') - -},{"./sha":229,"./sha1":230,"./sha224":231,"./sha256":232,"./sha384":233,"./sha512":234}],229:[function(require,module,exports){ -/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined - * in FIPS PUB 180-1 - * This source code is derived from sha1.js of the same repository. - * The difference between SHA-0 and SHA-1 is just a bitwise rotate left - * operation was added. - */ - -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 -] - -var W = new Array(80) - -function Sha () { - this.init() - this._w = W - - Hash.call(this, 64, 56) +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; } -inherits(Sha, Hash) - -Sha.prototype.init = function () { - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 - - return this +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); } -function rotl5 (num) { - return (num << 5) | (num >>> 27) +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; } -function rotl30 (num) { - return (num << 30) | (num >>> 2) +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); } -function ft (s, b, c, d) { - if (s === 0) return (b & c) | ((~b) & d) - if (s === 2) return (b & c) | (b & d) | (c & d) - return b ^ c ^ d +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; } -Sha.prototype._update = function (M) { - var W = this._w - - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] - - for (var j = 0; j < 80; ++j) { - var s = ~~(j / 20) - var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - - e = d - d = c - c = rotl30(b) - b = a - a = t +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 + return buf.toString('base64', i, buf.length - n); } -Sha.prototype._hash = function () { - var H = Buffer.allocUnsafe(20) +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} - H.writeInt32BE(this._a | 0, 0) - H.writeInt32BE(this._b | 0, 4) - H.writeInt32BE(this._c | 0, 8) - H.writeInt32BE(this._d | 0, 12) - H.writeInt32BE(this._e | 0, 16) +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} - return H +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; } +},{"safe-buffer":219}],245:[function(require,module,exports){ +(function (global){(function (){ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || from); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); +}); -module.exports = Sha +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],246:[function(require,module,exports){ +(function (global){(function (){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.typeDetect = factory()); +}(this, (function () { 'use strict'; -},{"./hash":227,"inherits":193,"safe-buffer":225}],230:[function(require,module,exports){ -/* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS PUB 180-1 - * Version 2.1a Copyright Paul Johnston 2000 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. +/* ! + * type-detect + * Copyright(c) 2013 jake luer <jake@alogicalparadox.com> + * MIT Licensed */ +var promiseExists = typeof Promise === 'function'; -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var K = [ - 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 -] - -var W = new Array(80) - -function Sha1 () { - this.init() - this._w = W - - Hash.call(this, 64, 56) -} - -inherits(Sha1, Hash) - -Sha1.prototype.init = function () { - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 - - return this -} - -function rotl1 (num) { - return (num << 1) | (num >>> 31) -} - -function rotl5 (num) { - return (num << 5) | (num >>> 27) -} - -function rotl30 (num) { - return (num << 30) | (num >>> 2) -} - -function ft (s, b, c, d) { - if (s === 0) return (b & c) | ((~b) & d) - if (s === 2) return (b & c) | (b & d) | (c & d) - return b ^ c ^ d -} - -Sha1.prototype._update = function (M) { - var W = this._w - - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) - - for (var j = 0; j < 80; ++j) { - var s = ~~(j / 20) - var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 - - e = d - d = c - c = rotl30(b) - b = a - a = t - } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 -} - -Sha1.prototype._hash = function () { - var H = Buffer.allocUnsafe(20) - - H.writeInt32BE(this._a | 0, 0) - H.writeInt32BE(this._b | 0, 4) - H.writeInt32BE(this._c | 0, 8) - H.writeInt32BE(this._d | 0, 12) - H.writeInt32BE(this._e | 0, 16) - - return H -} - -module.exports = Sha1 +/* eslint-disable no-undef */ +var globalObject = typeof self === 'object' ? self : global; // eslint-disable-line id-blacklist -},{"./hash":227,"inherits":193,"safe-buffer":225}],231:[function(require,module,exports){ +var symbolExists = typeof Symbol !== 'undefined'; +var mapExists = typeof Map !== 'undefined'; +var setExists = typeof Set !== 'undefined'; +var weakMapExists = typeof WeakMap !== 'undefined'; +var weakSetExists = typeof WeakSet !== 'undefined'; +var dataViewExists = typeof DataView !== 'undefined'; +var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined'; +var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined'; +var setEntriesExists = setExists && typeof Set.prototype.entries === 'function'; +var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function'; +var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries()); +var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries()); +var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function'; +var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]()); +var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function'; +var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]()); +var toStringLeftSliceLength = 8; +var toStringRightSliceLength = -1; /** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * ### typeOf (obj) * - */ - -var inherits = require('inherits') -var Sha256 = require('./sha256') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer - -var W = new Array(64) - -function Sha224 () { - this.init() - - this._w = W // new Array(64) - - Hash.call(this, 64, 56) -} - -inherits(Sha224, Sha256) - -Sha224.prototype.init = function () { - this._a = 0xc1059ed8 - this._b = 0x367cd507 - this._c = 0x3070dd17 - this._d = 0xf70e5939 - this._e = 0xffc00b31 - this._f = 0x68581511 - this._g = 0x64f98fa7 - this._h = 0xbefa4fa4 - - return this -} - -Sha224.prototype._hash = function () { - var H = Buffer.allocUnsafe(28) - - H.writeInt32BE(this._a, 0) - H.writeInt32BE(this._b, 4) - H.writeInt32BE(this._c, 8) - H.writeInt32BE(this._d, 12) - H.writeInt32BE(this._e, 16) - H.writeInt32BE(this._f, 20) - H.writeInt32BE(this._g, 24) - - return H -} - -module.exports = Sha224 - -},{"./hash":227,"./sha256":232,"inherits":193,"safe-buffer":225}],232:[function(require,module,exports){ -/** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Uses `Object.prototype.toString` to determine the type of an object, + * normalising behaviour across engine versions & well optimised. * + * @param {Mixed} object + * @return {String} object type + * @api public */ +function typeDetect(obj) { + /* ! Speed optimisation + * Pre: + * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled) + * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled) + * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled) + * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled) + * function x 2,556,769 ops/sec ±1.73% (77 runs sampled) + * Post: + * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled) + * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled) + * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled) + * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled) + * function x 31,296,870 ops/sec ±0.96% (83 runs sampled) + */ + var typeofObj = typeof obj; + if (typeofObj !== 'object') { + return typeofObj; + } -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer + /* ! Speed optimisation + * Pre: + * null x 28,645,765 ops/sec ±1.17% (82 runs sampled) + * Post: + * null x 36,428,962 ops/sec ±1.37% (84 runs sampled) + */ + if (obj === null) { + return 'null'; + } -var K = [ - 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, - 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, - 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, - 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, - 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, - 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, - 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, - 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, - 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, - 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, - 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, - 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, - 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, - 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, - 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, - 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 -] + /* ! Spec Conformance + * Test: `Object.prototype.toString.call(window)`` + * - Node === "[object global]" + * - Chrome === "[object global]" + * - Firefox === "[object Window]" + * - PhantomJS === "[object Window]" + * - Safari === "[object Window]" + * - IE 11 === "[object Window]" + * - IE Edge === "[object Window]" + * Test: `Object.prototype.toString.call(this)`` + * - Chrome Worker === "[object global]" + * - Firefox Worker === "[object DedicatedWorkerGlobalScope]" + * - Safari Worker === "[object DedicatedWorkerGlobalScope]" + * - IE 11 Worker === "[object WorkerGlobalScope]" + * - IE Edge Worker === "[object WorkerGlobalScope]" + */ + if (obj === globalObject) { + return 'global'; + } -var W = new Array(64) + /* ! Speed optimisation + * Pre: + * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled) + * Post: + * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled) + */ + if ( + Array.isArray(obj) && + (symbolToStringTagExists === false || !(Symbol.toStringTag in obj)) + ) { + return 'Array'; + } -function Sha256 () { - this.init() + // Not caching existence of `window` and related properties due to potential + // for `window` to be unset before tests in quasi-browser environments. + if (typeof window === 'object' && window !== null) { + /* ! Spec Conformance + * (https://html.spec.whatwg.org/multipage/browsers.html#location) + * WhatWG HTML$7.7.3 - The `Location` interface + * Test: `Object.prototype.toString.call(window.location)`` + * - IE <=11 === "[object Object]" + * - IE Edge <=13 === "[object Object]" + */ + if (typeof window.location === 'object' && obj === window.location) { + return 'Location'; + } - this._w = W // new Array(64) + /* ! Spec Conformance + * (https://html.spec.whatwg.org/#document) + * WhatWG HTML$3.1.1 - The `Document` object + * Note: Most browsers currently adher to the W3C DOM Level 2 spec + * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268) + * which suggests that browsers should use HTMLTableCellElement for + * both TD and TH elements. WhatWG separates these. + * WhatWG HTML states: + * > For historical reasons, Window objects must also have a + * > writable, configurable, non-enumerable property named + * > HTMLDocument whose value is the Document interface object. + * Test: `Object.prototype.toString.call(document)`` + * - Chrome === "[object HTMLDocument]" + * - Firefox === "[object HTMLDocument]" + * - Safari === "[object HTMLDocument]" + * - IE <=10 === "[object Document]" + * - IE 11 === "[object HTMLDocument]" + * - IE Edge <=13 === "[object HTMLDocument]" + */ + if (typeof window.document === 'object' && obj === window.document) { + return 'Document'; + } - Hash.call(this, 64, 56) -} + if (typeof window.navigator === 'object') { + /* ! Spec Conformance + * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) + * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray + * Test: `Object.prototype.toString.call(navigator.mimeTypes)`` + * - IE <=10 === "[object MSMimeTypesCollection]" + */ + if (typeof window.navigator.mimeTypes === 'object' && + obj === window.navigator.mimeTypes) { + return 'MimeTypeArray'; + } -inherits(Sha256, Hash) + /* ! Spec Conformance + * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) + * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray + * Test: `Object.prototype.toString.call(navigator.plugins)`` + * - IE <=10 === "[object MSPluginsCollection]" + */ + if (typeof window.navigator.plugins === 'object' && + obj === window.navigator.plugins) { + return 'PluginArray'; + } + } -Sha256.prototype.init = function () { - this._a = 0x6a09e667 - this._b = 0xbb67ae85 - this._c = 0x3c6ef372 - this._d = 0xa54ff53a - this._e = 0x510e527f - this._f = 0x9b05688c - this._g = 0x1f83d9ab - this._h = 0x5be0cd19 + if ((typeof window.HTMLElement === 'function' || + typeof window.HTMLElement === 'object') && + obj instanceof window.HTMLElement) { + /* ! Spec Conformance + * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) + * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` + * Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` + * - IE <=10 === "[object HTMLBlockElement]" + */ + if (obj.tagName === 'BLOCKQUOTE') { + return 'HTMLQuoteElement'; + } - return this -} + /* ! Spec Conformance + * (https://html.spec.whatwg.org/#htmltabledatacellelement) + * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` + * Note: Most browsers currently adher to the W3C DOM Level 2 spec + * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) + * which suggests that browsers should use HTMLTableCellElement for + * both TD and TH elements. WhatWG separates these. + * Test: Object.prototype.toString.call(document.createElement('td')) + * - Chrome === "[object HTMLTableCellElement]" + * - Firefox === "[object HTMLTableCellElement]" + * - Safari === "[object HTMLTableCellElement]" + */ + if (obj.tagName === 'TD') { + return 'HTMLTableDataCellElement'; + } -function ch (x, y, z) { - return z ^ (x & (y ^ z)) -} + /* ! Spec Conformance + * (https://html.spec.whatwg.org/#htmltableheadercellelement) + * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` + * Note: Most browsers currently adher to the W3C DOM Level 2 spec + * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) + * which suggests that browsers should use HTMLTableCellElement for + * both TD and TH elements. WhatWG separates these. + * Test: Object.prototype.toString.call(document.createElement('th')) + * - Chrome === "[object HTMLTableCellElement]" + * - Firefox === "[object HTMLTableCellElement]" + * - Safari === "[object HTMLTableCellElement]" + */ + if (obj.tagName === 'TH') { + return 'HTMLTableHeaderCellElement'; + } + } + } -function maj (x, y, z) { - return (x & y) | (z & (x | y)) -} + /* ! Speed optimisation + * Pre: + * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled) + * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled) + * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled) + * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled) + * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled) + * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled) + * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled) + * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled) + * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled) + * Post: + * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled) + * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled) + * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled) + * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled) + * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled) + * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled) + * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled) + * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled) + * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled) + */ + var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]); + if (typeof stringTag === 'string') { + return stringTag; + } -function sigma0 (x) { - return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10) -} + var objPrototype = Object.getPrototypeOf(obj); + /* ! Speed optimisation + * Pre: + * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled) + * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled) + * Post: + * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled) + * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled) + */ + if (objPrototype === RegExp.prototype) { + return 'RegExp'; + } + + /* ! Speed optimisation + * Pre: + * date x 2,130,074 ops/sec ±4.42% (68 runs sampled) + * Post: + * date x 3,953,779 ops/sec ±1.35% (77 runs sampled) + */ + if (objPrototype === Date.prototype) { + return 'Date'; + } -function sigma1 (x) { - return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7) -} + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag) + * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise": + * Test: `Object.prototype.toString.call(Promise.resolve())`` + * - Chrome <=47 === "[object Object]" + * - Edge <=20 === "[object Object]" + * - Firefox 29-Latest === "[object Promise]" + * - Safari 7.1-Latest === "[object Promise]" + */ + if (promiseExists && objPrototype === Promise.prototype) { + return 'Promise'; + } -function gamma0 (x) { - return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3) -} + /* ! Speed optimisation + * Pre: + * set x 2,222,186 ops/sec ±1.31% (82 runs sampled) + * Post: + * set x 4,545,879 ops/sec ±1.13% (83 runs sampled) + */ + if (setExists && objPrototype === Set.prototype) { + return 'Set'; + } -function gamma1 (x) { - return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10) -} + /* ! Speed optimisation + * Pre: + * map x 2,396,842 ops/sec ±1.59% (81 runs sampled) + * Post: + * map x 4,183,945 ops/sec ±6.59% (82 runs sampled) + */ + if (mapExists && objPrototype === Map.prototype) { + return 'Map'; + } -Sha256.prototype._update = function (M) { - var W = this._w + /* ! Speed optimisation + * Pre: + * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled) + * Post: + * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled) + */ + if (weakSetExists && objPrototype === WeakSet.prototype) { + return 'WeakSet'; + } - var a = this._a | 0 - var b = this._b | 0 - var c = this._c | 0 - var d = this._d | 0 - var e = this._e | 0 - var f = this._f | 0 - var g = this._g | 0 - var h = this._h | 0 + /* ! Speed optimisation + * Pre: + * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled) + * Post: + * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled) + */ + if (weakMapExists && objPrototype === WeakMap.prototype) { + return 'WeakMap'; + } - for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) - for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0 + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag) + * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView": + * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))`` + * - Edge <=13 === "[object Object]" + */ + if (dataViewExists && objPrototype === DataView.prototype) { + return 'DataView'; + } - for (var j = 0; j < 64; ++j) { - var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0 - var T2 = (sigma0(a) + maj(a, b, c)) | 0 + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag) + * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator": + * Test: `Object.prototype.toString.call(new Map().entries())`` + * - Edge <=13 === "[object Object]" + */ + if (mapExists && objPrototype === mapIteratorPrototype) { + return 'Map Iterator'; + } - h = g - g = f - f = e - e = (d + T1) | 0 - d = c - c = b - b = a - a = (T1 + T2) | 0 + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag) + * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator": + * Test: `Object.prototype.toString.call(new Set().entries())`` + * - Edge <=13 === "[object Object]" + */ + if (setExists && objPrototype === setIteratorPrototype) { + return 'Set Iterator'; } - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 - this._f = (f + this._f) | 0 - this._g = (g + this._g) | 0 - this._h = (h + this._h) | 0 -} + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag) + * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator": + * Test: `Object.prototype.toString.call([][Symbol.iterator]())`` + * - Edge <=13 === "[object Object]" + */ + if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) { + return 'Array Iterator'; + } -Sha256.prototype._hash = function () { - var H = Buffer.allocUnsafe(32) + /* ! Spec Conformance + * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag) + * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator": + * Test: `Object.prototype.toString.call(''[Symbol.iterator]())`` + * - Edge <=13 === "[object Object]" + */ + if (stringIteratorExists && objPrototype === stringIteratorPrototype) { + return 'String Iterator'; + } - H.writeInt32BE(this._a, 0) - H.writeInt32BE(this._b, 4) - H.writeInt32BE(this._c, 8) - H.writeInt32BE(this._d, 12) - H.writeInt32BE(this._e, 16) - H.writeInt32BE(this._f, 20) - H.writeInt32BE(this._g, 24) - H.writeInt32BE(this._h, 28) + /* ! Speed optimisation + * Pre: + * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled) + * Post: + * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled) + */ + if (objPrototype === null) { + return 'Object'; + } - return H + return Object + .prototype + .toString + .call(obj) + .slice(toStringLeftSliceLength, toStringRightSliceLength); } -module.exports = Sha256 +return typeDetect; -},{"./hash":227,"inherits":193,"safe-buffer":225}],233:[function(require,module,exports){ -var inherits = require('inherits') -var SHA512 = require('./sha512') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer +}))); -var W = new Array(160) +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],247:[function(require,module,exports){ +(function (global){(function (){ -function Sha384 () { - this.init() - this._w = W +/** + * Module exports. + */ - Hash.call(this, 128, 112) -} +module.exports = deprecate; -inherits(Sha384, SHA512) +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ -Sha384.prototype.init = function () { - this._ah = 0xcbbb9d5d - this._bh = 0x629a292a - this._ch = 0x9159015a - this._dh = 0x152fecd8 - this._eh = 0x67332667 - this._fh = 0x8eb44a87 - this._gh = 0xdb0c2e0d - this._hh = 0x47b5481d +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } - this._al = 0xc1059ed8 - this._bl = 0x367cd507 - this._cl = 0x3070dd17 - this._dl = 0xf70e5939 - this._el = 0xffc00b31 - this._fl = 0x68581511 - this._gl = 0x64f98fa7 - this._hl = 0xbefa4fa4 + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } - return this + return deprecated; } -Sha384.prototype._hash = function () { - var H = Buffer.allocUnsafe(48) +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ - function writeInt64BE (h, l, offset) { - H.writeInt32BE(h, offset) - H.writeInt32BE(l, offset + 4) +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; } - - writeInt64BE(this._ah, this._al, 0) - writeInt64BE(this._bh, this._bl, 8) - writeInt64BE(this._ch, this._cl, 16) - writeInt64BE(this._dh, this._dl, 24) - writeInt64BE(this._eh, this._el, 32) - writeInt64BE(this._fh, this._fl, 40) - - return H + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; } -module.exports = Sha384 +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],248:[function(require,module,exports){ +(function (Buffer){(function (){ +/** + * Copyright (c) 2019, Peculiar Ventures, All rights reserved. + */ -},{"./hash":227,"./sha512":234,"inherits":193,"safe-buffer":225}],234:[function(require,module,exports){ -var inherits = require('inherits') -var Hash = require('./hash') -var Buffer = require('safe-buffer').Buffer +'use strict'; -var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -] +Object.defineProperty(exports, '__esModule', { value: true }); -var W = new Array(160) +var pvtsutils = require('pvtsutils'); +var tslib = require('tslib'); +var asn1Schema = require('@peculiar/asn1-schema'); +var jsonSchema = require('@peculiar/json-schema'); +var asn1 = require('asn1js'); -function Sha512 () { - this.init() - this._w = W +class CryptoError extends Error { +} - Hash.call(this, 128, 112) +class AlgorithmError extends CryptoError { } -inherits(Sha512, Hash) +class UnsupportedOperationError extends CryptoError { + constructor(methodName) { + super(`Unsupported operation: ${methodName ? `${methodName}` : ""}`); + } +} -Sha512.prototype.init = function () { - this._ah = 0x6a09e667 - this._bh = 0xbb67ae85 - this._ch = 0x3c6ef372 - this._dh = 0xa54ff53a - this._eh = 0x510e527f - this._fh = 0x9b05688c - this._gh = 0x1f83d9ab - this._hh = 0x5be0cd19 +class OperationError extends CryptoError { +} - this._al = 0xf3bcc908 - this._bl = 0x84caa73b - this._cl = 0xfe94f82b - this._dl = 0x5f1d36f1 - this._el = 0xade682d1 - this._fl = 0x2b3e6c1f - this._gl = 0xfb41bd6b - this._hl = 0x137e2179 +class RequiredPropertyError extends CryptoError { + constructor(propName) { + super(`${propName}: Missing required property`); + } +} - return this +class PemConverter { + static toArrayBuffer(pem) { + const base64 = pem + .replace(/-{5}(BEGIN|END) .*-{5}/g, "") + .replace("\r", "") + .replace("\n", ""); + return pvtsutils.Convert.FromBase64(base64); + } + static toUint8Array(pem) { + const bytes = this.toArrayBuffer(pem); + return new Uint8Array(bytes); + } + static fromBufferSource(buffer, tag) { + const base64 = pvtsutils.Convert.ToBase64(buffer); + let sliced; + let offset = 0; + const rows = []; + while (true) { + sliced = base64.slice(offset, offset = offset + 64); + if (sliced.length) { + rows.push(sliced); + if (sliced.length < 64) { + break; + } + } + else { + break; + } + } + const upperCaseTag = tag.toUpperCase(); + return `-----BEGIN ${upperCaseTag}-----\n${rows.join("\n")}\n-----END ${upperCaseTag}-----`; + } + static isPEM(data) { + return /-----BEGIN .+-----[A-Za-z0-9+\/\+\=\s\n]+-----END .+-----/i.test(data); + } + static getTagName(pem) { + if (!this.isPEM(pem)) { + throw new Error("Bad parameter. Incoming data is not right PEM"); + } + const res = /-----BEGIN (.+)-----/.exec(pem); + if (!res) { + throw new Error("Cannot get tag from PEM"); + } + return res[1]; + } + static hasTagName(pem, tagName) { + const tag = this.getTagName(pem); + return tagName.toLowerCase() === tag.toLowerCase(); + } + static isCertificate(pem) { + return this.hasTagName(pem, "certificate"); + } + static isCertificateRequest(pem) { + return this.hasTagName(pem, "certificate request"); + } + static isCRL(pem) { + return this.hasTagName(pem, "x509 crl"); + } + static isPublicKey(pem) { + return this.hasTagName(pem, "public key"); + } } -function Ch (x, y, z) { - return z ^ (x & (y ^ z)) +function isJWK(data) { + return typeof data === "object" && "kty" in data; } -function maj (x, y, z) { - return (x & y) | (z & (x | y)) +class ProviderCrypto { + async digest(...args) { + this.checkDigest.apply(this, args); + return this.onDigest.apply(this, args); + } + checkDigest(algorithm, data) { + this.checkAlgorithmName(algorithm); + } + async onDigest(algorithm, data) { + throw new UnsupportedOperationError("digest"); + } + async generateKey(...args) { + this.checkGenerateKey.apply(this, args); + return this.onGenerateKey.apply(this, args); + } + checkGenerateKey(algorithm, extractable, keyUsages, ...args) { + this.checkAlgorithmName(algorithm); + this.checkGenerateKeyParams(algorithm); + if (!(keyUsages && keyUsages.length)) { + throw new TypeError(`Usages cannot be empty when creating a key.`); + } + let allowedUsages; + if (Array.isArray(this.usages)) { + allowedUsages = this.usages; + } + else { + allowedUsages = this.usages.privateKey.concat(this.usages.publicKey); + } + this.checkKeyUsages(keyUsages, allowedUsages); + } + checkGenerateKeyParams(algorithm) { + } + async onGenerateKey(algorithm, extractable, keyUsages, ...args) { + throw new UnsupportedOperationError("generateKey"); + } + async sign(...args) { + this.checkSign.apply(this, args); + return this.onSign.apply(this, args); + } + checkSign(algorithm, key, data, ...args) { + this.checkAlgorithmName(algorithm); + this.checkAlgorithmParams(algorithm); + this.checkCryptoKey(key, "sign"); + } + async onSign(algorithm, key, data, ...args) { + throw new UnsupportedOperationError("sign"); + } + async verify(...args) { + this.checkVerify.apply(this, args); + return this.onVerify.apply(this, args); + } + checkVerify(algorithm, key, signature, data, ...args) { + this.checkAlgorithmName(algorithm); + this.checkAlgorithmParams(algorithm); + this.checkCryptoKey(key, "verify"); + } + async onVerify(algorithm, key, signature, data, ...args) { + throw new UnsupportedOperationError("verify"); + } + async encrypt(...args) { + this.checkEncrypt.apply(this, args); + return this.onEncrypt.apply(this, args); + } + checkEncrypt(algorithm, key, data, options = {}, ...args) { + this.checkAlgorithmName(algorithm); + this.checkAlgorithmParams(algorithm); + this.checkCryptoKey(key, options.keyUsage ? "encrypt" : void 0); + } + async onEncrypt(algorithm, key, data, ...args) { + throw new UnsupportedOperationError("encrypt"); + } + async decrypt(...args) { + this.checkDecrypt.apply(this, args); + return this.onDecrypt.apply(this, args); + } + checkDecrypt(algorithm, key, data, options = {}, ...args) { + this.checkAlgorithmName(algorithm); + this.checkAlgorithmParams(algorithm); + this.checkCryptoKey(key, options.keyUsage ? "decrypt" : void 0); + } + async onDecrypt(algorithm, key, data, ...args) { + throw new UnsupportedOperationError("decrypt"); + } + async deriveBits(...args) { + this.checkDeriveBits.apply(this, args); + return this.onDeriveBits.apply(this, args); + } + checkDeriveBits(algorithm, baseKey, length, options = {}, ...args) { + this.checkAlgorithmName(algorithm); + this.checkAlgorithmParams(algorithm); + this.checkCryptoKey(baseKey, options.keyUsage ? "deriveBits" : void 0); + if (length % 8 !== 0) { + throw new OperationError("length: Is not multiple of 8"); + } + } + async onDeriveBits(algorithm, baseKey, length, ...args) { + throw new UnsupportedOperationError("deriveBits"); + } + async exportKey(...args) { + this.checkExportKey.apply(this, args); + return this.onExportKey.apply(this, args); + } + checkExportKey(format, key, ...args) { + this.checkKeyFormat(format); + this.checkCryptoKey(key); + if (!key.extractable) { + throw new CryptoError("key: Is not extractable"); + } + } + async onExportKey(format, key, ...args) { + throw new UnsupportedOperationError("exportKey"); + } + async importKey(...args) { + this.checkImportKey.apply(this, args); + return this.onImportKey.apply(this, args); + } + checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { + this.checkKeyFormat(format); + this.checkKeyData(format, keyData); + this.checkAlgorithmName(algorithm); + this.checkImportParams(algorithm); + if (Array.isArray(this.usages)) { + this.checkKeyUsages(keyUsages, this.usages); + } + } + async onImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { + throw new UnsupportedOperationError("importKey"); + } + checkAlgorithmName(algorithm) { + if (algorithm.name.toLowerCase() !== this.name.toLowerCase()) { + throw new AlgorithmError("Unrecognized name"); + } + } + checkAlgorithmParams(algorithm) { + } + checkDerivedKeyParams(algorithm) { + } + checkKeyUsages(usages, allowed) { + for (const usage of usages) { + if (allowed.indexOf(usage) === -1) { + throw new TypeError("Cannot create a key using the specified key usages"); + } + } + } + checkCryptoKey(key, keyUsage) { + this.checkAlgorithmName(key.algorithm); + if (keyUsage && key.usages.indexOf(keyUsage) === -1) { + throw new CryptoError(`key does not match that of operation`); + } + } + checkRequiredProperty(data, propName) { + if (!(propName in data)) { + throw new RequiredPropertyError(propName); + } + } + checkHashAlgorithm(algorithm, hashAlgorithms) { + for (const item of hashAlgorithms) { + if (item.toLowerCase() === algorithm.name.toLowerCase()) { + return; + } + } + throw new OperationError(`hash: Must be one of ${hashAlgorithms.join(", ")}`); + } + checkImportParams(algorithm) { + } + checkKeyFormat(format) { + switch (format) { + case "raw": + case "pkcs8": + case "spki": + case "jwk": + break; + default: + throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'"); + } + } + checkKeyData(format, keyData) { + if (!keyData) { + throw new TypeError("keyData: Cannot be empty on empty on key importing"); + } + if (format === "jwk") { + if (!isJWK(keyData)) { + throw new TypeError("keyData: Is not JsonWebToken"); + } + } + else if (!pvtsutils.BufferSourceConverter.isBufferSource(keyData)) { + throw new TypeError("keyData: Is not ArrayBufferView or ArrayBuffer"); + } + } + prepareData(data) { + return pvtsutils.BufferSourceConverter.toArrayBuffer(data); + } } -function sigma0 (x, xl) { - return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25) +class AesProvider extends ProviderCrypto { + checkGenerateKeyParams(algorithm) { + this.checkRequiredProperty(algorithm, "length"); + if (typeof algorithm.length !== "number") { + throw new TypeError("length: Is not of type Number"); + } + switch (algorithm.length) { + case 128: + case 192: + case 256: + break; + default: + throw new TypeError("length: Must be 128, 192, or 256"); + } + } + checkDerivedKeyParams(algorithm) { + this.checkGenerateKeyParams(algorithm); + } } -function sigma1 (x, xl) { - return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23) +class AesCbcProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-CBC"; + this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "iv"); + if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { + throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + if (algorithm.iv.byteLength !== 16) { + throw new TypeError("iv: Must have length 16 bytes"); + } + } } -function Gamma0 (x, xl) { - return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7) +class AesCmacProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-CMAC"; + this.usages = ["sign", "verify"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "length"); + if (typeof algorithm.length !== "number") { + throw new TypeError("length: Is not a Number"); + } + if (algorithm.length < 1) { + throw new OperationError("length: Must be more than 0"); + } + } } -function Gamma0l (x, xl) { - return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25) +class AesCtrProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-CTR"; + this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "counter"); + if (!(algorithm.counter instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.counter))) { + throw new TypeError("counter: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + if (algorithm.counter.byteLength !== 16) { + throw new TypeError("iv: Must have length 16 bytes"); + } + this.checkRequiredProperty(algorithm, "length"); + if (typeof algorithm.length !== "number") { + throw new TypeError("length: Is not a Number"); + } + if (algorithm.length < 1) { + throw new OperationError("length: Must be more than 0"); + } + } } -function Gamma1 (x, xl) { - return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6) +class AesEcbProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-ECB"; + this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; + } } -function Gamma1l (x, xl) { - return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26) +class AesGcmProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-GCM"; + this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "iv"); + if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { + throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + if (algorithm.iv.byteLength < 1) { + throw new OperationError("iv: Must have length more than 0 and less than 2^64 - 1"); + } + if (!("tagLength" in algorithm)) { + algorithm.tagLength = 128; + } + switch (algorithm.tagLength) { + case 32: + case 64: + case 96: + case 104: + case 112: + case 120: + case 128: + break; + default: + throw new OperationError("tagLength: Must be one of 32, 64, 96, 104, 112, 120 or 128"); + } + } } -function getCarry (a, b) { - return (a >>> 0) < (b >>> 0) ? 1 : 0 +class AesKwProvider extends AesProvider { + constructor() { + super(...arguments); + this.name = "AES-KW"; + this.usages = ["wrapKey", "unwrapKey"]; + } } -Sha512.prototype._update = function (M) { - var W = this._w - - var ah = this._ah | 0 - var bh = this._bh | 0 - var ch = this._ch | 0 - var dh = this._dh | 0 - var eh = this._eh | 0 - var fh = this._fh | 0 - var gh = this._gh | 0 - var hh = this._hh | 0 - - var al = this._al | 0 - var bl = this._bl | 0 - var cl = this._cl | 0 - var dl = this._dl | 0 - var el = this._el | 0 - var fl = this._fl | 0 - var gl = this._gl | 0 - var hl = this._hl | 0 - - for (var i = 0; i < 32; i += 2) { - W[i] = M.readInt32BE(i * 4) - W[i + 1] = M.readInt32BE(i * 4 + 4) - } - for (; i < 160; i += 2) { - var xh = W[i - 15 * 2] - var xl = W[i - 15 * 2 + 1] - var gamma0 = Gamma0(xh, xl) - var gamma0l = Gamma0l(xl, xh) - - xh = W[i - 2 * 2] - xl = W[i - 2 * 2 + 1] - var gamma1 = Gamma1(xh, xl) - var gamma1l = Gamma1l(xl, xh) - - // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] - var Wi7h = W[i - 7 * 2] - var Wi7l = W[i - 7 * 2 + 1] - - var Wi16h = W[i - 16 * 2] - var Wi16l = W[i - 16 * 2 + 1] - - var Wil = (gamma0l + Wi7l) | 0 - var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0 - Wil = (Wil + gamma1l) | 0 - Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0 - Wil = (Wil + Wi16l) | 0 - Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0 - - W[i] = Wih - W[i + 1] = Wil - } - - for (var j = 0; j < 160; j += 2) { - Wih = W[j] - Wil = W[j + 1] - - var majh = maj(ah, bh, ch) - var majl = maj(al, bl, cl) - - var sigma0h = sigma0(ah, al) - var sigma0l = sigma0(al, ah) - var sigma1h = sigma1(eh, el) - var sigma1l = sigma1(el, eh) - - // t1 = h + sigma1 + ch + K[j] + W[j] - var Kih = K[j] - var Kil = K[j + 1] - - var chh = Ch(eh, fh, gh) - var chl = Ch(el, fl, gl) - - var t1l = (hl + sigma1l) | 0 - var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0 - t1l = (t1l + chl) | 0 - t1h = (t1h + chh + getCarry(t1l, chl)) | 0 - t1l = (t1l + Kil) | 0 - t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0 - t1l = (t1l + Wil) | 0 - t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0 - - // t2 = sigma0 + maj - var t2l = (sigma0l + majl) | 0 - var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0 - - hh = gh - hl = gl - gh = fh - gl = fl - fh = eh - fl = el - el = (dl + t1l) | 0 - eh = (dh + t1h + getCarry(el, dl)) | 0 - dh = ch - dl = cl - ch = bh - cl = bl - bh = ah - bl = al - al = (t1l + t2l) | 0 - ah = (t1h + t2h + getCarry(al, t1l)) | 0 - } - - this._al = (this._al + al) | 0 - this._bl = (this._bl + bl) | 0 - this._cl = (this._cl + cl) | 0 - this._dl = (this._dl + dl) | 0 - this._el = (this._el + el) | 0 - this._fl = (this._fl + fl) | 0 - this._gl = (this._gl + gl) | 0 - this._hl = (this._hl + hl) | 0 - - this._ah = (this._ah + ah + getCarry(this._al, al)) | 0 - this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0 - this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0 - this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0 - this._eh = (this._eh + eh + getCarry(this._el, el)) | 0 - this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0 - this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0 - this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0 +class DesProvider extends ProviderCrypto { + constructor() { + super(...arguments); + this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; + } + checkAlgorithmParams(algorithm) { + if (this.ivSize) { + this.checkRequiredProperty(algorithm, "iv"); + if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { + throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + if (algorithm.iv.byteLength !== this.ivSize) { + throw new TypeError(`iv: Must have length ${this.ivSize} bytes`); + } + } + } + checkGenerateKeyParams(algorithm) { + this.checkRequiredProperty(algorithm, "length"); + if (typeof algorithm.length !== "number") { + throw new TypeError("length: Is not of type Number"); + } + if (algorithm.length !== this.keySizeBits) { + throw new OperationError(`algorith.length: Must be ${this.keySizeBits}`); + } + } + checkDerivedKeyParams(algorithm) { + this.checkGenerateKeyParams(algorithm); + } } -Sha512.prototype._hash = function () { - var H = Buffer.allocUnsafe(64) - - function writeInt64BE (h, l, offset) { - H.writeInt32BE(h, offset) - H.writeInt32BE(l, offset + 4) - } - - writeInt64BE(this._ah, this._al, 0) - writeInt64BE(this._bh, this._bl, 8) - writeInt64BE(this._ch, this._cl, 16) - writeInt64BE(this._dh, this._dl, 24) - writeInt64BE(this._eh, this._el, 32) - writeInt64BE(this._fh, this._fl, 40) - writeInt64BE(this._gh, this._gl, 48) - writeInt64BE(this._hh, this._hl, 56) - - return H +class RsaProvider extends ProviderCrypto { + constructor() { + super(...arguments); + this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; + } + checkGenerateKeyParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + this.checkRequiredProperty(algorithm, "publicExponent"); + if (!(algorithm.publicExponent && algorithm.publicExponent instanceof Uint8Array)) { + throw new TypeError("publicExponent: Missing or not a Uint8Array"); + } + const publicExponent = pvtsutils.Convert.ToBase64(algorithm.publicExponent); + if (!(publicExponent === "Aw==" || publicExponent === "AQAB")) { + throw new TypeError("publicExponent: Must be [3] or [1,0,1]"); + } + this.checkRequiredProperty(algorithm, "modulusLength"); + switch (algorithm.modulusLength) { + case 1024: + case 2048: + case 4096: + break; + default: + throw new TypeError("modulusLength: Must be 1024, 2048, or 4096"); + } + } + checkImportParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + } } -module.exports = Sha512 - -},{"./hash":227,"inherits":193,"safe-buffer":225}],235:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/lib/_stream_readable.js'); -Stream.Writable = require('readable-stream/lib/_stream_writable.js'); -Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); -Stream.Transform = require('readable-stream/lib/_stream_transform.js'); -Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); -Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') -Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); +class RsaSsaProvider extends RsaProvider { + constructor() { + super(...arguments); + this.name = "RSASSA-PKCS1-v1_5"; + this.usages = { + privateKey: ["sign"], + publicKey: ["verify"], + }; + } } -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); +class RsaPssProvider extends RsaProvider { + constructor() { + super(...arguments); + this.name = "RSA-PSS"; + this.usages = { + privateKey: ["sign"], + publicKey: ["verify"], + }; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "saltLength"); + if (typeof algorithm.saltLength !== "number") { + throw new TypeError("saltLength: Is not a Number"); + } + if (algorithm.saltLength < 0) { + throw new RangeError("saltLength: Must be positive number"); + } + } +} - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } +class RsaOaepProvider extends RsaProvider { + constructor() { + super(...arguments); + this.name = "RSA-OAEP"; + this.usages = { + privateKey: ["decrypt", "unwrapKey"], + publicKey: ["encrypt", "wrapKey"], + }; + } + checkAlgorithmParams(algorithm) { + if (algorithm.label + && !(algorithm.label instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.label))) { + throw new TypeError("label: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + } +} - dest.on('drain', ondrain); +class EllipticProvider extends ProviderCrypto { + checkGenerateKeyParams(algorithm) { + this.checkRequiredProperty(algorithm, "namedCurve"); + this.checkNamedCurve(algorithm.namedCurve); + } + checkNamedCurve(namedCurve) { + for (const item of this.namedCurves) { + if (item.toLowerCase() === namedCurve.toLowerCase()) { + return; + } + } + throw new OperationError(`namedCurve: Must be one of ${this.namedCurves.join(", ")}`); + } +} - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } +class EcdsaProvider extends EllipticProvider { + constructor() { + super(...arguments); + this.name = "ECDSA"; + this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; + this.usages = { + privateKey: ["sign"], + publicKey: ["verify"], + }; + this.namedCurves = ["P-256", "P-384", "P-521", "K-256"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + } +} - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; +const KEY_TYPES = ["secret", "private", "public"]; +class CryptoKey { + static create(algorithm, type, extractable, usages) { + const key = new this(); + key.algorithm = algorithm; + key.type = type; + key.extractable = extractable; + key.usages = usages; + return key; + } + static isKeyType(data) { + return KEY_TYPES.indexOf(data) !== -1; + } + get [Symbol.toStringTag]() { + return "CryptoKey"; + } +} - dest.end(); - } +class EcdhProvider extends EllipticProvider { + constructor() { + super(...arguments); + this.name = "ECDH"; + this.usages = { + privateKey: ["deriveBits", "deriveKey"], + publicKey: [], + }; + this.namedCurves = ["P-256", "P-384", "P-521", "K-256"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "public"); + if (!(algorithm.public instanceof CryptoKey)) { + throw new TypeError("public: Is not a CryptoKey"); + } + if (algorithm.public.type !== "public") { + throw new OperationError("public: Is not a public key"); + } + if (algorithm.public.algorithm.name !== this.name) { + throw new OperationError(`public: Is not ${this.name} key`); + } + } +} +class EcdhEsProvider extends EcdhProvider { + constructor() { + super(...arguments); + this.name = "ECDH-ES"; + this.namedCurves = ["X25519", "X448"]; + } +} - function onclose() { - if (didOnEnd) return; - didOnEnd = true; +class EdDsaProvider extends EllipticProvider { + constructor() { + super(...arguments); + this.name = "EdDSA"; + this.usages = { + privateKey: ["sign"], + publicKey: ["verify"], + }; + this.namedCurves = ["Ed25519", "Ed448"]; + } +} - if (typeof dest.destroy === 'function') dest.destroy(); - } +class HmacProvider extends ProviderCrypto { + constructor() { + super(...arguments); + this.name = "HMAC"; + this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; + this.usages = ["sign", "verify"]; + } + getDefaultLength(algName) { + switch (algName.toUpperCase()) { + case "SHA-1": + case "SHA-256": + case "SHA-384": + case "SHA-512": + return 512; + default: + throw new Error(`Unknown algorithm name '${algName}'`); + } + } + checkGenerateKeyParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + if ("length" in algorithm) { + if (typeof algorithm.length !== "number") { + throw new TypeError("length: Is not a Number"); + } + if (algorithm.length < 1) { + throw new RangeError("length: Number is out of range"); + } + } + } + checkImportParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + } +} - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } +class Pbkdf2Provider extends ProviderCrypto { + constructor() { + super(...arguments); + this.name = "PBKDF2"; + this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; + this.usages = ["deriveBits", "deriveKey"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + this.checkRequiredProperty(algorithm, "salt"); + if (!(algorithm.salt instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.salt))) { + throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + this.checkRequiredProperty(algorithm, "iterations"); + if (typeof algorithm.iterations !== "number") { + throw new TypeError("iterations: Is not a Number"); + } + if (algorithm.iterations < 1) { + throw new TypeError("iterations: Is less than 1"); + } + } + checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { + super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); + if (extractable) { + throw new SyntaxError("extractable: Must be 'false'"); + } + } +} - source.on('error', onerror); - dest.on('error', onerror); +class HkdfProvider extends ProviderCrypto { + constructor() { + super(...arguments); + this.name = "HKDF"; + this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; + this.usages = ["deriveKey", "deriveBits"]; + } + checkAlgorithmParams(algorithm) { + this.checkRequiredProperty(algorithm, "hash"); + this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); + this.checkRequiredProperty(algorithm, "salt"); + if (!pvtsutils.BufferSourceConverter.isBufferSource(algorithm.salt)) { + throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + this.checkRequiredProperty(algorithm, "info"); + if (!pvtsutils.BufferSourceConverter.isBufferSource(algorithm.info)) { + throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + } + checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { + super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); + if (extractable) { + throw new SyntaxError("extractable: Must be 'false'"); + } + } +} - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); +class Crypto { + get [Symbol.toStringTag]() { + return "Crypto"; + } +} - source.removeListener('end', onend); - source.removeListener('close', onclose); +class ProviderStorage { + constructor() { + this.items = {}; + } + get(algorithmName) { + return this.items[algorithmName.toLowerCase()] || null; + } + set(provider) { + this.items[provider.name.toLowerCase()] = provider; + } + removeAt(algorithmName) { + const provider = this.get(algorithmName.toLowerCase()); + if (provider) { + delete this.items[algorithmName]; + } + return provider; + } + has(name) { + return !!this.get(name); + } + get length() { + return Object.keys(this.items).length; + } + get algorithms() { + const algorithms = []; + for (const key in this.items) { + const provider = this.items[key]; + algorithms.push(provider.name); + } + return algorithms.sort(); + } +} - source.removeListener('error', onerror); - dest.removeListener('error', onerror); +class SubtleCrypto { + constructor() { + this.providers = new ProviderStorage(); + } + static isHashedAlgorithm(data) { + return data + && typeof data === "object" + && "name" in data + && "hash" in data + ? true + : false; + } + get [Symbol.toStringTag]() { + return "SubtleCrypto"; + } + async digest(...args) { + this.checkRequiredArguments(args, 2, "digest"); + const [algorithm, data, ...params] = args; + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.digest(preparedAlgorithm, preparedData, ...params); + return result; + } + async generateKey(...args) { + this.checkRequiredArguments(args, 3, "generateKey"); + const [algorithm, extractable, keyUsages, ...params] = args; + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); + return result; + } + async sign(...args) { + this.checkRequiredArguments(args, 3, "sign"); + const [algorithm, key, data, ...params] = args; + this.checkCryptoKey(key); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData, ...params); + return result; + } + async verify(...args) { + this.checkRequiredArguments(args, 4, "verify"); + const [algorithm, key, signature, data, ...params] = args; + this.checkCryptoKey(key); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); + const preparedSignature = pvtsutils.BufferSourceConverter.toArrayBuffer(signature); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData, ...params); + return result; + } + async encrypt(...args) { + this.checkRequiredArguments(args, 3, "encrypt"); + const [algorithm, key, data, ...params] = args; + this.checkCryptoKey(key); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); + return result; + } + async decrypt(...args) { + this.checkRequiredArguments(args, 3, "decrypt"); + const [algorithm, key, data, ...params] = args; + this.checkCryptoKey(key); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); + return result; + } + async deriveBits(...args) { + this.checkRequiredArguments(args, 3, "deriveBits"); + const [algorithm, baseKey, length, ...params] = args; + this.checkCryptoKey(baseKey); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const provider = this.getProvider(preparedAlgorithm.name); + const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }, ...params); + return result; + } + async deriveKey(...args) { + this.checkRequiredArguments(args, 5, "deriveKey"); + const [algorithm, baseKey, derivedKeyType, extractable, keyUsages, ...params] = args; + const preparedDerivedKeyType = this.prepareAlgorithm(derivedKeyType); + const importProvider = this.getProvider(preparedDerivedKeyType.name); + importProvider.checkDerivedKeyParams(preparedDerivedKeyType); + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const provider = this.getProvider(preparedAlgorithm.name); + provider.checkCryptoKey(baseKey, "deriveKey"); + const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length || 512, { keyUsage: false }, ...params); + return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages, ...params); + } + async exportKey(...args) { + this.checkRequiredArguments(args, 2, "exportKey"); + const [format, key, ...params] = args; + this.checkCryptoKey(key); + const provider = this.getProvider(key.algorithm.name); + const result = await provider.exportKey(format, key, ...params); + return result; + } + async importKey(...args) { + this.checkRequiredArguments(args, 5, "importKey"); + const [format, keyData, algorithm, extractable, keyUsages, ...params] = args; + const preparedAlgorithm = this.prepareAlgorithm(algorithm); + const provider = this.getProvider(preparedAlgorithm.name); + if (["pkcs8", "spki", "raw"].indexOf(format) !== -1) { + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(keyData); + return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); + } + else { + if (!keyData.kty) { + throw new TypeError("keyData: Is not JSON"); + } + } + return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); + } + async wrapKey(format, key, wrappingKey, wrapAlgorithm, ...args) { + let keyData = await this.exportKey(format, key, ...args); + if (format === "jwk") { + const json = JSON.stringify(keyData); + keyData = pvtsutils.Convert.FromUtf8String(json); + } + const preparedAlgorithm = this.prepareAlgorithm(wrapAlgorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(keyData); + const provider = this.getProvider(preparedAlgorithm.name); + return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }, ...args); + } + async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, ...args) { + const preparedAlgorithm = this.prepareAlgorithm(unwrapAlgorithm); + const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(wrappedKey); + const provider = this.getProvider(preparedAlgorithm.name); + let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }, ...args); + if (format === "jwk") { + try { + keyData = JSON.parse(pvtsutils.Convert.ToUtf8String(keyData)); + } + catch (e) { + const error = new TypeError("wrappedKey: Is not a JSON"); + error.internal = e; + throw error; + } + } + return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages, ...args); + } + checkRequiredArguments(args, size, methodName) { + if (args.length < size) { + throw new TypeError(`Failed to execute '${methodName}' on 'SubtleCrypto': ${size} arguments required, but only ${args.length} present`); + } + } + prepareAlgorithm(algorithm) { + if (typeof algorithm === "string") { + return { + name: algorithm, + }; + } + if (SubtleCrypto.isHashedAlgorithm(algorithm)) { + const preparedAlgorithm = { ...algorithm }; + preparedAlgorithm.hash = this.prepareAlgorithm(algorithm.hash); + return preparedAlgorithm; + } + return { ...algorithm }; + } + getProvider(name) { + const provider = this.providers.get(name); + if (!provider) { + throw new AlgorithmError("Unrecognized name"); + } + return provider; + } + checkCryptoKey(key) { + if (!(key instanceof CryptoKey)) { + throw new TypeError(`Key is not of type 'CryptoKey'`); + } + } +} - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); +let ObjectIdentifier = class ObjectIdentifier { + constructor(value) { + if (value) { + this.value = value; + } + } +}; +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.ObjectIdentifier }) +], ObjectIdentifier.prototype, "value", void 0); +ObjectIdentifier = tslib.__decorate([ + asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) +], ObjectIdentifier); - dest.removeListener('close', cleanup); - } +class AlgorithmIdentifier { + constructor(params) { + Object.assign(this, params); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ + type: asn1Schema.AsnPropTypes.ObjectIdentifier, + }) +], AlgorithmIdentifier.prototype, "algorithm", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ + type: asn1Schema.AsnPropTypes.Any, + optional: true, + }) +], AlgorithmIdentifier.prototype, "parameters", void 0); - source.on('end', cleanup); - source.on('close', cleanup); +class PrivateKeyInfo { + constructor() { + this.version = 0; + this.privateKeyAlgorithm = new AlgorithmIdentifier(); + this.privateKey = new ArrayBuffer(0); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer }) +], PrivateKeyInfo.prototype, "version", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: AlgorithmIdentifier }) +], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) +], PrivateKeyInfo.prototype, "privateKey", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Any, optional: true }) +], PrivateKeyInfo.prototype, "attributes", void 0); - dest.on('close', cleanup); +class PublicKeyInfo { + constructor() { + this.publicKeyAlgorithm = new AlgorithmIdentifier(); + this.publicKey = new ArrayBuffer(0); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: AlgorithmIdentifier }) +], PublicKeyInfo.prototype, "publicKeyAlgorithm", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.BitString }) +], PublicKeyInfo.prototype, "publicKey", void 0); - dest.emit('pipe', source); +const JsonBase64UrlArrayBufferConverter = { + fromJSON: (value) => pvtsutils.Convert.FromBase64Url(value), + toJSON: (value) => pvtsutils.Convert.ToBase64Url(new Uint8Array(value)), +}; - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; +const AsnIntegerArrayBufferConverter = { + fromASN: (value) => { + const valueHex = value.valueBlock.valueHex; + return !(new Uint8Array(valueHex)[0]) + ? value.valueBlock.valueHex.slice(1) + : value.valueBlock.valueHex; + }, + toASN: (value) => { + const valueHex = new Uint8Array(value)[0] > 127 + ? Buffer.concat([Buffer.from([0]), Buffer.from(value)]) + : Buffer.from(value); + return new asn1.Integer({ valueHex: new Uint8Array(valueHex).buffer }); + }, }; -},{"events":160,"inherits":193,"readable-stream/lib/_stream_duplex.js":237,"readable-stream/lib/_stream_passthrough.js":238,"readable-stream/lib/_stream_readable.js":239,"readable-stream/lib/_stream_transform.js":240,"readable-stream/lib/_stream_writable.js":241,"readable-stream/lib/internal/streams/end-of-stream.js":245,"readable-stream/lib/internal/streams/pipeline.js":247}],236:[function(require,module,exports){ -arguments[4][71][0].apply(exports,arguments) -},{"dup":71}],237:[function(require,module,exports){ -arguments[4][72][0].apply(exports,arguments) -},{"./_stream_readable":239,"./_stream_writable":241,"_process":212,"dup":72,"inherits":193}],238:[function(require,module,exports){ -arguments[4][73][0].apply(exports,arguments) -},{"./_stream_transform":240,"dup":73,"inherits":193}],239:[function(require,module,exports){ -arguments[4][74][0].apply(exports,arguments) -},{"../errors":236,"./_stream_duplex":237,"./internal/streams/async_iterator":242,"./internal/streams/buffer_list":243,"./internal/streams/destroy":244,"./internal/streams/from":246,"./internal/streams/state":248,"./internal/streams/stream":249,"_process":212,"buffer":88,"dup":74,"events":160,"inherits":193,"string_decoder/":250,"util":43}],240:[function(require,module,exports){ -arguments[4][75][0].apply(exports,arguments) -},{"../errors":236,"./_stream_duplex":237,"dup":75,"inherits":193}],241:[function(require,module,exports){ -arguments[4][76][0].apply(exports,arguments) -},{"../errors":236,"./_stream_duplex":237,"./internal/streams/destroy":244,"./internal/streams/state":248,"./internal/streams/stream":249,"_process":212,"buffer":88,"dup":76,"inherits":193,"util-deprecate":253}],242:[function(require,module,exports){ -arguments[4][77][0].apply(exports,arguments) -},{"./end-of-stream":245,"_process":212,"dup":77}],243:[function(require,module,exports){ -arguments[4][78][0].apply(exports,arguments) -},{"buffer":88,"dup":78,"util":43}],244:[function(require,module,exports){ -arguments[4][79][0].apply(exports,arguments) -},{"_process":212,"dup":79}],245:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"../../../errors":236,"dup":80}],246:[function(require,module,exports){ -arguments[4][81][0].apply(exports,arguments) -},{"dup":81}],247:[function(require,module,exports){ -arguments[4][82][0].apply(exports,arguments) -},{"../../../errors":236,"./end-of-stream":245,"dup":82}],248:[function(require,module,exports){ -arguments[4][83][0].apply(exports,arguments) -},{"../../../errors":236,"dup":83}],249:[function(require,module,exports){ -arguments[4][84][0].apply(exports,arguments) -},{"dup":84,"events":160}],250:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +var index = /*#__PURE__*/Object.freeze({ + __proto__: null, + JsonBase64UrlArrayBufferConverter: JsonBase64UrlArrayBufferConverter, + AsnIntegerArrayBufferConverter: AsnIntegerArrayBufferConverter +}); -'use strict'; +class RsaPrivateKey { + constructor() { + this.version = 0; + this.modulus = new ArrayBuffer(0); + this.publicExponent = new ArrayBuffer(0); + this.privateExponent = new ArrayBuffer(0); + this.prime1 = new ArrayBuffer(0); + this.prime2 = new ArrayBuffer(0); + this.exponent1 = new ArrayBuffer(0); + this.exponent2 = new ArrayBuffer(0); + this.coefficient = new ArrayBuffer(0); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: asn1Schema.AsnIntegerConverter }) +], RsaPrivateKey.prototype, "version", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "n", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "modulus", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "e", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "publicExponent", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "d", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "privateExponent", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "p", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "prime1", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "q", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "prime2", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "dp", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "exponent1", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "dq", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "exponent2", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "qi", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPrivateKey.prototype, "coefficient", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Any, optional: true }) +], RsaPrivateKey.prototype, "otherPrimeInfos", void 0); -/*<replacement>*/ +class RsaPublicKey { + constructor() { + this.modulus = new ArrayBuffer(0); + this.publicExponent = new ArrayBuffer(0); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "n", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPublicKey.prototype, "modulus", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), + jsonSchema.JsonProp({ name: "e", converter: JsonBase64UrlArrayBufferConverter }) +], RsaPublicKey.prototype, "publicExponent", void 0); -var Buffer = require('safe-buffer').Buffer; -/*</replacement>*/ +let EcPublicKey = class EcPublicKey { + constructor(value) { + this.value = new ArrayBuffer(0); + if (value) { + this.value = value; + } + } + toJSON() { + let bytes = new Uint8Array(this.value); + if (bytes[0] !== 0x04) { + throw new CryptoError("Wrong ECPoint. Current version supports only Uncompressed (0x04) point"); + } + bytes = new Uint8Array(this.value.slice(1)); + const size = bytes.length / 2; + const offset = 0; + const json = { + x: pvtsutils.Convert.ToBase64Url(bytes.buffer.slice(offset, offset + size)), + y: pvtsutils.Convert.ToBase64Url(bytes.buffer.slice(offset + size, offset + size + size)), + }; + return json; + } + fromJSON(json) { + if (!("x" in json)) { + throw new Error("x: Missing required property"); + } + if (!("y" in json)) { + throw new Error("y: Missing required property"); + } + const x = pvtsutils.Convert.FromBase64Url(json.x); + const y = pvtsutils.Convert.FromBase64Url(json.y); + const value = Buffer.concat([ + new Uint8Array([0x04]), + new Uint8Array(x), + new Uint8Array(y), + ]); + this.value = new Uint8Array(value).buffer; + return this; + } +}; +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) +], EcPublicKey.prototype, "value", void 0); +EcPublicKey = tslib.__decorate([ + asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) +], EcPublicKey); -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; +class EcPrivateKey { + constructor() { + this.version = 1; + this.privateKey = new ArrayBuffer(0); + } + fromJSON(json) { + if (!("d" in json)) { + throw new Error("d: Missing required property"); + } + this.privateKey = pvtsutils.Convert.FromBase64Url(json.d); + if ("x" in json) { + const publicKey = new EcPublicKey(); + publicKey.fromJSON(json); + this.publicKey = asn1Schema.AsnSerializer.toASN(publicKey).valueBlock.valueHex; + } + return this; + } + toJSON() { + const jwk = {}; + jwk.d = pvtsutils.Convert.ToBase64Url(this.privateKey); + if (this.publicKey) { + Object.assign(jwk, new EcPublicKey(this.publicKey).toJSON()); + } + return jwk; + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: asn1Schema.AsnIntegerConverter }) +], EcPrivateKey.prototype, "version", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) +], EcPrivateKey.prototype, "privateKey", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ context: 0, type: asn1Schema.AsnPropTypes.Any, optional: true }) +], EcPrivateKey.prototype, "parameters", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ context: 1, type: asn1Schema.AsnPropTypes.BitString, optional: true }) +], EcPrivateKey.prototype, "publicKey", void 0); -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } +const AsnIntegerWithoutPaddingConverter = { + fromASN: (value) => { + const bytes = new Uint8Array(value.valueBlock.valueHex); + return (bytes[0] === 0) + ? bytes.buffer.slice(1) + : bytes.buffer; + }, + toASN: (value) => { + const bytes = new Uint8Array(value); + if (bytes[0] > 127) { + const newValue = new Uint8Array(bytes.length + 1); + newValue.set(bytes, 1); + return new asn1.Integer({ valueHex: newValue.buffer }); + } + return new asn1.Integer({ valueHex: value }); + }, }; -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} +var index$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + AsnIntegerWithoutPaddingConverter: AsnIntegerWithoutPaddingConverter +}); -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; +class EcDsaSignature { + constructor() { + this.r = new ArrayBuffer(0); + this.s = new ArrayBuffer(0); + } + static fromWebCryptoSignature(value) { + const wcSignature = pvtsutils.BufferSourceConverter.toUint8Array(value); + const pointSize = wcSignature.byteLength / 2; + const ecSignature = new this(); + ecSignature.r = ecSignature.removePadding(wcSignature.slice(0, pointSize)); + ecSignature.s = ecSignature.removePadding(wcSignature.slice(pointSize, pointSize * 2)); + return ecSignature; + } + toWebCryptoSignature(pointSize) { + pointSize = this.getPointSize(); + const r = this.addPadding(pointSize, pvtsutils.BufferSourceConverter.toUint8Array(this.r)); + const s = this.addPadding(pointSize, pvtsutils.BufferSourceConverter.toUint8Array(this.s)); + const wcSignature = new Uint8Array(r.byteLength + s.byteLength); + wcSignature.set(r, 0); + wcSignature.set(s, r.length); + return wcSignature.buffer; + } + getPointSize() { + const size = Math.max(this.r.byteLength, this.s.byteLength); + switch (size) { + case 31: + case 32: + return 32; + case 47: + case 48: + return 48; + case 65: + case 66: + return 66; + } + throw new Error("Unsupported EC point size"); + } + addPadding(pointSize, bytes) { + const res = new Uint8Array(pointSize); + const uint8Array = pvtsutils.BufferSourceConverter.toUint8Array(bytes); + res.set(uint8Array, pointSize - uint8Array.length); + return res; + } + removePadding(bytes) { + const uint8Array = pvtsutils.BufferSourceConverter.toUint8Array(bytes); + for (let i = 0; i < uint8Array.length; i++) { + if (!uint8Array[i]) { + continue; + } + return uint8Array.slice(i); + } + return new Uint8Array(0); + } +} +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerWithoutPaddingConverter }) +], EcDsaSignature.prototype, "r", void 0); +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerWithoutPaddingConverter }) +], EcDsaSignature.prototype, "s", void 0); -StringDecoder.prototype.end = utf8End; +let CurvePrivateKey = class CurvePrivateKey { +}; +tslib.__decorate([ + asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }), + jsonSchema.JsonProp({ type: jsonSchema.JsonPropTypes.String, converter: JsonBase64UrlArrayBufferConverter }) +], CurvePrivateKey.prototype, "d", void 0); +CurvePrivateKey = tslib.__decorate([ + asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) +], CurvePrivateKey); -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; +const idX25519 = "1.3.101.110"; +const idX448 = "1.3.101.111"; +const idEd25519 = "1.3.101.112"; +const idEd448 = "1.3.101.113"; -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; +var index$2 = /*#__PURE__*/Object.freeze({ + __proto__: null, + converters: index$1, + get ObjectIdentifier () { return ObjectIdentifier; }, + AlgorithmIdentifier: AlgorithmIdentifier, + PrivateKeyInfo: PrivateKeyInfo, + PublicKeyInfo: PublicKeyInfo, + RsaPrivateKey: RsaPrivateKey, + RsaPublicKey: RsaPublicKey, + EcPrivateKey: EcPrivateKey, + get EcPublicKey () { return EcPublicKey; }, + EcDsaSignature: EcDsaSignature, + get CurvePrivateKey () { return CurvePrivateKey; }, + idX25519: idX25519, + idX448: idX448, + idEd25519: idEd25519, + idEd448: idEd448 +}); -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} +var index$3 = /*#__PURE__*/Object.freeze({ + __proto__: null, + converters: index +}); -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; +Object.defineProperty(exports, 'BufferSourceConverter', { + enumerable: true, + get: function () { + return pvtsutils.BufferSourceConverter; } - return 0; -} +}); +exports.AesCbcProvider = AesCbcProvider; +exports.AesCmacProvider = AesCmacProvider; +exports.AesCtrProvider = AesCtrProvider; +exports.AesEcbProvider = AesEcbProvider; +exports.AesGcmProvider = AesGcmProvider; +exports.AesKwProvider = AesKwProvider; +exports.AesProvider = AesProvider; +exports.AlgorithmError = AlgorithmError; +exports.Crypto = Crypto; +exports.CryptoError = CryptoError; +exports.CryptoKey = CryptoKey; +exports.DesProvider = DesProvider; +exports.EcdhEsProvider = EcdhEsProvider; +exports.EcdhProvider = EcdhProvider; +exports.EcdsaProvider = EcdsaProvider; +exports.EdDsaProvider = EdDsaProvider; +exports.EllipticProvider = EllipticProvider; +exports.HkdfProvider = HkdfProvider; +exports.HmacProvider = HmacProvider; +exports.OperationError = OperationError; +exports.Pbkdf2Provider = Pbkdf2Provider; +exports.PemConverter = PemConverter; +exports.ProviderCrypto = ProviderCrypto; +exports.ProviderStorage = ProviderStorage; +exports.RequiredPropertyError = RequiredPropertyError; +exports.RsaOaepProvider = RsaOaepProvider; +exports.RsaProvider = RsaProvider; +exports.RsaPssProvider = RsaPssProvider; +exports.RsaSsaProvider = RsaSsaProvider; +exports.SubtleCrypto = SubtleCrypto; +exports.UnsupportedOperationError = UnsupportedOperationError; +exports.asn1 = index$2; +exports.isJWK = isJWK; +exports.json = index$3; + +}).call(this)}).call(this,require("buffer").Buffer) +},{"@peculiar/asn1-schema":8,"@peculiar/json-schema":17,"asn1js":34,"buffer":83,"pvtsutils":214,"tslib":245}],249:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} +}); +exports.AbstractConstraint = void 0; -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} +var _namespace = require("../namespace.js"); -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} +var _object = require("../types/object.js"); -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} -},{"safe-buffer":225}],251:[function(require,module,exports){ -(function (global){(function (){ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || from); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -}); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],252:[function(require,module,exports){ -(function (global){(function (){ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.typeDetect = factory()); -}(this, (function () { 'use strict'; +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -/* ! - * type-detect - * Copyright(c) 2013 jake luer <jake@alogicalparadox.com> - * MIT Licensed - */ -var promiseExists = typeof Promise === 'function'; +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -/* eslint-disable no-undef */ -var globalObject = typeof self === 'object' ? self : global; // eslint-disable-line id-blacklist +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -var symbolExists = typeof Symbol !== 'undefined'; -var mapExists = typeof Map !== 'undefined'; -var setExists = typeof Set !== 'undefined'; -var weakMapExists = typeof WeakMap !== 'undefined'; -var weakSetExists = typeof WeakSet !== 'undefined'; -var dataViewExists = typeof DataView !== 'undefined'; -var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined'; -var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined'; -var setEntriesExists = setExists && typeof Set.prototype.entries === 'function'; -var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function'; -var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries()); -var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries()); -var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function'; -var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]()); -var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function'; -var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]()); -var toStringLeftSliceLength = 8; -var toStringRightSliceLength = -1; /** - * ### typeOf (obj) + * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined. * - * Uses `Object.prototype.toString` to determine the type of an object, - * normalising behaviour across engine versions & well optimised. + * derived classes must implement the method isValid(). * - * @param {Mixed} object - * @return {String} object type - * @api public - */ -function typeDetect(obj) { - /* ! Speed optimisation - * Pre: - * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled) - * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled) - * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled) - * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled) - * function x 2,556,769 ops/sec ±1.73% (77 runs sampled) - * Post: - * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled) - * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled) - * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled) - * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled) - * function x 31,296,870 ops/sec ±0.96% (83 runs sampled) - */ - var typeofObj = typeof obj; - if (typeofObj !== 'object') { - return typeofObj; - } - - /* ! Speed optimisation - * Pre: - * null x 28,645,765 ops/sec ±1.17% (82 runs sampled) - * Post: - * null x 36,428,962 ops/sec ±1.37% (84 runs sampled) - */ - if (obj === null) { - return 'null'; - } + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var AbstractConstraint = /*#__PURE__*/function (_Object) { + _inherits(AbstractConstraint, _Object); - /* ! Spec Conformance - * Test: `Object.prototype.toString.call(window)`` - * - Node === "[object global]" - * - Chrome === "[object global]" - * - Firefox === "[object Window]" - * - PhantomJS === "[object Window]" - * - Safari === "[object Window]" - * - IE 11 === "[object Window]" - * - IE Edge === "[object Window]" - * Test: `Object.prototype.toString.call(this)`` - * - Chrome Worker === "[object global]" - * - Firefox Worker === "[object DedicatedWorkerGlobalScope]" - * - Safari Worker === "[object DedicatedWorkerGlobalScope]" - * - IE 11 Worker === "[object WorkerGlobalScope]" - * - IE Edge Worker === "[object WorkerGlobalScope]" - */ - if (obj === globalObject) { - return 'global'; - } + var _super = _createSuper(AbstractConstraint); - /* ! Speed optimisation - * Pre: - * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled) - * Post: - * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled) + /** + * */ - if ( - Array.isArray(obj) && - (symbolToStringTagExists === false || !(Symbol.toStringTag in obj)) - ) { - return 'Array'; + function AbstractConstraint() { + _classCallCheck(this, AbstractConstraint); + + return _super.call(this); } + /** + * this method must return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ - // Not caching existence of `window` and related properties due to potential - // for `window` to be unset before tests in quasi-browser environments. - if (typeof window === 'object' && window !== null) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/browsers.html#location) - * WhatWG HTML$7.7.3 - The `Location` interface - * Test: `Object.prototype.toString.call(window.location)`` - * - IE <=11 === "[object Object]" - * - IE Edge <=13 === "[object Object]" - */ - if (typeof window.location === 'object' && obj === window.location) { - return 'Location'; - } - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#document) - * WhatWG HTML$3.1.1 - The `Document` object - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * WhatWG HTML states: - * > For historical reasons, Window objects must also have a - * > writable, configurable, non-enumerable property named - * > HTMLDocument whose value is the Document interface object. - * Test: `Object.prototype.toString.call(document)`` - * - Chrome === "[object HTMLDocument]" - * - Firefox === "[object HTMLDocument]" - * - Safari === "[object HTMLDocument]" - * - IE <=10 === "[object Document]" - * - IE 11 === "[object HTMLDocument]" - * - IE Edge <=13 === "[object HTMLDocument]" - */ - if (typeof window.document === 'object' && obj === window.document) { - return 'Document'; + _createClass(AbstractConstraint, [{ + key: "isValid", + value: function isValid(value) { + return Promise.reject(value); } + }]); - if (typeof window.navigator === 'object') { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray - * Test: `Object.prototype.toString.call(navigator.mimeTypes)`` - * - IE <=10 === "[object MSMimeTypesCollection]" - */ - if (typeof window.navigator.mimeTypes === 'object' && - obj === window.navigator.mimeTypes) { - return 'MimeTypeArray'; - } + return AbstractConstraint; +}(Object); - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray - * Test: `Object.prototype.toString.call(navigator.plugins)`` - * - IE <=10 === "[object MSPluginsCollection]" - */ - if (typeof window.navigator.plugins === 'object' && - obj === window.navigator.plugins) { - return 'PluginArray'; - } - } +exports.AbstractConstraint = AbstractConstraint; - if ((typeof window.HTMLElement === 'function' || - typeof window.HTMLElement === 'object') && - obj instanceof window.HTMLElement) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` - * Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` - * - IE <=10 === "[object HTMLBlockElement]" - */ - if (obj.tagName === 'BLOCKQUOTE') { - return 'HTMLQuoteElement'; - } +_namespace.Monster.assignToNamespace('Monster.Constraints', AbstractConstraint); - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltabledatacellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('td')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TD') { - return 'HTMLTableDataCellElement'; - } +},{"../namespace.js":258,"../types/object.js":261}],250:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltableheadercellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('th')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TH') { - return 'HTMLTableHeaderCellElement'; - } - } - } +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - /* ! Speed optimisation - * Pre: - * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled) - * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled) - * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled) - * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled) - * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled) - * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled) - * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled) - * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled) - * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled) - * Post: - * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled) - * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled) - * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled) - * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled) - * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled) - * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled) - * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled) - * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled) - * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled) - */ - var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]); - if (typeof stringTag === 'string') { - return stringTag; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; } +}); +exports.AbstractOperator = void 0; - var objPrototype = Object.getPrototypeOf(obj); - /* ! Speed optimisation - * Pre: - * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled) - * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled) - * Post: - * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled) - * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled) - */ - if (objPrototype === RegExp.prototype) { - return 'RegExp'; - } +var _abstract = require("./abstract.js"); - /* ! Speed optimisation - * Pre: - * date x 2,130,074 ops/sec ±4.42% (68 runs sampled) - * Post: - * date x 3,953,779 ops/sec ±1.35% (77 runs sampled) - */ - if (objPrototype === Date.prototype) { - return 'Date'; - } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag) - * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise": - * Test: `Object.prototype.toString.call(Promise.resolve())`` - * - Chrome <=47 === "[object Object]" - * - Edge <=20 === "[object Object]" - * - Firefox 29-Latest === "[object Promise]" - * - Safari 7.1-Latest === "[object Promise]" - */ - if (promiseExists && objPrototype === Promise.prototype) { - return 'Promise'; - } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - /* ! Speed optimisation - * Pre: - * set x 2,222,186 ops/sec ±1.31% (82 runs sampled) - * Post: - * set x 4,545,879 ops/sec ±1.13% (83 runs sampled) - */ - if (setExists && objPrototype === Set.prototype) { - return 'Set'; - } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - /* ! Speed optimisation - * Pre: - * map x 2,396,842 ops/sec ±1.59% (81 runs sampled) - * Post: - * map x 4,183,945 ops/sec ±6.59% (82 runs sampled) - */ - if (mapExists && objPrototype === Map.prototype) { - return 'Map'; - } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - /* ! Speed optimisation - * Pre: - * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled) - * Post: - * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled) - */ - if (weakSetExists && objPrototype === WeakSet.prototype) { - return 'WeakSet'; - } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - /* ! Speed optimisation - * Pre: - * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled) - * Post: - * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled) - */ - if (weakMapExists && objPrototype === WeakMap.prototype) { - return 'WeakMap'; - } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag) - * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView": - * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))`` - * - Edge <=13 === "[object Object]" - */ - if (dataViewExists && objPrototype === DataView.prototype) { - return 'DataView'; - } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag) - * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator": - * Test: `Object.prototype.toString.call(new Map().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (mapExists && objPrototype === mapIteratorPrototype) { - return 'Map Iterator'; - } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag) - * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator": - * Test: `Object.prototype.toString.call(new Set().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (setExists && objPrototype === setIteratorPrototype) { - return 'Set Iterator'; - } +/** + * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together. + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var AbstractOperator = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(AbstractOperator, _AbstractConstraint); - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag) - * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator": - * Test: `Object.prototype.toString.call([][Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" + var _super = _createSuper(AbstractOperator); + + /** + * + * @param {AbstractConstraint} operantA + * @param {AbstractConstraint} operantB + * @throws {TypeError} "parameters must be from type AbstractConstraint" */ - if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) { - return 'Array Iterator'; + function AbstractOperator(operantA, operantB) { + var _this; + + _classCallCheck(this, AbstractOperator); + + _this = _super.call(this); + + if (!(operantA instanceof _abstract.AbstractConstraint) || !(operantB instanceof _abstract.AbstractConstraint)) { + throw new TypeError("parameters must be from type AbstractConstraint"); + } + + _this.operantA = operantA; + _this.operantB = operantB; + return _this; } - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag) - * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator": - * Test: `Object.prototype.toString.call(''[Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" - */ - if (stringIteratorExists && objPrototype === stringIteratorPrototype) { - return 'String Iterator'; + return AbstractOperator; +}(_abstract.AbstractConstraint); + +exports.AbstractOperator = AbstractOperator; + +_abstract.Monster.assignToNamespace('Monster.Constraints', AbstractOperator); + +},{"./abstract.js":249}],251:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; } +}); +exports.AndOperator = void 0; - /* ! Speed optimisation - * Pre: - * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled) - * Post: - * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled) - */ - if (objPrototype === null) { - return 'Object'; +var _abstract = require("./abstract.js"); + +var _abstractoperator = require("./abstractoperator.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/andoperator.js'; + * new Monster.Constraint.AndOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/andoperator.js'; + * new AndOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var AndOperator = /*#__PURE__*/function (_AbstractOperator) { + _inherits(AndOperator, _AbstractOperator); + + var _super = _createSuper(AndOperator); + + function AndOperator() { + _classCallCheck(this, AndOperator); + + return _super.apply(this, arguments); } - return Object - .prototype - .toString - .call(obj) - .slice(toStringLeftSliceLength, toStringRightSliceLength); -} + _createClass(AndOperator, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]); + } + }]); -return typeDetect; + return AndOperator; +}(_abstractoperator.AbstractOperator); -}))); +exports.AndOperator = AndOperator; -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],253:[function(require,module,exports){ -(function (global){(function (){ +_abstract.Monster.assignToNamespace('Monster.Constraints', AndOperator); +},{"./abstract.js":249,"./abstractoperator.js":250}],252:[function(require,module,exports){ +'use strict'; /** - * Module exports. + * @author schukai GmbH */ -module.exports = deprecate; +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; + } +}); +exports.Invalid = void 0; + +var _abstract = require("./abstract.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. + * the invalid constraint allows an always invalid query to be performed. this contraint is mainly intended for testing. * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * you can call the method via the monster namespace `new Monster.Constraint.Invalid()`. * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/invalid.js'; + * new Monster.Constraint.Invalid().catch(()=>console.log(true)); + * </script> + * ``` * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. + * Alternatively, you can also integrate this function individually. * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public + * ``` + * <script type="module"> + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/invalid.js'; + * new Invalid().catch(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints */ +var Invalid = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(Invalid, _AbstractConstraint); -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; + var _super = _createSuper(Invalid); + + function Invalid() { + _classCallCheck(this, Invalid); + + return _super.apply(this, arguments); } - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; + _createClass(Invalid, [{ + key: "isValid", + value: + /** + * this method return a rejected promise + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.reject(value); } - return fn.apply(this, arguments); + }]); + + return Invalid; +}(_abstract.AbstractConstraint); + +exports.Invalid = Invalid; + +_abstract.Monster.assignToNamespace('Monster.Constraints', Invalid); + +},{"./abstract.js":249}],253:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; } +}); +exports.IsArray = void 0; - return deprecated; -} +var _abstract = require("./abstract.js"); + +var _is = require("../types/is.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * Checks `localStorage` for boolean values for the given `name`. * - * @param {String} name - * @returns {Boolean} - * @api private + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/isarray.js'; + * console.log(new Monster.Constraint.IsArray()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/isarray.js'; + * console.log(new IsArray()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints */ +var IsArray = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(IsArray, _AbstractConstraint); -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; + var _super = _createSuper(IsArray); + + function IsArray() { + _classCallCheck(this, IsArray); + + return _super.apply(this, arguments); } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],254:[function(require,module,exports){ -(function (Buffer){(function (){ -/** - * Copyright (c) 2019, Peculiar Ventures, All rights reserved. - */ + _createClass(IsArray, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + if ((0, _is.isArray)(value)) { + return Promise.resolve(value); + } -'use strict'; + return Promise.reject(value); + } + }]); -Object.defineProperty(exports, '__esModule', { value: true }); + return IsArray; +}(_abstract.AbstractConstraint); -var pvtsutils = require('pvtsutils'); -var tslib = require('tslib'); -var asn1Schema = require('@peculiar/asn1-schema'); -var jsonSchema = require('@peculiar/json-schema'); -var asn1 = require('asn1js'); +exports.IsArray = IsArray; -class CryptoError extends Error { -} +_abstract.Monster.assignToNamespace('Monster.Constraints', IsArray); -class AlgorithmError extends CryptoError { -} +},{"../types/is.js":260,"./abstract.js":249}],254:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ -class UnsupportedOperationError extends CryptoError { - constructor(methodName) { - super(`Unsupported operation: ${methodName ? `${methodName}` : ""}`); - } -} +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -class OperationError extends CryptoError { -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; + } +}); +exports.IsObject = void 0; -class RequiredPropertyError extends CryptoError { - constructor(propName) { - super(`${propName}: Missing required property`); - } -} +var _abstract = require("./abstract.js"); -class PemConverter { - static toArrayBuffer(pem) { - const base64 = pem - .replace(/-{5}(BEGIN|END) .*-{5}/g, "") - .replace("\r", "") - .replace("\n", ""); - return pvtsutils.Convert.FromBase64(base64); - } - static toUint8Array(pem) { - const bytes = this.toArrayBuffer(pem); - return new Uint8Array(bytes); - } - static fromBufferSource(buffer, tag) { - const base64 = pvtsutils.Convert.ToBase64(buffer); - let sliced; - let offset = 0; - const rows = []; - while (true) { - sliced = base64.slice(offset, offset = offset + 64); - if (sliced.length) { - rows.push(sliced); - if (sliced.length < 64) { - break; - } - } - else { - break; - } - } - const upperCaseTag = tag.toUpperCase(); - return `-----BEGIN ${upperCaseTag}-----\n${rows.join("\n")}\n-----END ${upperCaseTag}-----`; - } - static isPEM(data) { - return /-----BEGIN .+-----[A-Za-z0-9+\/\+\=\s\n]+-----END .+-----/i.test(data); - } - static getTagName(pem) { - if (!this.isPEM(pem)) { - throw new Error("Bad parameter. Incoming data is not right PEM"); - } - const res = /-----BEGIN (.+)-----/.exec(pem); - if (!res) { - throw new Error("Cannot get tag from PEM"); - } - return res[1]; - } - static hasTagName(pem, tagName) { - const tag = this.getTagName(pem); - return tagName.toLowerCase() === tag.toLowerCase(); - } - static isCertificate(pem) { - return this.hasTagName(pem, "certificate"); - } - static isCertificateRequest(pem) { - return this.hasTagName(pem, "certificate request"); - } - static isCRL(pem) { - return this.hasTagName(pem, "x509 crl"); - } - static isPublicKey(pem) { - return this.hasTagName(pem, "public key"); - } -} +var _is = require("../types/is.js"); -function isJWK(data) { - return typeof data === "object" && "kty" in data; -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -class ProviderCrypto { - async digest(...args) { - this.checkDigest.apply(this, args); - return this.onDigest.apply(this, args); - } - checkDigest(algorithm, data) { - this.checkAlgorithmName(algorithm); - } - async onDigest(algorithm, data) { - throw new UnsupportedOperationError("digest"); - } - async generateKey(...args) { - this.checkGenerateKey.apply(this, args); - return this.onGenerateKey.apply(this, args); - } - checkGenerateKey(algorithm, extractable, keyUsages, ...args) { - this.checkAlgorithmName(algorithm); - this.checkGenerateKeyParams(algorithm); - if (!(keyUsages && keyUsages.length)) { - throw new TypeError(`Usages cannot be empty when creating a key.`); - } - let allowedUsages; - if (Array.isArray(this.usages)) { - allowedUsages = this.usages; - } - else { - allowedUsages = this.usages.privateKey.concat(this.usages.publicKey); - } - this.checkKeyUsages(keyUsages, allowedUsages); - } - checkGenerateKeyParams(algorithm) { - } - async onGenerateKey(algorithm, extractable, keyUsages, ...args) { - throw new UnsupportedOperationError("generateKey"); - } - async sign(...args) { - this.checkSign.apply(this, args); - return this.onSign.apply(this, args); - } - checkSign(algorithm, key, data, ...args) { - this.checkAlgorithmName(algorithm); - this.checkAlgorithmParams(algorithm); - this.checkCryptoKey(key, "sign"); - } - async onSign(algorithm, key, data, ...args) { - throw new UnsupportedOperationError("sign"); - } - async verify(...args) { - this.checkVerify.apply(this, args); - return this.onVerify.apply(this, args); - } - checkVerify(algorithm, key, signature, data, ...args) { - this.checkAlgorithmName(algorithm); - this.checkAlgorithmParams(algorithm); - this.checkCryptoKey(key, "verify"); - } - async onVerify(algorithm, key, signature, data, ...args) { - throw new UnsupportedOperationError("verify"); - } - async encrypt(...args) { - this.checkEncrypt.apply(this, args); - return this.onEncrypt.apply(this, args); - } - checkEncrypt(algorithm, key, data, options = {}, ...args) { - this.checkAlgorithmName(algorithm); - this.checkAlgorithmParams(algorithm); - this.checkCryptoKey(key, options.keyUsage ? "encrypt" : void 0); - } - async onEncrypt(algorithm, key, data, ...args) { - throw new UnsupportedOperationError("encrypt"); - } - async decrypt(...args) { - this.checkDecrypt.apply(this, args); - return this.onDecrypt.apply(this, args); - } - checkDecrypt(algorithm, key, data, options = {}, ...args) { - this.checkAlgorithmName(algorithm); - this.checkAlgorithmParams(algorithm); - this.checkCryptoKey(key, options.keyUsage ? "decrypt" : void 0); - } - async onDecrypt(algorithm, key, data, ...args) { - throw new UnsupportedOperationError("decrypt"); - } - async deriveBits(...args) { - this.checkDeriveBits.apply(this, args); - return this.onDeriveBits.apply(this, args); - } - checkDeriveBits(algorithm, baseKey, length, options = {}, ...args) { - this.checkAlgorithmName(algorithm); - this.checkAlgorithmParams(algorithm); - this.checkCryptoKey(baseKey, options.keyUsage ? "deriveBits" : void 0); - if (length % 8 !== 0) { - throw new OperationError("length: Is not multiple of 8"); - } - } - async onDeriveBits(algorithm, baseKey, length, ...args) { - throw new UnsupportedOperationError("deriveBits"); - } - async exportKey(...args) { - this.checkExportKey.apply(this, args); - return this.onExportKey.apply(this, args); - } - checkExportKey(format, key, ...args) { - this.checkKeyFormat(format); - this.checkCryptoKey(key); - if (!key.extractable) { - throw new CryptoError("key: Is not extractable"); - } - } - async onExportKey(format, key, ...args) { - throw new UnsupportedOperationError("exportKey"); - } - async importKey(...args) { - this.checkImportKey.apply(this, args); - return this.onImportKey.apply(this, args); - } - checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { - this.checkKeyFormat(format); - this.checkKeyData(format, keyData); - this.checkAlgorithmName(algorithm); - this.checkImportParams(algorithm); - if (Array.isArray(this.usages)) { - this.checkKeyUsages(keyUsages, this.usages); - } - } - async onImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { - throw new UnsupportedOperationError("importKey"); - } - checkAlgorithmName(algorithm) { - if (algorithm.name.toLowerCase() !== this.name.toLowerCase()) { - throw new AlgorithmError("Unrecognized name"); - } - } - checkAlgorithmParams(algorithm) { - } - checkDerivedKeyParams(algorithm) { - } - checkKeyUsages(usages, allowed) { - for (const usage of usages) { - if (allowed.indexOf(usage) === -1) { - throw new TypeError("Cannot create a key using the specified key usages"); - } - } - } - checkCryptoKey(key, keyUsage) { - this.checkAlgorithmName(key.algorithm); - if (keyUsage && key.usages.indexOf(keyUsage) === -1) { - throw new CryptoError(`key does not match that of operation`); - } - } - checkRequiredProperty(data, propName) { - if (!(propName in data)) { - throw new RequiredPropertyError(propName); - } - } - checkHashAlgorithm(algorithm, hashAlgorithms) { - for (const item of hashAlgorithms) { - if (item.toLowerCase() === algorithm.name.toLowerCase()) { - return; - } - } - throw new OperationError(`hash: Must be one of ${hashAlgorithms.join(", ")}`); - } - checkImportParams(algorithm) { - } - checkKeyFormat(format) { - switch (format) { - case "raw": - case "pkcs8": - case "spki": - case "jwk": - break; - default: - throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'"); - } - } - checkKeyData(format, keyData) { - if (!keyData) { - throw new TypeError("keyData: Cannot be empty on empty on key importing"); - } - if (format === "jwk") { - if (!isJWK(keyData)) { - throw new TypeError("keyData: Is not JsonWebToken"); - } - } - else if (!pvtsutils.BufferSourceConverter.isBufferSource(keyData)) { - throw new TypeError("keyData: Is not ArrayBufferView or ArrayBuffer"); - } - } - prepareData(data) { - return pvtsutils.BufferSourceConverter.toArrayBuffer(data); - } -} +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -class AesProvider extends ProviderCrypto { - checkGenerateKeyParams(algorithm) { - this.checkRequiredProperty(algorithm, "length"); - if (typeof algorithm.length !== "number") { - throw new TypeError("length: Is not of type Number"); - } - switch (algorithm.length) { - case 128: - case 192: - case 256: - break; - default: - throw new TypeError("length: Must be 128, 192, or 256"); - } - } - checkDerivedKeyParams(algorithm) { - this.checkGenerateKeyParams(algorithm); - } -} +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -class AesCbcProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-CBC"; - this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "iv"); - if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { - throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - if (algorithm.iv.byteLength !== 16) { - throw new TypeError("iv: Must have length 16 bytes"); - } - } -} +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -class AesCmacProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-CMAC"; - this.usages = ["sign", "verify"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "length"); - if (typeof algorithm.length !== "number") { - throw new TypeError("length: Is not a Number"); - } - if (algorithm.length < 1) { - throw new OperationError("length: Must be more than 0"); - } - } -} +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -class AesCtrProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-CTR"; - this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "counter"); - if (!(algorithm.counter instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.counter))) { - throw new TypeError("counter: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - if (algorithm.counter.byteLength !== 16) { - throw new TypeError("iv: Must have length 16 bytes"); - } - this.checkRequiredProperty(algorithm, "length"); - if (typeof algorithm.length !== "number") { - throw new TypeError("length: Is not a Number"); - } - if (algorithm.length < 1) { - throw new OperationError("length: Must be more than 0"); - } - } -} +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -class AesEcbProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-ECB"; - this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; - } -} +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -class AesGcmProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-GCM"; - this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "iv"); - if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { - throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - if (algorithm.iv.byteLength < 1) { - throw new OperationError("iv: Must have length more than 0 and less than 2^64 - 1"); - } - if (!("tagLength" in algorithm)) { - algorithm.tagLength = 128; - } - switch (algorithm.tagLength) { - case 32: - case 64: - case 96: - case 104: - case 112: - case 120: - case 128: - break; - default: - throw new OperationError("tagLength: Must be one of 32, 64, 96, 104, 112, 120 or 128"); - } - } -} +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -class AesKwProvider extends AesProvider { - constructor() { - super(...arguments); - this.name = "AES-KW"; - this.usages = ["wrapKey", "unwrapKey"]; - } -} +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -class DesProvider extends ProviderCrypto { - constructor() { - super(...arguments); - this.usages = ["encrypt", "decrypt", "wrapKey", "unwrapKey"]; - } - checkAlgorithmParams(algorithm) { - if (this.ivSize) { - this.checkRequiredProperty(algorithm, "iv"); - if (!(algorithm.iv instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.iv))) { - throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - if (algorithm.iv.byteLength !== this.ivSize) { - throw new TypeError(`iv: Must have length ${this.ivSize} bytes`); - } - } - } - checkGenerateKeyParams(algorithm) { - this.checkRequiredProperty(algorithm, "length"); - if (typeof algorithm.length !== "number") { - throw new TypeError("length: Is not of type Number"); - } - if (algorithm.length !== this.keySizeBits) { - throw new OperationError(`algorith.length: Must be ${this.keySizeBits}`); - } - } - checkDerivedKeyParams(algorithm) { - this.checkGenerateKeyParams(algorithm); - } -} +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * + * + * you can call the method via the monster namespace `new Monster.Constraint.IsObject()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/isobject.js'; + * console.log(new Monster.Constraint.IsObject()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/isobject.js'; + * console.log(new IsObject()) + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var IsObject = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(IsObject, _AbstractConstraint); -class RsaProvider extends ProviderCrypto { - constructor() { - super(...arguments); - this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; - } - checkGenerateKeyParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - this.checkRequiredProperty(algorithm, "publicExponent"); - if (!(algorithm.publicExponent && algorithm.publicExponent instanceof Uint8Array)) { - throw new TypeError("publicExponent: Missing or not a Uint8Array"); - } - const publicExponent = pvtsutils.Convert.ToBase64(algorithm.publicExponent); - if (!(publicExponent === "Aw==" || publicExponent === "AQAB")) { - throw new TypeError("publicExponent: Must be [3] or [1,0,1]"); - } - this.checkRequiredProperty(algorithm, "modulusLength"); - switch (algorithm.modulusLength) { - case 1024: - case 2048: - case 4096: - break; - default: - throw new TypeError("modulusLength: Must be 1024, 2048, or 4096"); - } - } - checkImportParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - } -} + var _super = _createSuper(IsObject); -class RsaSsaProvider extends RsaProvider { - constructor() { - super(...arguments); - this.name = "RSASSA-PKCS1-v1_5"; - this.usages = { - privateKey: ["sign"], - publicKey: ["verify"], - }; - } -} + function IsObject() { + _classCallCheck(this, IsObject); -class RsaPssProvider extends RsaProvider { - constructor() { - super(...arguments); - this.name = "RSA-PSS"; - this.usages = { - privateKey: ["sign"], - publicKey: ["verify"], - }; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "saltLength"); - if (typeof algorithm.saltLength !== "number") { - throw new TypeError("saltLength: Is not a Number"); - } - if (algorithm.saltLength < 0) { - throw new RangeError("saltLength: Must be positive number"); - } - } -} + return _super.apply(this, arguments); + } -class RsaOaepProvider extends RsaProvider { - constructor() { - super(...arguments); - this.name = "RSA-OAEP"; - this.usages = { - privateKey: ["decrypt", "unwrapKey"], - publicKey: ["encrypt", "wrapKey"], - }; - } - checkAlgorithmParams(algorithm) { - if (algorithm.label - && !(algorithm.label instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.label))) { - throw new TypeError("label: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - } -} + _createClass(IsObject, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + if ((0, _is.isObject)(value)) { + return Promise.resolve(value); + } -class EllipticProvider extends ProviderCrypto { - checkGenerateKeyParams(algorithm) { - this.checkRequiredProperty(algorithm, "namedCurve"); - this.checkNamedCurve(algorithm.namedCurve); - } - checkNamedCurve(namedCurve) { - for (const item of this.namedCurves) { - if (item.toLowerCase() === namedCurve.toLowerCase()) { - return; - } - } - throw new OperationError(`namedCurve: Must be one of ${this.namedCurves.join(", ")}`); - } -} + return Promise.reject(value); + } + }]); -class EcdsaProvider extends EllipticProvider { - constructor() { - super(...arguments); - this.name = "ECDSA"; - this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; - this.usages = { - privateKey: ["sign"], - publicKey: ["verify"], - }; - this.namedCurves = ["P-256", "P-384", "P-521", "K-256"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - } -} + return IsObject; +}(_abstract.AbstractConstraint); -const KEY_TYPES = ["secret", "private", "public"]; -class CryptoKey { - static create(algorithm, type, extractable, usages) { - const key = new this(); - key.algorithm = algorithm; - key.type = type; - key.extractable = extractable; - key.usages = usages; - return key; - } - static isKeyType(data) { - return KEY_TYPES.indexOf(data) !== -1; - } - get [Symbol.toStringTag]() { - return "CryptoKey"; - } -} +exports.IsObject = IsObject; -class EcdhProvider extends EllipticProvider { - constructor() { - super(...arguments); - this.name = "ECDH"; - this.usages = { - privateKey: ["deriveBits", "deriveKey"], - publicKey: [], - }; - this.namedCurves = ["P-256", "P-384", "P-521", "K-256"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "public"); - if (!(algorithm.public instanceof CryptoKey)) { - throw new TypeError("public: Is not a CryptoKey"); - } - if (algorithm.public.type !== "public") { - throw new OperationError("public: Is not a public key"); - } - if (algorithm.public.algorithm.name !== this.name) { - throw new OperationError(`public: Is not ${this.name} key`); - } - } -} +_abstract.Monster.assignToNamespace('Monster.Constraints', IsObject); -class EcdhEsProvider extends EcdhProvider { - constructor() { - super(...arguments); - this.name = "ECDH-ES"; - this.namedCurves = ["X25519", "X448"]; - } -} +},{"../types/is.js":260,"./abstract.js":249}],255:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ -class EdDsaProvider extends EllipticProvider { - constructor() { - super(...arguments); - this.name = "EdDSA"; - this.usages = { - privateKey: ["sign"], - publicKey: ["verify"], - }; - this.namedCurves = ["Ed25519", "Ed448"]; - } -} +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -class HmacProvider extends ProviderCrypto { - constructor() { - super(...arguments); - this.name = "HMAC"; - this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; - this.usages = ["sign", "verify"]; - } - getDefaultLength(algName) { - switch (algName.toUpperCase()) { - case "SHA-1": - case "SHA-256": - case "SHA-384": - case "SHA-512": - return 512; - default: - throw new Error(`Unknown algorithm name '${algName}'`); - } - } - checkGenerateKeyParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - if ("length" in algorithm) { - if (typeof algorithm.length !== "number") { - throw new TypeError("length: Is not a Number"); - } - if (algorithm.length < 1) { - throw new RangeError("length: Number is out of range"); - } - } - } - checkImportParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - } -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstractoperator.Monster; + } +}); +exports.OrOperator = void 0; -class Pbkdf2Provider extends ProviderCrypto { - constructor() { - super(...arguments); - this.name = "PBKDF2"; - this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; - this.usages = ["deriveBits", "deriveKey"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - this.checkRequiredProperty(algorithm, "salt"); - if (!(algorithm.salt instanceof ArrayBuffer || ArrayBuffer.isView(algorithm.salt))) { - throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - this.checkRequiredProperty(algorithm, "iterations"); - if (typeof algorithm.iterations !== "number") { - throw new TypeError("iterations: Is not a Number"); - } - if (algorithm.iterations < 1) { - throw new TypeError("iterations: Is less than 1"); - } - } - checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { - super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); - if (extractable) { - throw new SyntaxError("extractable: Must be 'false'"); - } - } -} +var _abstractoperator = require("./abstractoperator.js"); -class HkdfProvider extends ProviderCrypto { - constructor() { - super(...arguments); - this.name = "HKDF"; - this.hashAlgorithms = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"]; - this.usages = ["deriveKey", "deriveBits"]; - } - checkAlgorithmParams(algorithm) { - this.checkRequiredProperty(algorithm, "hash"); - this.checkHashAlgorithm(algorithm.hash, this.hashAlgorithms); - this.checkRequiredProperty(algorithm, "salt"); - if (!pvtsutils.BufferSourceConverter.isBufferSource(algorithm.salt)) { - throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - this.checkRequiredProperty(algorithm, "info"); - if (!pvtsutils.BufferSourceConverter.isBufferSource(algorithm.info)) { - throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'"); - } - } - checkImportKey(format, keyData, algorithm, extractable, keyUsages, ...args) { - super.checkImportKey(format, keyData, algorithm, extractable, keyUsages); - if (extractable) { - throw new SyntaxError("extractable: Must be 'false'"); - } - } -} +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -class Crypto { - get [Symbol.toStringTag]() { - return "Crypto"; - } -} +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -class ProviderStorage { - constructor() { - this.items = {}; - } - get(algorithmName) { - return this.items[algorithmName.toLowerCase()] || null; - } - set(provider) { - this.items[provider.name.toLowerCase()] = provider; - } - removeAt(algorithmName) { - const provider = this.get(algorithmName.toLowerCase()); - if (provider) { - delete this.items[algorithmName]; - } - return provider; - } - has(name) { - return !!this.get(name); - } - get length() { - return Object.keys(this.items).length; - } - get algorithms() { - const algorithms = []; - for (const key in this.items) { - const provider = this.items[key]; - algorithms.push(provider.name); - } - return algorithms.sort(); - } -} +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -class SubtleCrypto { - constructor() { - this.providers = new ProviderStorage(); - } - static isHashedAlgorithm(data) { - return data - && typeof data === "object" - && "name" in data - && "hash" in data - ? true - : false; - } - get [Symbol.toStringTag]() { - return "SubtleCrypto"; - } - async digest(...args) { - this.checkRequiredArguments(args, 2, "digest"); - const [algorithm, data, ...params] = args; - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.digest(preparedAlgorithm, preparedData, ...params); - return result; - } - async generateKey(...args) { - this.checkRequiredArguments(args, 3, "generateKey"); - const [algorithm, extractable, keyUsages, ...params] = args; - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.generateKey({ ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); - return result; - } - async sign(...args) { - this.checkRequiredArguments(args, 3, "sign"); - const [algorithm, key, data, ...params] = args; - this.checkCryptoKey(key); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.sign({ ...preparedAlgorithm, name: provider.name }, key, preparedData, ...params); - return result; - } - async verify(...args) { - this.checkRequiredArguments(args, 4, "verify"); - const [algorithm, key, signature, data, ...params] = args; - this.checkCryptoKey(key); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); - const preparedSignature = pvtsutils.BufferSourceConverter.toArrayBuffer(signature); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.verify({ ...preparedAlgorithm, name: provider.name }, key, preparedSignature, preparedData, ...params); - return result; - } - async encrypt(...args) { - this.checkRequiredArguments(args, 3, "encrypt"); - const [algorithm, key, data, ...params] = args; - this.checkCryptoKey(key); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.encrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); - return result; - } - async decrypt(...args) { - this.checkRequiredArguments(args, 3, "decrypt"); - const [algorithm, key, data, ...params] = args; - this.checkCryptoKey(key); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(data); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, key, preparedData, { keyUsage: true }, ...params); - return result; - } - async deriveBits(...args) { - this.checkRequiredArguments(args, 3, "deriveBits"); - const [algorithm, baseKey, length, ...params] = args; - this.checkCryptoKey(baseKey); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const provider = this.getProvider(preparedAlgorithm.name); - const result = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, length, { keyUsage: true }, ...params); - return result; - } - async deriveKey(...args) { - this.checkRequiredArguments(args, 5, "deriveKey"); - const [algorithm, baseKey, derivedKeyType, extractable, keyUsages, ...params] = args; - const preparedDerivedKeyType = this.prepareAlgorithm(derivedKeyType); - const importProvider = this.getProvider(preparedDerivedKeyType.name); - importProvider.checkDerivedKeyParams(preparedDerivedKeyType); - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const provider = this.getProvider(preparedAlgorithm.name); - provider.checkCryptoKey(baseKey, "deriveKey"); - const derivedBits = await provider.deriveBits({ ...preparedAlgorithm, name: provider.name }, baseKey, derivedKeyType.length || 512, { keyUsage: false }, ...params); - return this.importKey("raw", derivedBits, derivedKeyType, extractable, keyUsages, ...params); - } - async exportKey(...args) { - this.checkRequiredArguments(args, 2, "exportKey"); - const [format, key, ...params] = args; - this.checkCryptoKey(key); - const provider = this.getProvider(key.algorithm.name); - const result = await provider.exportKey(format, key, ...params); - return result; - } - async importKey(...args) { - this.checkRequiredArguments(args, 5, "importKey"); - const [format, keyData, algorithm, extractable, keyUsages, ...params] = args; - const preparedAlgorithm = this.prepareAlgorithm(algorithm); - const provider = this.getProvider(preparedAlgorithm.name); - if (["pkcs8", "spki", "raw"].indexOf(format) !== -1) { - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(keyData); - return provider.importKey(format, preparedData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); - } - else { - if (!keyData.kty) { - throw new TypeError("keyData: Is not JSON"); - } - } - return provider.importKey(format, keyData, { ...preparedAlgorithm, name: provider.name }, extractable, keyUsages, ...params); - } - async wrapKey(format, key, wrappingKey, wrapAlgorithm, ...args) { - let keyData = await this.exportKey(format, key, ...args); - if (format === "jwk") { - const json = JSON.stringify(keyData); - keyData = pvtsutils.Convert.FromUtf8String(json); - } - const preparedAlgorithm = this.prepareAlgorithm(wrapAlgorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(keyData); - const provider = this.getProvider(preparedAlgorithm.name); - return provider.encrypt({ ...preparedAlgorithm, name: provider.name }, wrappingKey, preparedData, { keyUsage: false }, ...args); - } - async unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, ...args) { - const preparedAlgorithm = this.prepareAlgorithm(unwrapAlgorithm); - const preparedData = pvtsutils.BufferSourceConverter.toArrayBuffer(wrappedKey); - const provider = this.getProvider(preparedAlgorithm.name); - let keyData = await provider.decrypt({ ...preparedAlgorithm, name: provider.name }, unwrappingKey, preparedData, { keyUsage: false }, ...args); - if (format === "jwk") { - try { - keyData = JSON.parse(pvtsutils.Convert.ToUtf8String(keyData)); - } - catch (e) { - const error = new TypeError("wrappedKey: Is not a JSON"); - error.internal = e; - throw error; - } - } - return this.importKey(format, keyData, unwrappedKeyAlgorithm, extractable, keyUsages, ...args); - } - checkRequiredArguments(args, size, methodName) { - if (args.length < size) { - throw new TypeError(`Failed to execute '${methodName}' on 'SubtleCrypto': ${size} arguments required, but only ${args.length} present`); - } - } - prepareAlgorithm(algorithm) { - if (typeof algorithm === "string") { - return { - name: algorithm, - }; - } - if (SubtleCrypto.isHashedAlgorithm(algorithm)) { - const preparedAlgorithm = { ...algorithm }; - preparedAlgorithm.hash = this.prepareAlgorithm(algorithm.hash); - return preparedAlgorithm; - } - return { ...algorithm }; - } - getProvider(name) { - const provider = this.providers.get(name); - if (!provider) { - throw new AlgorithmError("Unrecognized name"); - } - return provider; - } - checkCryptoKey(key) { - if (!(key instanceof CryptoKey)) { - throw new TypeError(`Key is not of type 'CryptoKey'`); - } - } -} +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; + * new Monster.Constraint.OrOperator(new Monster.Constraint.Valid(), new Monster.Constraint.Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/valid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraint/oroperator.js'; + * new OrOperator(new Valid(), new Valid()).then(()=>console.log(true)).catch(()=>console.log(false)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var OrOperator = /*#__PURE__*/function (_AbstractOperator) { + _inherits(OrOperator, _AbstractOperator); -let ObjectIdentifier = class ObjectIdentifier { - constructor(value) { - if (value) { - this.value = value; - } - } -}; -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.ObjectIdentifier }) -], ObjectIdentifier.prototype, "value", void 0); -ObjectIdentifier = tslib.__decorate([ - asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) -], ObjectIdentifier); + var _super = _createSuper(OrOperator); -class AlgorithmIdentifier { - constructor(params) { - Object.assign(this, params); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ - type: asn1Schema.AsnPropTypes.ObjectIdentifier, - }) -], AlgorithmIdentifier.prototype, "algorithm", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ - type: asn1Schema.AsnPropTypes.Any, - optional: true, - }) -], AlgorithmIdentifier.prototype, "parameters", void 0); + function OrOperator() { + _classCallCheck(this, OrOperator); -class PrivateKeyInfo { - constructor() { - this.version = 0; - this.privateKeyAlgorithm = new AlgorithmIdentifier(); - this.privateKey = new ArrayBuffer(0); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer }) -], PrivateKeyInfo.prototype, "version", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: AlgorithmIdentifier }) -], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) -], PrivateKeyInfo.prototype, "privateKey", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Any, optional: true }) -], PrivateKeyInfo.prototype, "attributes", void 0); + return _super.apply(this, arguments); + } -class PublicKeyInfo { - constructor() { - this.publicKeyAlgorithm = new AlgorithmIdentifier(); - this.publicKey = new ArrayBuffer(0); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: AlgorithmIdentifier }) -], PublicKeyInfo.prototype, "publicKeyAlgorithm", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.BitString }) -], PublicKeyInfo.prototype, "publicKey", void 0); + _createClass(OrOperator, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + var self = this; + return new Promise(function (resolve, reject) { + var a, b; + self.operantA.isValid(value).then(function () { + resolve(); + })["catch"](function () { + a = false; + /** b has already been evaluated and was not true */ + + if (b === false) { + reject(); + } + }); + self.operantB.isValid(value).then(function () { + resolve(); + })["catch"](function () { + b = false; + /** b has already been evaluated and was not true */ + + if (a === false) { + reject(); + } + }); + }); + } + }]); -const JsonBase64UrlArrayBufferConverter = { - fromJSON: (value) => pvtsutils.Convert.FromBase64Url(value), - toJSON: (value) => pvtsutils.Convert.ToBase64Url(new Uint8Array(value)), -}; + return OrOperator; +}(_abstractoperator.AbstractOperator); -const AsnIntegerArrayBufferConverter = { - fromASN: (value) => { - const valueHex = value.valueBlock.valueHex; - return !(new Uint8Array(valueHex)[0]) - ? value.valueBlock.valueHex.slice(1) - : value.valueBlock.valueHex; - }, - toASN: (value) => { - const valueHex = new Uint8Array(value)[0] > 127 - ? Buffer.concat([Buffer.from([0]), Buffer.from(value)]) - : Buffer.from(value); - return new asn1.Integer({ valueHex: new Uint8Array(valueHex).buffer }); - }, -}; +exports.OrOperator = OrOperator; -var index = /*#__PURE__*/Object.freeze({ - __proto__: null, - JsonBase64UrlArrayBufferConverter: JsonBase64UrlArrayBufferConverter, - AsnIntegerArrayBufferConverter: AsnIntegerArrayBufferConverter +_abstractoperator.Monster.assignToNamespace('Monster.Constraints', OrOperator); + +},{"./abstractoperator.js":250}],256:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _abstract.Monster; + } }); +exports.Valid = void 0; -class RsaPrivateKey { - constructor() { - this.version = 0; - this.modulus = new ArrayBuffer(0); - this.publicExponent = new ArrayBuffer(0); - this.privateExponent = new ArrayBuffer(0); - this.prime1 = new ArrayBuffer(0); - this.prime2 = new ArrayBuffer(0); - this.exponent1 = new ArrayBuffer(0); - this.exponent2 = new ArrayBuffer(0); - this.coefficient = new ArrayBuffer(0); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: asn1Schema.AsnIntegerConverter }) -], RsaPrivateKey.prototype, "version", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "n", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "modulus", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "e", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "publicExponent", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "d", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "privateExponent", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "p", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "prime1", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "q", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "prime2", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "dp", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "exponent1", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "dq", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "exponent2", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "qi", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPrivateKey.prototype, "coefficient", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Any, optional: true }) -], RsaPrivateKey.prototype, "otherPrimeInfos", void 0); +var _abstract = require("./abstract.js"); -class RsaPublicKey { - constructor() { - this.modulus = new ArrayBuffer(0); - this.publicExponent = new ArrayBuffer(0); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "n", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPublicKey.prototype, "modulus", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter }), - jsonSchema.JsonProp({ name: "e", converter: JsonBase64UrlArrayBufferConverter }) -], RsaPublicKey.prototype, "publicExponent", void 0); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -let EcPublicKey = class EcPublicKey { - constructor(value) { - this.value = new ArrayBuffer(0); - if (value) { - this.value = value; - } - } - toJSON() { - let bytes = new Uint8Array(this.value); - if (bytes[0] !== 0x04) { - throw new CryptoError("Wrong ECPoint. Current version supports only Uncompressed (0x04) point"); - } - bytes = new Uint8Array(this.value.slice(1)); - const size = bytes.length / 2; - const offset = 0; - const json = { - x: pvtsutils.Convert.ToBase64Url(bytes.buffer.slice(offset, offset + size)), - y: pvtsutils.Convert.ToBase64Url(bytes.buffer.slice(offset + size, offset + size + size)), - }; - return json; - } - fromJSON(json) { - if (!("x" in json)) { - throw new Error("x: Missing required property"); - } - if (!("y" in json)) { - throw new Error("y: Missing required property"); - } - const x = pvtsutils.Convert.FromBase64Url(json.x); - const y = pvtsutils.Convert.FromBase64Url(json.y); - const value = Buffer.concat([ - new Uint8Array([0x04]), - new Uint8Array(x), - new Uint8Array(y), - ]); - this.value = new Uint8Array(value).buffer; - return this; - } -}; -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) -], EcPublicKey.prototype, "value", void 0); -EcPublicKey = tslib.__decorate([ - asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) -], EcPublicKey); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -class EcPrivateKey { - constructor() { - this.version = 1; - this.privateKey = new ArrayBuffer(0); - } - fromJSON(json) { - if (!("d" in json)) { - throw new Error("d: Missing required property"); - } - this.privateKey = pvtsutils.Convert.FromBase64Url(json.d); - if ("x" in json) { - const publicKey = new EcPublicKey(); - publicKey.fromJSON(json); - this.publicKey = asn1Schema.AsnSerializer.toASN(publicKey).valueBlock.valueHex; - } - return this; - } - toJSON() { - const jwk = {}; - jwk.d = pvtsutils.Convert.ToBase64Url(this.privateKey); - if (this.publicKey) { - Object.assign(jwk, new EcPublicKey(this.publicKey).toJSON()); - } - return jwk; - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: asn1Schema.AsnIntegerConverter }) -], EcPrivateKey.prototype, "version", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }) -], EcPrivateKey.prototype, "privateKey", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ context: 0, type: asn1Schema.AsnPropTypes.Any, optional: true }) -], EcPrivateKey.prototype, "parameters", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ context: 1, type: asn1Schema.AsnPropTypes.BitString, optional: true }) -], EcPrivateKey.prototype, "publicKey", void 0); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -const AsnIntegerWithoutPaddingConverter = { - fromASN: (value) => { - const bytes = new Uint8Array(value.valueBlock.valueHex); - return (bytes[0] === 0) - ? bytes.buffer.slice(1) - : bytes.buffer; - }, - toASN: (value) => { - const bytes = new Uint8Array(value); - if (bytes[0] > 127) { - const newValue = new Uint8Array(bytes.length + 1); - newValue.set(bytes, 1); - return new asn1.Integer({ valueHex: newValue.buffer }); - } - return new asn1.Integer({ valueHex: value }); - }, -}; +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -var index$1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - AsnIntegerWithoutPaddingConverter: AsnIntegerWithoutPaddingConverter -}); +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -class EcDsaSignature { - constructor() { - this.r = new ArrayBuffer(0); - this.s = new ArrayBuffer(0); - } - static fromWebCryptoSignature(value) { - const wcSignature = pvtsutils.BufferSourceConverter.toUint8Array(value); - const pointSize = wcSignature.byteLength / 2; - const ecSignature = new this(); - ecSignature.r = ecSignature.removePadding(wcSignature.slice(0, pointSize)); - ecSignature.s = ecSignature.removePadding(wcSignature.slice(pointSize, pointSize * 2)); - return ecSignature; - } - toWebCryptoSignature(pointSize) { - pointSize = this.getPointSize(); - const r = this.addPadding(pointSize, pvtsutils.BufferSourceConverter.toUint8Array(this.r)); - const s = this.addPadding(pointSize, pvtsutils.BufferSourceConverter.toUint8Array(this.s)); - const wcSignature = new Uint8Array(r.byteLength + s.byteLength); - wcSignature.set(r, 0); - wcSignature.set(s, r.length); - return wcSignature.buffer; - } - getPointSize() { - const size = Math.max(this.r.byteLength, this.s.byteLength); - switch (size) { - case 31: - case 32: - return 32; - case 47: - case 48: - return 48; - case 65: - case 66: - return 66; - } - throw new Error("Unsupported EC point size"); - } - addPadding(pointSize, bytes) { - const res = new Uint8Array(pointSize); - const uint8Array = pvtsutils.BufferSourceConverter.toUint8Array(bytes); - res.set(uint8Array, pointSize - uint8Array.length); - return res; - } - removePadding(bytes) { - const uint8Array = pvtsutils.BufferSourceConverter.toUint8Array(bytes); - for (let i = 0; i < uint8Array.length; i++) { - if (!uint8Array[i]) { - continue; - } - return uint8Array.slice(i); - } - return new Uint8Array(0); - } -} -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerWithoutPaddingConverter }) -], EcDsaSignature.prototype, "r", void 0); -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.Integer, converter: AsnIntegerWithoutPaddingConverter }) -], EcDsaSignature.prototype, "s", void 0); +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -let CurvePrivateKey = class CurvePrivateKey { -}; -tslib.__decorate([ - asn1Schema.AsnProp({ type: asn1Schema.AsnPropTypes.OctetString }), - jsonSchema.JsonProp({ type: jsonSchema.JsonPropTypes.String, converter: JsonBase64UrlArrayBufferConverter }) -], CurvePrivateKey.prototype, "d", void 0); -CurvePrivateKey = tslib.__decorate([ - asn1Schema.AsnType({ type: asn1Schema.AsnTypeTypes.Choice }) -], CurvePrivateKey); +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } -const idX25519 = "1.3.101.110"; -const idX448 = "1.3.101.111"; -const idEd25519 = "1.3.101.112"; -const idEd448 = "1.3.101.113"; +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -var index$2 = /*#__PURE__*/Object.freeze({ - __proto__: null, - converters: index$1, - get ObjectIdentifier () { return ObjectIdentifier; }, - AlgorithmIdentifier: AlgorithmIdentifier, - PrivateKeyInfo: PrivateKeyInfo, - PublicKeyInfo: PublicKeyInfo, - RsaPrivateKey: RsaPrivateKey, - RsaPublicKey: RsaPublicKey, - EcPrivateKey: EcPrivateKey, - get EcPublicKey () { return EcPublicKey; }, - EcDsaSignature: EcDsaSignature, - get CurvePrivateKey () { return CurvePrivateKey; }, - idX25519: idX25519, - idX448: idX448, - idEd25519: idEd25519, - idEd448: idEd448 -}); +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -var index$3 = /*#__PURE__*/Object.freeze({ - __proto__: null, - converters: index -}); +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -Object.defineProperty(exports, 'BufferSourceConverter', { - enumerable: true, - get: function () { - return pvtsutils.BufferSourceConverter; +/** + * the valid constraint allows an always valid query to be performed. this contraint is mainly intended for testing. + * + * you can call the method via the monster namespace `new Monster.Constraint.Valid()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/valid.js'; + * new Monster.Constraint.Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/constraints/valid.js'; + * new Valid().then(()=>console.log(true)); + * </script> + * ``` + * + * @since 1.3.0 + * @copyright schukai GmbH + * @memberOf Monster/Constraints + */ +var Valid = /*#__PURE__*/function (_AbstractConstraint) { + _inherits(Valid, _AbstractConstraint); + + var _super = _createSuper(Valid); + + function Valid() { + _classCallCheck(this, Valid); + + return _super.apply(this, arguments); } -}); -exports.AesCbcProvider = AesCbcProvider; -exports.AesCmacProvider = AesCmacProvider; -exports.AesCtrProvider = AesCtrProvider; -exports.AesEcbProvider = AesEcbProvider; -exports.AesGcmProvider = AesGcmProvider; -exports.AesKwProvider = AesKwProvider; -exports.AesProvider = AesProvider; -exports.AlgorithmError = AlgorithmError; -exports.Crypto = Crypto; -exports.CryptoError = CryptoError; -exports.CryptoKey = CryptoKey; -exports.DesProvider = DesProvider; -exports.EcdhEsProvider = EcdhEsProvider; -exports.EcdhProvider = EcdhProvider; -exports.EcdsaProvider = EcdsaProvider; -exports.EdDsaProvider = EdDsaProvider; -exports.EllipticProvider = EllipticProvider; -exports.HkdfProvider = HkdfProvider; -exports.HmacProvider = HmacProvider; -exports.OperationError = OperationError; -exports.Pbkdf2Provider = Pbkdf2Provider; -exports.PemConverter = PemConverter; -exports.ProviderCrypto = ProviderCrypto; -exports.ProviderStorage = ProviderStorage; -exports.RequiredPropertyError = RequiredPropertyError; -exports.RsaOaepProvider = RsaOaepProvider; -exports.RsaProvider = RsaProvider; -exports.RsaPssProvider = RsaPssProvider; -exports.RsaSsaProvider = RsaSsaProvider; -exports.SubtleCrypto = SubtleCrypto; -exports.UnsupportedOperationError = UnsupportedOperationError; -exports.asn1 = index$2; -exports.isJWK = isJWK; -exports.json = index$3; -}).call(this)}).call(this,require("buffer").Buffer) -},{"@peculiar/asn1-schema":8,"@peculiar/json-schema":17,"asn1js":34,"buffer":88,"pvtsutils":220,"tslib":251}],255:[function(require,module,exports){ + _createClass(Valid, [{ + key: "isValid", + value: + /** + * this method return a promise containing the result of the check. + * + * @param {*} value + * @returns {Promise} + */ + function isValid(value) { + return Promise.resolve(value); + } + }]); + + return Valid; +}(_abstract.AbstractConstraint); + +exports.Valid = Valid; + +_abstract.Monster.assignToNamespace('Monster.Constraints', Valid); + +},{"./abstract.js":249}],257:[function(require,module,exports){ (function (global){(function (){ 'use strict'; /** @@ -51104,7 +50647,7 @@ var _namespace = require("../namespace.js"); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/math/random.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/math/random.js'; * console.log(Monster.Math.random(1,10)) // ↦ 5 * </script> * ``` @@ -51113,7 +50656,7 @@ var _namespace = require("../namespace.js"); * * ``` * <script type="module"> - * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/math/random.js'; + * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/math/random.js'; * console.log(random(1,10)) // ↦ 5 * </script> * ``` @@ -51175,82 +50718,39 @@ function create(min, max) { var range = max - min; if (range < 2) { - return min; - } - - var bitsNeeded = Math.ceil(Math.log2(range)); - - if (bitsNeeded > 53) { - throw new Error("we cannot generate numbers larger than 53 bits."); - } - - var bytesNeeded = Math.ceil(bitsNeeded / 8); - var mask = Math.pow(2, bitsNeeded) - 1; - var byteArray = new Uint8Array(bytesNeeded); - crypt.getRandomValues(byteArray); - var p = (bytesNeeded - 1) * 8; - - for (var i = 0; i < bytesNeeded; i++) { - rval += byteArray[i] * Math.pow(2, p); - p -= 8; - } - - rval = rval & mask; - - if (rval >= range) { - return create(min, max); - } - - return min + rval; -} - -_namespace.Monster.assignToNamespace('Monster.Math', random); - -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../namespace.js":257}],256:[function(require,module,exports){ -/** - * @license - * Copyright 2021 schukai GmbH - * SPDX-License-Identifier: AGPL-3.0-only or COMMERCIAL - * @author schukai GmbH - */ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "Monster", { - enumerable: true, - get: function get() { - return _namespace.Monster; - } -}); - -var _namespace = require("./namespace.js"); - -require("./types/id.js"); - -require("./types/is.js"); - -require("./types/object.js"); + return min; + } -require("./types/version.js"); + var bitsNeeded = Math.ceil(Math.log2(range)); -require("./types/observer.js"); + if (bitsNeeded > 53) { + throw new Error("we cannot generate numbers larger than 53 bits."); + } -require("./types/observerlist.js"); + var bytesNeeded = Math.ceil(bitsNeeded / 8); + var mask = Math.pow(2, bitsNeeded) - 1; + var byteArray = new Uint8Array(bytesNeeded); + crypt.getRandomValues(byteArray); + var p = (bytesNeeded - 1) * 8; -require("./types/validate.js"); + for (var i = 0; i < bytesNeeded; i++) { + rval += byteArray[i] * Math.pow(2, p); + p -= 8; + } -require("./math/random.js"); + rval = rval & mask; -require("./util/clone.js"); + if (rval >= range) { + return create(min, max); + } -require("./util/freeze.js"); + return min + rval; +} -_namespace.Monster.Util.deepFreeze(_namespace.Monster); +_namespace.Monster.assignToNamespace('Monster.Math', random); -},{"./math/random.js":255,"./namespace.js":257,"./types/id.js":258,"./types/is.js":259,"./types/object.js":260,"./types/observer.js":261,"./types/observerlist.js":262,"./types/validate.js":263,"./types/version.js":264,"./util/clone.js":265,"./util/freeze.js":266}],257:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../namespace.js":258}],258:[function(require,module,exports){ 'use strict'; /** * @namespace Monster @@ -51258,11 +50758,11 @@ _namespace.Monster.Util.deepFreeze(_namespace.Monster); */ /** - * Namespace class objects form the basic framework of the namespace administration. + * namespace class objects form the basic framework of the namespace administration. * - * All functions, classes and objects of the library hang within the namespace tree. + * all functions, classes and objects of the library hang within the namespace tree. * - * Via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. + * via `obj instanceof Monster.Namespace` it is also easy to check whether it is an object or a namespace. * * @memberOf Monster @@ -51345,7 +50845,7 @@ assignToNamespace('Monster', assignToNamespace); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/namespace.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/namespace.js'; * function hello() { * console.log('Hello World!'); * } @@ -51435,7 +50935,7 @@ function namespaceFor(parts) { return space; } -},{}],258:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ (function (global){(function (){ 'use strict'; /** @@ -51457,6 +50957,8 @@ exports.ID = void 0; var _namespace = require("../namespace.js"); +var _random = require("../math/random.js"); + require("../types/object.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -51481,12 +50983,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g var internalCounter = 0; /** + * id class * * you can call the method via the monster namespace `new Monster.Types.ID()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/id.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/id.js'; * console.log(new Monster.Types.ID()) * console.log(new Monster.Types.ID()) * </script> @@ -51496,7 +50999,7 @@ var internalCounter = 0; * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/id.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/id.js'; * console.log(new ID()) * console.log(new ID()) * </script> @@ -51512,6 +51015,9 @@ var ID = /*#__PURE__*/function (_Monster$Types$Object) { var _super = _createSuper(ID); + /** + * create new object + */ function ID() { var _this; @@ -51519,7 +51025,7 @@ var ID = /*#__PURE__*/function (_Monster$Types$Object) { _this = _super.call(this); internalCounter += 1; - _this.id = global.btoa(_namespace.Monster.Math.random(1, 10000)).replace(/=/g, '') + _this.id = global.btoa((0, _random.random)(1, 10000)).replace(/=/g, '') /** No numbers at the beginning of the ID, because of possible problems with DOM */ .replace(/^[0-9]+/, 'X') + internalCounter; return _this; @@ -51540,7 +51046,7 @@ exports.ID = ID; _namespace.Monster.assignToNamespace('Monster.Types', ID); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../namespace.js":257,"../types/object.js":260}],259:[function(require,module,exports){ +},{"../math/random.js":257,"../namespace.js":258,"../types/object.js":261}],260:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -51555,6 +51061,7 @@ exports.isString = isString; exports.isObject = isObject; exports.isArray = isArray; exports.isFunction = isFunction; +exports.isIterable = isIterable; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { @@ -51567,13 +51074,49 @@ var _namespace = require("../namespace.js"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** - * checks whether the value passed is a primitive (string, number, boolean or symbol) + * with this function you can check if a value is iterable + * + * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; + * console.log(Monster.Types.isIterable(null)) // ↦ false + * console.log(Monster.Types.isIterable('hello')) // ↦ true + * console.log(Monster.Types.isIterable([])) // ↦ true + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; + * console.log(isIterable(null)) // ↦ false + * console.log(isIterable('hello')) // ↦ true + * console.log(isIterable([])) // ↦ true + * </script> + * ``` + * + * @param {*} value + * @returns {boolean} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +function isIterable(value) { + if (value === undefined) return false; + if (value === null) return false; + return typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function'; +} +/** + * checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol) * * you can call the method via the monster namespace `Monster.Types.isPrimitive()`. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isPrimitive('2')) // ↦ false * console.log(Monster.Types.isPrimitive([])) // ↦ true * </script> @@ -51583,22 +51126,24 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isPrimitive('2')) // ↦ true * console.log(isPrimitive([])) // ↦ false * </script> * ``` - * + * * @param {*} value * @returns {boolean} * @since 1.0.0 * @copyright schukai GmbH * @memberOf Monster/Types */ + + function isPrimitive(value) { var type; - if (value === undefined || value === null) { + if (value === undefined || value === null || value === NaN) { return true; } @@ -51617,7 +51162,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isBoolean('2')) // ↦ false * console.log(Monster.Types.isBoolean([])) // ↦ false * console.log(Monster.Types.isBoolean(true)) // ↦ true @@ -51628,7 +51173,7 @@ function isPrimitive(value) { * * ``` * <script type="module"> - * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isBoolean('2')) // ↦ false * console.log(isBoolean([])) // ↦ false * console.log(isBoolean(2>4)) // ↦ true @@ -51652,22 +51197,22 @@ function isBoolean(value) { } /** * checks whether the value passed is a string - * + * * you can call the method via the monster namespace `Monster.Types.isString()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isString('2')) // ↦ true * console.log(Monster.Types.isString([])) // ↦ false * </script> * ``` - * + * * Alternatively, you can also integrate this function individually. - * + * * ``` * <script type="module"> - * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isString('2')) // ↦ true * console.log(isString([])) // ↦ false * </script> @@ -51695,7 +51240,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isObject('2')) // ↦ false * console.log(Monster.Types.isObject([])) // ↦ false * console.log(Monster.Types.isObject({})) // ↦ true @@ -51706,7 +51251,7 @@ function isString(value) { * * ``` * <script type="module"> - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isObject('2')) // ↦ false * console.log(isObject([])) // ↦ false * </script> @@ -51737,7 +51282,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isArray('2')) // ↦ false * console.log(Monster.Types.isArray([])) // ↦ true * </script> @@ -51747,7 +51292,7 @@ function isObject(value) { * * ``` * <script type="module"> - * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isArray('2')) // ↦ false * console.log(isArray([])) // ↦ true * </script> @@ -51775,7 +51320,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(Monster.Types.isFunction(()=>{})) // ↦ true * console.log(Monster.Types.isFunction('2')) // ↦ false * console.log(Monster.Types.isFunction([])) // ↦ false @@ -51786,7 +51331,7 @@ function isArray(value) { * * ``` * <script type="module"> - * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/is.js'; + * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/is.js'; * console.log(isFunction(()=>{})) // ↦ true * console.log(isFunction('2')) // ↦ false * console.log(isFunction([])) // ↦ false @@ -51812,9 +51357,9 @@ function isFunction(value) { return false; } -_namespace.Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction); +_namespace.Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable); -},{"../namespace.js":257}],260:[function(require,module,exports){ +},{"../namespace.js":258}],261:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -51846,7 +51391,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/object.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/object.js'; * console.log(new Monster.Types.Object()) * console.log(new Monster.Types.Object()) * </script> @@ -51856,7 +51401,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d * * ``` * <script type="module"> - * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/object.js'; + * import {Object} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/object.js'; * console.log(new Object()) * console.log(new Object()) * </script> @@ -51893,7 +51438,7 @@ exports.Object = _Object; _namespace.Monster.assignToNamespace('Monster.Types', _Object); -},{"../namespace.js":257}],261:[function(require,module,exports){ +},{"../namespace.js":258}],262:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -51914,6 +51459,10 @@ exports.Observer = void 0; var _namespace = require("../namespace.js"); +var _tokenlist = require("../types/tokenlist.js"); + +var _is = require("../types/is.js"); + require("../types/object.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -51943,8 +51492,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observer.js'; - * console.log(new Monster.Types.Observer()) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/observer.js'; * console.log(new Monster.Types.Observer()) * </script> * ``` @@ -51953,12 +51501,39 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observer.js'; - * console.log(Observer()) + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/observer.js'; * console.log(Observer()) * </script> * ``` * + * the update method is called with the subject object as this pointer. for this reason the callback should not + * be an arrow function, because it gets the this pointer of its own context. + * + * ``` + * <script> + * Observer(()=>{ + * // this is not subject + * }) + * + * Observer(function() { + * // this is subject + * }) + * </script> + * ``` + * + * additional arguments can be passed to the callback. to do this, simply specify them. + * + * ``` + * <script> + * Observer(function(a, b, c) { + * console.log(a, b, c); // ↦ "a", 2, true + * }, "a", 2, true) + * </script> + * ``` + * + * the callback function must have as many parameters as arguments are given. + * + * * @since 1.0.0 * @copyright schukai GmbH * @memberOf Monster/Types @@ -51968,6 +51543,11 @@ var Observer = /*#__PURE__*/function (_Monster$Types$Object) { var _super = _createSuper(Observer); + /** + * + * @param {function} callback + * @param {*} args + */ function Observer(callback) { var _this; @@ -51986,9 +51566,15 @@ var Observer = /*#__PURE__*/function (_Monster$Types$Object) { } _this.arguments = args; - _this.tags = new Set(); + _this.tags = new _tokenlist.TokenList(); return _this; } + /** + * + * @param {string} tag + * @returns {Observer} + */ + _createClass(Observer, [{ key: "addTag", @@ -51996,28 +51582,51 @@ var Observer = /*#__PURE__*/function (_Monster$Types$Object) { this.tags.add(tag); return this; } + /** + * + * @param {string} tag + * @returns {Observer} + */ + }, { key: "removeTag", value: function removeTag(tag) { - this.tags["delete"](tag); + this.tags.remove(tag); return this; } + /** + * + * @returns {Array} + */ + }, { key: "getTags", value: function getTags() { - return this.tags; + return this.tags.entries(); } + /** + * + * @param {string} tag + * @returns {boolean} + */ + }, { key: "hasTag", value: function hasTag(tag) { - return this.tags.has(tag); + return this.tags.contains(tag); } + /** + * + * @param {object} subject + * @returns {Promise} + */ + }, { key: "update", value: function update(subject) { var self = this; return new Promise(function (resolve, reject) { - if (!(subject instanceof Object)) { + if (!(0, _is.isObject)(subject)) { reject("subject must be an object"); } @@ -52034,7 +51643,7 @@ exports.Observer = Observer; _namespace.Monster.assignToNamespace('Monster.Types', Observer); -},{"../namespace.js":257,"../types/object.js":260}],262:[function(require,module,exports){ +},{"../namespace.js":258,"../types/is.js":260,"../types/object.js":261,"../types/tokenlist.js":265}],263:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -52084,7 +51693,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observerlist.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/observerlist.js'; * console.log(new Monster.Types.ObserverList()) * console.log(new Monster.Types.ObserverList()) * </script> @@ -52094,7 +51703,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/observerlist.js'; + * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/observerlist.js'; * console.log(ObserverList()) * console.log(ObserverList()) * </script> @@ -52193,7 +51802,697 @@ function checkIsObserver(observer) { _namespace.Monster.assignToNamespace('Monster.Types', ObserverList); -},{"../namespace.js":257,"../types/object.js":260}],263:[function(require,module,exports){ +},{"../namespace.js":258,"../types/object.js":261}],264:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); +exports.ProxyObserver = void 0; + +var _namespace = require("../namespace.js"); + +var _object = require("../types/object.js"); + +var _validate = require("./validate.js"); + +var _observerlist = require("./observerlist.js"); + +var _observer = require("./observer.js"); + +var _is = require("./is.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * store proxy objects + * + * @type {WeakSet<object>} + */ +var proxySet = new WeakSet(); +/** + * an observer manages a callback function + * + * you can call the method via the monster namespace `new Monster.Types.Observer()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/proxyobserver.js'; + * console.log(new Monster.Types.ProxyObserver()) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/proxyobserver.js'; + * console.log(new ProxyObserver()) + * </script> + * ``` + * + * @since 1.0.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ + +var ProxyObserver = /*#__PURE__*/function (_Object) { + _inherits(ProxyObserver, _Object); + + var _super = _createSuper(ProxyObserver); + + /** + * + * @param {object} object + */ + function ProxyObserver(object) { + var _this; + + _classCallCheck(this, ProxyObserver); + + _this = _super.call(this); + (0, _validate.validateObject)(object); + _this.realSubject = object; + _this.subject = new Proxy(object, getHandler.call(_assertThisInitialized(_this))); + proxySet.add(_this.subject); + _this.observers = new _observerlist.ObserverList(); + return _this; + } + /** + * get the real object + * + * changes to this object are not noticed by the observers, so you can make a large number of changes and inform the observers later. + * + * @returns {object} + */ + + + _createClass(ProxyObserver, [{ + key: "getSubject", + value: function getSubject() { + return this.subject; + } + /** + * get the proxied object + * + * @returns {object} + */ + + }, { + key: "getRealSubject", + value: function getRealSubject() { + return this.realSubject; + } + /** + * attach a new observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + + }, { + key: "attachObserver", + value: function attachObserver(observer) { + this.observers.attach(observer); + return this; + } + /** + * detach a observer + * + * @param {Observer} observer + * @returns {ProxyObserver} + */ + + }, { + key: "detachObserver", + value: function detachObserver(observer) { + this.observers.detach(observer); + return this; + } + /** + * notify all observer + * + * @returns {ProxyObserver} + */ + + }, { + key: "notifyObservers", + value: function notifyObservers() { + this.observers.notify(this); + return this; + } + /** + * @param {Observer} observer + * @returns {ProxyObserver} + */ + + }, { + key: "containsObserver", + value: function containsObserver(observer) { + return this.observers.contains(observer); + } + }]); + + return ProxyObserver; +}(Object); + +exports.ProxyObserver = ProxyObserver; + +_namespace.Monster.assignToNamespace('Monster.Types', ProxyObserver); + +/** + * + * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}} + * @private + * @see {@link https://gitlab.schukai.com/-/snippets/49} + */ +function getHandler() { + var proxy = this; // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots + + var handler = { + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + get: function get(target, property, receiver) { + var prop = target === null || target === void 0 ? void 0 : target[property]; // return if property not found + + if (prop === undefined) { + return undefined; + } // set value as proxy if object or array + + + if ((0, _is.isArray)(prop) || (0, _is.isObject)(prop) && !proxySet.has(prop)) { + target[property] = new Proxy(prop, handler); + proxySet.add(prop); + } + + return target[property]; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + set: function set(target, property, value, receiver) { + target[property] = value; + proxy.observers.notify(proxy); + return true; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + deleteProperty: function deleteProperty(target, property) { + if (property in target) { + delete target[property]; + proxy.observers.notify(proxy); + return true; + } + + return false; + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + defineProperty: function defineProperty(target, property, descriptor) { + var result = Reflect.defineProperty(target, property, descriptor); + proxy.observers.notify(proxy); + return parseURLToResultingURLRecord(); + }, + // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v + setPrototypeOf: function setPrototypeOf(target, prototype) { + var result = Reflect.setPrototypeOf(object1, prototype); + proxy.observers.notify(proxy); + return result; + } + }; + return handler; +} + +},{"../namespace.js":258,"../types/object.js":261,"./is.js":260,"./observer.js":262,"./observerlist.js":263,"./validate.js":266}],265:[function(require,module,exports){ +'use strict'; +/** + * @author schukai GmbH + */ + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Monster", { + enumerable: true, + get: function get() { + return _namespace.Monster; + } +}); +exports.TokenList = void 0; + +var _namespace = require("../namespace.js"); + +var _object = require("../types/object.js"); + +var _is = require("../types/is.js"); + +var _validate = require("../types/validate.js"); + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). + * + * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. + * + * you can call the method via the monster namespace `new Monster.Types.TokenList()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/tokenlist.js'; + * console.log(new Monster.Types.TokenList("myclass row")) + * console.log(new Monster.Types.TokenList("myclass row")) + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/tokenlist.js'; + * console.log(new TokenList("myclass row")) + * console.log(new TokenList("myclass row")) + * </script> + * ``` + * + * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * + * ``` + * console.log(typeof new TokenList("myclass row")[Symbol.iterator]); // "function" + * ``` + * + * + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + */ +var TokenList = /*#__PURE__*/function (_Object) { + _inherits(TokenList, _Object); + + var _super = _createSuper(TokenList); + + /** + * + * @param {array|string|iteratable} init + */ + function TokenList(init) { + var _this; + + _classCallCheck(this, TokenList); + + _this = _super.call(this); + _this.tokens = new Set(); + + if (typeof init !== "undefined") { + _this.add(init); + } + + return _this; + } + /** + * Iterator protocol + * + * @returns {Symbol.iterator} + */ + + + _createClass(TokenList, [{ + key: "getIterator", + value: function getIterator() { + return this[Symbol.iterator](); + } + /** + * Iterator + * + * @returns {{next: ((function(): ({value: *, done: boolean}))|*)}} + */ + + }, { + key: Symbol.iterator, + value: function value() { + // Use a new index for each iterator. This makes multiple + // iterations over the iterable safe for non-trivial cases, + // such as use of break or nested looping over the same iterable. + var index = 0; + var entries = this.entries(); + return { + next: function next() { + if (index < entries.length) { + return { + value: entries === null || entries === void 0 ? void 0 : entries[index++], + done: false + }; + } else { + return { + done: true + }; + } + } + }; + } + /** + * Returns true if it contains token, otherwise false + * + * ``` + * new TokenList("start middle end").contains('start')); // ↦ true + * new TokenList("start middle end").contains('end')); // ↦ true + * new TokenList("start middle end").contains('xyz')); // ↦ false + * new TokenList("start middle end").contains(['end','start','middle'])); // ↦ true + * new TokenList("start middle end").contains(['end','start','xyz'])); // ↦ false + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + */ + + }, { + key: "contains", + value: function contains(value) { + var _this2 = this; + + if ((0, _is.isString)(value)) { + value = value.trim(); + var counter = 0; + value.split(" ").forEach(function (token) { + if (_this2.tokens.has(token.trim()) === false) return false; + counter++; + }); + return counter > 0 ? true : false; + } + + if ((0, _is.isIterable)(value)) { + var _counter = 0; + + var _iterator = _createForOfIteratorHelper(value), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var token = _step.value; + (0, _validate.validateString)(token); + if (this.tokens.has(token.trim()) === false) return false; + _counter++; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return _counter > 0 ? true : false; + } + + return false; + } + /** + * add tokens + * + * ``` + * new TokenList().add("abc xyz").toString(); // ↦ "abc xyz" + * new TokenList().add(["abc","xyz"]).toString(); // ↦ "abc xyz" + * new TokenList().add(undefined); // ↦ add nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + + }, { + key: "add", + value: function add(value) { + var _this3 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + _this3.tokens.add(token.trim()); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator2 = _createForOfIteratorHelper(value), + _step2; + + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var token = _step2.value; + (0, _validate.validateString)(token); + this.tokens.add(token.trim()); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + /** + * remove all tokens + * + * @returns {TokenList} + */ + + }, { + key: "clear", + value: function clear() { + this.tokens.clear(); + return this; + } + /** + * Removes token + * + * ``` + * new TokenList("abc xyz").remove("xyz").toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(["xyz"]).toString(); // ↦ "abc" + * new TokenList("abc xyz").remove(undefined); // ↦ remove nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {TokenList} + * @throws {TypeError} unsupported value + */ + + }, { + key: "remove", + value: function remove(value) { + var _this4 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + _this4.tokens["delete"](token.trim()); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator3 = _createForOfIteratorHelper(value), + _step3; + + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var token = _step3.value; + (0, _validate.validateString)(token); + this.tokens["delete"](token.trim()); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + /** + * this method replaces a token with a new token. + * + * if the passed token exists, it is replaced with newToken and TokenList is returned. + * if the token does not exist, newToken is not set and TokenList is returned. + * + * @param {string} token + * @param {string} newToken + * @returns {TokenList} + */ + + }, { + key: "replace", + value: function replace(token, newToken) { + (0, _validate.validateString)(token); + (0, _validate.validateString)(newToken); + + if (!this.contains(token)) { + return this; + } + + var a = Array.from(this.tokens); + var i = a.indexOf(token); + if (i === -1) return this; + a.splice(i, 1, newToken); + this.tokens = new Set(); + this.add(a); + return this; + } + /** + * Removes token from string. If token doesn't exist it's added. + * + * ``` + * new TokenList("abc def ghi").toggle("def xyz").toString(); // ↦ "abc ghi xyz" + * new TokenList("abc def ghi").toggle(["abc","xyz"]).toString(); // ↦ "def ghi xyz" + * new TokenList().toggle(undefined); // ↦ nothing + * ``` + * + * @param {array|string|iteratable} value + * @returns {boolean} + * @throws {TypeError} unsupported value + */ + + }, { + key: "toggle", + value: function toggle(value) { + var _this5 = this; + + if ((0, _is.isString)(value)) { + value.split(" ").forEach(function (token) { + toggleValue.call(_this5, token); + }); + } else if ((0, _is.isIterable)(value)) { + var _iterator4 = _createForOfIteratorHelper(value), + _step4; + + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var token = _step4.value; + toggleValue.call(this, token); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } else if (typeof value !== "undefined") { + throw new TypeError("unsupported value"); + } + + return this; + } + /** + * returns an array with all tokens + * + * @returns {array} + */ + + }, { + key: "entries", + value: function entries() { + return Array.from(this.tokens); + } + /** + * executes the provided function with each value of the set + * + * @param {function} callback + * @returns {TokenList} + */ + + }, { + key: "forEach", + value: function forEach(callback) { + (0, _validate.validateFunction)(callback); + this.tokens.forEach(callback); + return this; + } + /** + * returns the individual tokens separated by a blank character + * + * @returns {string} + */ + + }, { + key: "toString", + value: function toString() { + return this.entries().join(' '); + } + }]); + + return TokenList; +}(Object); +/** + * @private + * @param token + * @returns {toggleValue} + * @throws {Error} must be called with TokenList.call + */ + + +exports.TokenList = TokenList; + +function toggleValue(token) { + if (!(this instanceof TokenList)) throw Error("must be called with TokenList.call"); + (0, _validate.validateString)(token); + token = token.trim(); + + if (this.contains(token)) { + this.remove(token); + return this; + } + + this.add(token); + return this; +} + +_namespace.Monster.assignToNamespace('Monster.Types', TokenList); + +},{"../namespace.js":258,"../types/is.js":260,"../types/object.js":261,"../types/validate.js":266}],266:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -52208,6 +52507,7 @@ exports.validateString = validateString; exports.validateObject = validateObject; exports.validateArray = validateArray; exports.validateFunction = validateFunction; +exports.validateIterable = validateIterable; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { @@ -52226,7 +52526,45 @@ var _is = require("../types/is.js"); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; + * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError + * console.log(Monster.Types.validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * Alternatively, you can also integrate this function individually. + * + * ``` + * <script type="module"> + * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; + * console.log(validateIterable('2')) // ↦ TypeError + * console.log(validateIterable([])) // ↦ undefined + * </script> + * ``` + * + * @param {*} value + * @return {undefined} + * @since 1.2.0 + * @copyright schukai GmbH + * @memberOf Monster/Types + * @throws {TypeError} value is not a primitive + * @see {@link isPrimitive} + * @see {@link Monster/Types/isPrimitive} + * @see {@link Monster/Types#isPrimitive} + */ +function validateIterable(value) { + if (!(0, _is.isIterable)(value)) { + throw new TypeError('value is not iterable'); + } +} +/** + * this method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. + * + * you can call the method via the monster namespace `Monster.Types.validatePrimitive()`. + * + * ``` + * <script type="module"> + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validatePrimitive('2')) // ↦ undefined * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError * </script> @@ -52236,7 +52574,7 @@ var _is = require("../types/is.js"); * * ``` * <script type="module"> - * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validatePrimitive('2')) // ↦ undefined * console.log(validatePrimitive([])) // ↦ TypeError * </script> @@ -52252,6 +52590,8 @@ var _is = require("../types/is.js"); * @see {@link Monster/Types/isPrimitive} * @see {@link Monster/Types#isPrimitive} */ + + function validatePrimitive(value) { if (!(0, _is.isPrimitive)(value)) { throw new TypeError('value is not a primitive'); @@ -52264,7 +52604,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validateBoolean(true)) // ↦ undefined * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError @@ -52275,7 +52615,7 @@ function validatePrimitive(value) { * * ``` * <script type="module"> - * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validateBoolean(false)) // ↦ undefined * console.log(validateBoolean('2')) // ↦ TypeError * console.log(validateBoolean([])) // ↦ TypeError @@ -52304,7 +52644,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validateString('2')) // ↦ undefined * console.log(Monster.Types.validateString([])) // ↦ TypeError * </script> @@ -52314,7 +52654,7 @@ function validateBoolean(value) { * * ``` * <script type="module"> - * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validateString('2')) // ↦ undefined * console.log(validateString([])) // ↦ TypeError * </script> @@ -52342,7 +52682,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validateObject({})) // ↦ undefined * console.log(Monster.Types.validateObject('2')) // ↦ TypeError * console.log(Monster.Types.validateObject([])) // ↦ TypeError @@ -52353,7 +52693,7 @@ function validateString(value) { * * ``` * <script type="module"> - * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validateObject({})) // ↦ undefined * console.log(validateObject('2')) // ↦ TypeError * console.log(validateObject([])) // ↦ TypeError @@ -52381,7 +52721,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validateArray('2')) // ↦ TypeError * console.log(Monster.Types.validateArray([])) // ↦ undefined * </script> @@ -52391,7 +52731,7 @@ function validateObject(value) { * * ``` * <script type="module"> - * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validateArray('2')) // ↦ TypeError * console.log(validateArray([])) // ↦ undefined * </script> @@ -52418,7 +52758,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(Monster.Types.validateFunction(()=>{})) // ↦ undefined * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError * console.log(Monster.Types.validateFunction([])) // ↦ TypeError @@ -52429,7 +52769,7 @@ function validateArray(value) { * * ``` * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/validate.js'; * console.log(validateFunction(()=>{})) // ↦ undefined * console.log(validateFunction('2')) // ↦ TypeError * console.log(validateFunction([])) // ↦ TypeError @@ -52451,9 +52791,9 @@ function validateFunction(value) { } } -_namespace.Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction); +_namespace.Monster.assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable); -},{"../namespace.js":257,"../types/is.js":259}],264:[function(require,module,exports){ +},{"../namespace.js":258,"../types/is.js":260}],267:[function(require,module,exports){ 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -52501,7 +52841,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/version.js'; * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 * </script> @@ -52511,7 +52851,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g * * ``` * <script type="module"> - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/version.js'; * console.log(new Version('1.2.3')) // ↦ 1.2.3 * console.log(new Version('1')) // ↦ 1.0.0 * </script> @@ -52654,7 +52994,7 @@ var monsterVersion; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/version.js'; * console.log(Monster.getVersion()) * console.log(Monster.getVersion()) * </script> @@ -52664,7 +53004,7 @@ var monsterVersion; * * ``` * <script type="module"> - * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/types/version.js'; + * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/version.js'; * console.log(getVersion()) * console.log(getVersion()) * </script> @@ -52684,7 +53024,7 @@ function getVersion() { /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.0.14'); + monsterVersion = new Version('1.2.1'); /**#@-*/ return monsterVersion; @@ -52692,7 +53032,7 @@ function getVersion() { _namespace.Monster.assignToNamespace('Monster', getVersion); -},{"../namespace.js":257,"../types/object.js":260}],265:[function(require,module,exports){ +},{"../namespace.js":258,"../types/object.js":261}],268:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -52728,7 +53068,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/util/clone.js'; + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/util/clone.js'; * console.log(Monster.Util.clone({})) * </script> * ``` @@ -52737,7 +53077,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi * * ``` * <script type="module"> - * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/util/clone.js'; + * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/util/clone.js'; * console.log(clone({})) * </script> * ``` @@ -52853,7 +53193,7 @@ function cloneObject(obj) { _namespace.Monster.assignToNamespace('Monster.Util', clone); -},{"../namespace.js":257,"../types/is.js":259}],266:[function(require,module,exports){ +},{"../namespace.js":258,"../types/is.js":260}],269:[function(require,module,exports){ 'use strict'; /** * @author schukai GmbH @@ -52862,35 +53202,48 @@ _namespace.Monster.assignToNamespace('Monster.Util', clone); Object.defineProperty(exports, "__esModule", { value: true }); -exports.deepFreeze = deepFreeze; Object.defineProperty(exports, "Monster", { enumerable: true, get: function get() { - return _namespace.Monster; + return _object.Monster; } }); +exports.Comparator = void 0; -var _namespace = require("../namespace.js"); +var _object = require("../types/object.js"); -var _validate = require("../types/validate.js"); +var _is = require("../types/is.js"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * deep freeze a object - * - * you can call the method via the monster namespace `Monster.Util.deepFreeze()`. + * the comparator allows a comparison function to be abstracted. * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/util/freeze.js'; - * console.log(Monster.Util.deepFreeze({})) + * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/id.js'; + * console.log(new Monster.Util.Comparator()) + * console.log(new Monster.Util.Comparator()) * </script> * ``` * @@ -52898,44 +53251,306 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len * * ``` * <script type="module"> - * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.0.14/dist/modules/util/freeze.js'; - * console.log(deepFreeze({})) + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.1/dist/modules/types/id.js'; + * console.log(new Util()) + * console.log(new Util()) * </script> * ``` + * + * the following are some examples of the application of the class. * - * @param {object} obj object to be freeze - * @since 1.0.0 - * @returns {object} + * ``` + * new Comparator().lessThanOrEqual(2, 5) // ↦ true + * new Comparator().greaterThan(4, 2) // ↦ true + * new Comparator().equal(4, 4) // ↦ true + * new Comparator().equal(4, 5) // ↦ false + * ``` + * + * you can also pass your own comparison function, and thus define the comparison function. + * + * ``` + * new Comparator(function (a, b) { + * if (a.v === b.v) return 0; + * return a.v < b.v ? -1 : 1; + * }).equal({v: 2}, {v: 2}); // ↦ true + * ``` + * + * @since 1.3.0 * @memberOf Monster/Util - * @copyright schukai GmbH - * @throws {TypeError} value is not a object */ -function deepFreeze(object) { - (0, _validate.validateObject)(object); // Retrieve the defined property names of the object +var Comparator = /*#__PURE__*/function (_Object) { + _inherits(Comparator, _Object); - var propNames = Object.getOwnPropertyNames(object); // Freeze properties before freezing yourself + var _super = _createSuper(Comparator); - var _iterator = _createForOfIteratorHelper(propNames), - _step; + /** + * create new comparator + * + * @param {function} callback + * @throw {TypeError} "unsupported type" + * @throw {TypeError} "impractical comparison" + */ + function Comparator(callback) { + var _this; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var name = _step.value; - var value = object[name]; - object[name] = value && _typeof(value) === "object" ? deepFreeze(value) : value; + _classCallCheck(this, Comparator); + + _this = _super.call(this); + + if ((0, _is.isFunction)(callback)) { + _this.compare = callback; + } else if (callback !== undefined) { + throw new TypeError("unsupported type"); + } else { + // default compare function + _this.compare = function (a, b) { + if (_typeof(a) !== _typeof(b)) { + throw new TypeError("impractical comparison"); + } + + if (a === b) { + return 0; + } + + return a < b ? -1 : 1; + }; } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + + return _this; } + /** + * changes the order of the operators + * + * @return {Comparator} + */ - return Object.freeze(object); -} -_namespace.Monster.assignToNamespace('Monster.Util', deepFreeze); + _createClass(Comparator, [{ + key: "reverse", + value: function reverse() { + var original = this.compare; + + this.compare = function (a, b) { + return original(b, a); + }; + + return this; + } + /** + * Checks if two variables are equal. + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "equal", + value: function equal(a, b) { + return this.compare(a, b) === 0; + } + /** + * Checks if variable `a` is greater than `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "greaterThan", + value: function greaterThan(a, b) { + return this.compare(a, b) > 0; + } + /** + * Checks if variable `a` is greater than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "greaterThanOrEqual", + value: function greaterThanOrEqual(a, b) { + return this.greaterThan(a, b) || this.equal(a, b); + } + /** + * Checks if variable `a` is less than or equal to `b` + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "lessThanOrEqual", + value: function lessThanOrEqual(a, b) { + return this.lessThan(a, b) || this.equal(a, b); + } + /** + * Checks if variable a is less than b + * + * @param {*} a + * @param {*} b + * + * @return {boolean} + */ + + }, { + key: "lessThan", + value: function lessThan(a, b) { + return this.compare(a, b) < 0; + } + }]); + + return Comparator; +}(Object); + +exports.Comparator = Comparator; -},{"../namespace.js":257,"../types/validate.js":263}],267:[function(require,module,exports){ +_object.Monster.assignToNamespace('Monster.Util', Comparator); + +},{"../types/is.js":260,"../types/object.js":261}],270:[function(require,module,exports){ +"use strict"; + +var _valid = require("../../../source/constraints/valid.js"); + +var _invalid = require("../../../source/constraints/invalid.js"); + +var _andoperator = require("../../../source/constraints/andoperator.js"); + +describe('AndOperator', function () { + describe('.isValid()', function () { + [[new _valid.Valid(), new _valid.Valid(), true], [new _valid.Valid(), new _invalid.Invalid(), false], [new _invalid.Invalid(), new _valid.Valid(), false], [new _invalid.Invalid(), new _invalid.Invalid(), false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + it('constraint.isValid() should return ' + c, function (done) { + var constraint = new _andoperator.AndOperator(a, b); + constraint.isValid().then(function () { + c === true ? done() : done(new Error()); + })["catch"](function () { + c === true ? done(new Error()) : done(); + }); + }); + }); + }); +}); + +},{"../../../source/constraints/andoperator.js":251,"../../../source/constraints/invalid.js":252,"../../../source/constraints/valid.js":256}],271:[function(require,module,exports){ +"use strict"; + +var _invalid = require("../../../source/constraints/invalid.js"); + +var _chai = require("chai"); + +describe('Invalid', function () { + describe('.isValid()', function () { + var isvalid = new _invalid.Invalid(); + it('should resolve promise', function (done) { + isvalid.isValid()["catch"](function (e) { + (0, _chai.expect)(e).to.be.undefined; + done(); + }); + }); + }); +}); + +},{"../../../source/constraints/invalid.js":252,"chai":84}],272:[function(require,module,exports){ +"use strict"; + +var _isarray = require("../../../source/constraints/isarray.js"); + +var _chai = require("chai"); + +describe('IsArray', function () { + describe('.isValid()', function () { + var constraint = new _isarray.IsArray(); + it('should resolve promise', function (done) { + constraint.isValid([1, 2, 3]).then(function (r) { + (0, _chai.expect)(r).is.a('array'); + done(); + })["catch"](function (e) { + done(new Error("should not reached: " + e)); + }); + }); + }); +}); + +},{"../../../source/constraints/isarray.js":253,"chai":84}],273:[function(require,module,exports){ +"use strict"; + +var _isobject = require("../../../source/constraints/isobject.js"); + +var _chai = require("chai"); + +describe('IsObject', function () { + describe('.isValid()', function () { + var constraint = new _isobject.IsObject(); + it('should resolve promise', function (done) { + constraint.isValid({}).then(function (r) { + (0, _chai.expect)(r).is.a('object'); + done(); + })["catch"](function (e) { + done(new Error("should not reached: " + e)); + }); + }); + }); +}); + +},{"../../../source/constraints/isobject.js":254,"chai":84}],274:[function(require,module,exports){ +"use strict"; + +var _valid = require("../../../source/constraints/valid.js"); + +var _invalid = require("../../../source/constraints/invalid.js"); + +var _oroperator = require("../../../source/constraints/oroperator.js"); + +describe('OrOperator', function () { + describe('.isValid()', function () { + [[new _valid.Valid(), new _valid.Valid(), true], [new _valid.Valid(), new _invalid.Invalid(), true], [new _invalid.Invalid(), new _valid.Valid(), true], [new _invalid.Invalid(), new _invalid.Invalid(), false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + it('constraint.isValid() should return ' + c, function (done) { + var constraint = new _oroperator.OrOperator(a, b); + constraint.isValid().then(function () { + c === true ? done() : done(new Error()); + })["catch"](function () { + c === true ? done(new Error()) : done(); + }); + }); + }); + }); +}); + +},{"../../../source/constraints/invalid.js":252,"../../../source/constraints/oroperator.js":255,"../../../source/constraints/valid.js":256}],275:[function(require,module,exports){ +"use strict"; + +var _valid = require("../../../source/constraints/valid.js"); + +var _chai = require("chai"); + +describe('Valid', function () { + describe('.isValid()', function () { + var constraint = new _valid.Valid(); + it('should resolve promise', function (done) { + constraint.isValid({}).then(function (r) { + done(); + })["catch"](function (e) { + done(new Error("should not reached: " + e)); + }); + }); + }); +}); + +},{"../../../source/constraints/valid.js":256,"chai":84}],276:[function(require,module,exports){ (function (global){(function (){ "use strict"; @@ -52945,7 +53560,7 @@ var _chai = require("chai"); var Crypto = _interopRequireWildcard(require("@peculiar/webcrypto")); -var _monster = require("../../../source/monster.js"); +var _random = require("../../../source/math/random.js"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -52961,9 +53576,7 @@ describe('Math', function () { [[1, 100], [500, 600], [100, 1000]].forEach(function (data) { var a = data.shift(); var b = data.shift(); - - var r = _monster.Monster.Math.random(a, b); - + var r = (0, _random.random)(a, b); it(r + ' should return value between ' + a + ' ' + b, function () { (0, _chai.expect)(r >= a).to.be["true"]; (0, _chai.expect)(r <= b).to.be["true"]; @@ -52976,7 +53589,7 @@ describe('Math', function () { var rounds = 500; for (var i = 0, max = rounds; i < max; i++) { - sum += _monster.Monster.Math.random(a, b); + sum += (0, _random.random)(a, b); } var avg = sum / rounds; @@ -52989,175 +53602,173 @@ describe('Math', function () { }); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../../../source/monster.js":256,"@peculiar/webcrypto":18,"chai":89}],268:[function(require,module,exports){ +},{"../../../source/math/random.js":257,"@peculiar/webcrypto":18,"chai":84}],277:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var assert = _interopRequireWildcard(require("assert")); - -var _monster = require("../../source/monster.js"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _chai = require("chai"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _version = require("../../source/types/version.js"); describe('Monster', function () { describe('.getVersion()', function () { var monsterVersion; - var Version = _monster.Monster.Types.Version; /**#@+ dont touch, replaced by make with package.json version */ - monsterVersion = new Version('1.0.14'); + monsterVersion = new _version.Version('1.2.1'); /**#@-*/ - var m = _monster.Monster.getVersion(); + var m = _version.Monster.getVersion(); it('should ' + monsterVersion + ' is ' + m, function () { - assert.equal(m.compareTo(monsterVersion), 0); + (0, _chai.expect)(m.compareTo(monsterVersion)).is.equal(0); }); }); }); -},{"../../source/monster.js":256,"assert":35}],269:[function(require,module,exports){ +},{"../../source/types/version.js":267,"chai":84}],278:[function(require,module,exports){ +(function (global){(function (){ "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var assert = _interopRequireWildcard(require("assert")); +var _id = require("../../../source/types/id.js"); -var btoa = _interopRequireWildcard(require("btoa")); +var _chai = require("chai"); -var _monster = require("../../../source/monster.js"); +var Crypto = _interopRequireWildcard(require("@peculiar/webcrypto")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +if (!global['crypto']) { + global['crypto'] = new Crypto.Crypto(); +} + describe('ID', function () { describe('.toString()', function () { - var id = new _monster.Monster.Types.ID(); + var id = new _id.ID(); var result = id.toString(); it('should return a string', function () { - assert.ok(typeof result === 'string'); + (0, _chai.expect)(result).is.a('string'); }); }); }); -},{"../../../source/monster.js":256,"assert":35,"btoa":86}],270:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../../../source/types/id.js":259,"@peculiar/webcrypto":18,"chai":84}],279:[function(require,module,exports){ "use strict"; -var assert = _interopRequireWildcard(require("assert")); - -var _monster = require("../../../source/monster.js"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _is = require("../../../source/types/is.js"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _chai = require("chai"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } describe('Is', function () { describe('.isPrimitive()', function () { - [['test1', true], [undefined, true], [null, true], [function () {}, false], [2, true], [false, true], [true, true], [4.5, true], [{}, false], [[1, 2, 3], false], [Symbol("foo"), true]].forEach(function (data) { + [['test1', true], [undefined, true], [null, true], [function () {}, false], [2, true], [parseInt("a"), true], [false, true], [true, true], [4.5, true], [{}, false], [[1, 2, 3], false], [Symbol("foo"), true]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isPrimitive(' + _typeof(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isPrimitive(a), b); + (0, _chai.expect)((0, _is.isPrimitive)(a)).is.equal(b); + }); + }); + }); + describe('.isIterable()', function () { + [['test1', true], [undefined, false], [null, false], [function () {}, false], [parseInt("a"), false], [2, false], [false, false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], true], [Symbol("foo"), false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + it('is.isIterable(' + _typeof(a) + ') should return ' + b, function () { + (0, _chai.expect)((0, _is.isIterable)(a)).is.equal(b); }); }); }); describe('.isBoolean()', function () { - [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, true], [true, true], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { + [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, true], [parseInt("a"), false], [true, true], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isBoolean(' + _typeof(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isBoolean(a), b); + (0, _chai.expect)((0, _is.isBoolean)(a)).is.equal(b); }); }); }); describe('.isString()', function () { - [['test1', true], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { + [['test1', true], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [parseInt("a"), false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isString(' + _typeof(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isString(a), b); + (0, _chai.expect)((0, _is.isString)(a)).is.equal(b); }); }); }); describe('.isObject()', function () { - [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [true, false], [4.5, false], [{}, true], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { + [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [parseInt("a"), false], [true, false], [4.5, false], [{}, true], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isObject(' + JSON.stringify(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isObject(a), b); + (0, _chai.expect)((0, _is.isObject)(a)).is.equal(b); }); }); }); describe('.isArray()', function () { - [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], true], [Symbol("foo"), false]].forEach(function (data) { + [['test1', false], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [parseInt("a"), false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], true], [Symbol("foo"), false]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isArray(' + _typeof(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isArray(a), b); + (0, _chai.expect)((0, _is.isArray)(a)).is.equal(b); }); }); }); describe('.isFunction()', function () { - [['test1', false], [undefined, false], [null, false], [function () {}, true], [2, false], [false, false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { + [['test1', false], [undefined, false], [null, false], [function () {}, true], [2, false], [false, false], [parseInt("a"), false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], false], [Symbol("foo"), false]].forEach(function (data) { var a = data.shift(); var b = data.shift(); it('is.isFunction(' + _typeof(a) + ') should return ' + b, function () { - assert.equal(_monster.Monster.Types.isFunction(a), b); + (0, _chai.expect)((0, _is.isFunction)(a)).is.equal(b); }); }); }); }); -},{"../../../source/monster.js":256,"assert":35}],271:[function(require,module,exports){ +},{"../../../source/types/is.js":260,"chai":84}],280:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var assert = _interopRequireWildcard(require("assert")); - -var _monster = require("../../../source/monster.js"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _chai = require("chai"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _observer = require("../../../source/types/observer.js"); describe('Observer', function () { var callback = function callback() {}; - var observer = new _monster.Monster.Types.Observer(callback); + var observer = new _observer.Observer(callback); describe('.addTag()', function () { [['test1'], ['test2']].forEach(function (data) { var a = data.shift(); - it('addTag(' + a + ') should return instanceof Monster.Types.Observer', function () { - assert.ok(observer.addTag(a) instanceof _monster.Monster.Types.Observer); + it('addTag(' + a + ') should return instanceof Observer', function () { + (0, _chai.expect)(observer.addTag(a)).is.instanceOf(_observer.Observer); }); }); }); describe('.removeTag()', function () { [['test1'], ['test2']].forEach(function (data) { var a = data.shift(); - it('removeTag(' + a + ') should return instanceof Monster.Types.Observer', function () { - assert.ok(observer.removeTag(a) instanceof _monster.Monster.Types.Observer); + it('removeTag(' + a + ') should return instanceof Observer', function () { + (0, _chai.expect)(observer.removeTag(a)).is.instanceOf(_observer.Observer); }); }); }); describe('.hasTag()', function () { [['test1', true], ['test2', true], ['test3', false], ['test4', false]].forEach(function (data) { - var tempObserver = new _monster.Monster.Types.Observer(callback); + var tempObserver = new _observer.Observer(callback); var a = data.shift(); var b = data.shift(); it('observer.hastTag(' + a + ') should return ' + b, function () { if (b === true) { tempObserver.addTag(a); - assert.ok(tempObserver.hasTag(a)); + (0, _chai.expect)(tempObserver.hasTag(a)).is.be["true"]; } else { - assert.ok(!tempObserver.hasTag(a)); + (0, _chai.expect)(tempObserver.hasTag(a)).is.be["false"]; } }); }); @@ -53165,11 +53776,11 @@ describe('Observer', function () { describe('.update()', function () { var obj = {}; it('observer.update(' + obj + ') is ' + 1 + 3 + 6, function (done) { - var tempObserver = new _monster.Monster.Types.Observer(function (a, b, c) { + var tempObserver = new _observer.Observer(function (a, b, c) { return a + b + c; }, 1, 3, 6); tempObserver.update(obj).then(function (a) { - assert.equal(a, 1 + 3 + 6); + (0, _chai.expect)(a).is.equal(1 + 3 + 6); done(); }); }); @@ -53178,7 +53789,7 @@ describe('Observer', function () { [[['test1', 'test2', 'test3', 'test4'], 4], [['test1', 'test1', 'test3', 'test4'], 3], // double test1 (set is uniqueue) [['test1', 'test1', 'test1', 'test4'], 2] // multiple test1 (set is uniqueue) ].forEach(function (data) { - var tempObserver = new _monster.Monster.Types.Observer(callback); + var tempObserver = new _observer.Observer(callback); var a = data.shift(); var b = data.shift(); @@ -53186,58 +53797,54 @@ describe('Observer', function () { tempObserver.addTag(a[i]); } - it('observer.getTags(' + a + ') is instanceof Set', function () { - assert.ok(tempObserver.getTags() instanceof Set); + it('observer.getTags(' + a + ') is array', function () { + (0, _chai.expect)(tempObserver.getTags()).to.be.an('array'); }); it('observer.getTags(' + a + ') should return ' + b + " tags", function () { - assert.equal(tempObserver.getTags().size, b); + (0, _chai.expect)(tempObserver.getTags().length).is.equal(b); }); }); }); }); -},{"../../../source/monster.js":256,"assert":35}],272:[function(require,module,exports){ +},{"../../../source/types/observer.js":262,"chai":84}],281:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var assert = _interopRequireWildcard(require("assert")); +var _observerlist = require("../../../source/types/observerlist.js"); -var _monster = require("../../../source/monster.js"); +var _observer = require("../../../source/types/observer.js"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _chai = require("chai"); describe('ObserverList', function () { describe('.attach()', function () { - it('should return instanceof Monster.Types.ObserverList', function () { - var observerList = new _monster.Monster.Types.ObserverList(); - var result = observerList.attach(new _monster.Monster.Types.Observer(function () {})); - assert.ok(result instanceof _monster.Monster.Types.ObserverList); + it('should return instanceof ObserverList', function () { + var observerList = new _observerlist.ObserverList(); + var result = observerList.attach(new _observer.Observer(function () {})); + (0, _chai.expect)(result).to.be.instanceOf(_observerlist.ObserverList); }); }); describe('.detach()', function () { - it('should return instanceof Monster.Types.ObserverList', function () { - var observerList = new _monster.Monster.Types.ObserverList(); - var result = observerList.detach(new _monster.Monster.Types.Observer(function () {})); - assert.ok(result instanceof _monster.Monster.Types.ObserverList); + it('should return instanceof ObserverList', function () { + var observerList = new _observerlist.ObserverList(); + var result = observerList.detach(new _observer.Observer(function () {})); + (0, _chai.expect)(result).to.be.instanceOf(_observerlist.ObserverList); }); }); describe('.notify()', function () { var resultValue = "Yes!"; - var o = new _monster.Monster.Types.Observer(function () { + var o = new _observer.Observer(function () { return resultValue; }); - var observerList = new _monster.Monster.Types.ObserverList(); + var observerList = new _observerlist.ObserverList(); observerList.attach(o); it('should instanceof Promise', function () { - assert.ok(observerList.notify() instanceof Promise); + (0, _chai.expect)(observerList.notify()).to.be.instanceOf(Promise); }); it('should return ' + resultValue, function (done) { var obj = {}; observerList.notify(obj).then(function (r) { - assert.equal(r, resultValue); + (0, _chai.expect)(r).to.be.an('array').that.includes(resultValue); done(); })["catch"](function (e) { done(new Error(e)); @@ -53245,44 +53852,289 @@ describe('ObserverList', function () { }); }); describe('.contains()', function () { - var o1 = new _monster.Monster.Types.Observer(function () {}); - var o2 = new _monster.Monster.Types.Observer(function () {}); + var o1 = new _observer.Observer(function () {}); + var o2 = new _observer.Observer(function () {}); it('should not contain o1 and o2', function () { - var observerList = new _monster.Monster.Types.ObserverList(); - assert.ok(!observerList.contains(o1)); - assert.ok(!observerList.contains(o2)); + var observerList = new _observerlist.ObserverList(); + (0, _chai.expect)(observerList.contains(o1)).to.be["false"]; + (0, _chai.expect)(observerList.contains(o2)).to.be["false"]; }); it('should contain o2 and not o1', function () { - var observerList = new _monster.Monster.Types.ObserverList(); + var observerList = new _observerlist.ObserverList(); observerList.attach(o2); - assert.ok(!observerList.contains(o1)); - assert.ok(observerList.contains(o2)); + (0, _chai.expect)(observerList.contains(o1)).to.be["false"]; + (0, _chai.expect)(observerList.contains(o2)).to.be["true"]; }); it('should contain o1 and not o2', function () { - var observerList = new _monster.Monster.Types.ObserverList(); + var observerList = new _observerlist.ObserverList(); observerList.attach(o1); - assert.ok(observerList.contains(o1)); - assert.ok(!observerList.contains(o2)); + (0, _chai.expect)(observerList.contains(o1)).to.be["true"]; + (0, _chai.expect)(observerList.contains(o2)).to.be["false"]; }); it('should contain o2 and o1', function () { - var observerList = new _monster.Monster.Types.ObserverList(); + var observerList = new _observerlist.ObserverList(); observerList.attach(o2).attach(o1); - assert.ok(observerList.contains(o1)); - assert.ok(observerList.contains(o2)); + (0, _chai.expect)(observerList.contains(o1)).to.be["true"]; + (0, _chai.expect)(observerList.contains(o2)).to.be["true"]; }); }); }); -},{"../../../source/monster.js":256,"assert":35}],273:[function(require,module,exports){ +},{"../../../source/types/observer.js":262,"../../../source/types/observerlist.js":263,"chai":84}],282:[function(require,module,exports){ "use strict"; -var assert = _interopRequireWildcard(require("assert")); +var _chai = require("chai"); -var _monster = require("../../../source/monster.js"); +var _proxyobserver = require("../../../source/types/proxyobserver.js"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _observer = require("../../../source/types/observer.js"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _is = require("../../../source/types/is.js"); + +describe('ProxyObserver', function () { + describe('create', function () { + it('should return instanceof ProxyObserver', function () { + var o = new _proxyobserver.ProxyObserver({}); + (0, _chai.expect)(o).is.instanceOf(_proxyobserver.ProxyObserver); + }); + }); + describe('notify observer', function () { + it('should inform observer', function (done) { + var o = new _observer.Observer(function (a) { + if ((0, _is.isObject)(this) && this instanceof _proxyobserver.ProxyObserver) { + return done(); + } + + done(new Error("this is not ProxyObserver")); + }, true); + var realSubject = { + a: { + b: { + c: true + }, + d: 5 + } + }; + var p = new _proxyobserver.ProxyObserver(realSubject); + (0, _chai.expect)(p).is.instanceOf(_proxyobserver.ProxyObserver); + (0, _chai.expect)(p.attachObserver(o)).is.instanceOf(_proxyobserver.ProxyObserver); + var s = p.getSubject(); + s.a.b.c = false; + }); + }); +}); + +},{"../../../source/types/is.js":260,"../../../source/types/observer.js":262,"../../../source/types/proxyobserver.js":264,"chai":84}],283:[function(require,module,exports){ +"use strict"; + +var _chai = require("chai"); + +var _tokenlist = require("../../../source/types/tokenlist.js"); + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +describe('TokenList', function () { + describe('.toString()', function () { + var tokenList = new _tokenlist.TokenList(); + var result = tokenList.toString(); + it('should return a string', function () { + (0, _chai.expect)(result).to.be.a('string'); + }); + it('set and remove return a string', function () { + (0, _chai.expect)(result).to.be.a('string'); + }); + }); + describe('init with string iterable', function () { + it('new TokenList(' + (typeof a === "undefined" ? "undefined" : _typeof(a)) + ') throw TypeError ', function () { + var tokens = ["abc", "def", "ghi"]; + var list = new _tokenlist.TokenList(tokens); + (0, _chai.expect)(list.toString()).is.equal("abc def ghi"); + }); + }); + describe('init with iterable without string values', function () { + it('new TokenList(' + (typeof a === "undefined" ? "undefined" : _typeof(a)) + ') throw TypeError ', function () { + var tokens = ["abc", 4, "ghi"]; + (0, _chai.expect)(function () { + return new _tokenlist.TokenList(tokens); + }).to["throw"](TypeError); + }); + }); + describe('init values', function () { + [// current, expected, typerror + ['test1', "test1", false], ['test1 test2', "test1 test2", false], [undefined, "", false], [null, undefined, true], [parseInt("a"), undefined, true], // NaN + [function () {}, undefined, true], [2, undefined, true], [false, undefined, true], [true, undefined, true], [4.5, undefined, true], [{}, undefined, true], [["1", "2", "3"], '1 2 3', false], // iterable strings + [[1, 2, 3], undefined, true], [Symbol("foo"), false, true]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + + if (c === true) { + it('new TokenList(' + _typeof(a) + ') throw TypeError ', function () { + (0, _chai.expect)(function () { + return new _tokenlist.TokenList(a); + }).to["throw"](TypeError); + }); + } else { + it('new TokenList(' + _typeof(a) + ') should return ' + b, function () { + (0, _chai.expect)(new _tokenlist.TokenList(a).toString()).is.equal(b); + }); + } + }); + }); + describe('iterator protocol', function () { + var list; + it('.add(' + "second" + ') should return TokenList', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.getIterator()).to.be.an('object'); + }); + it('.add(' + "second" + ') should return TokenList', function () { + list = new _tokenlist.TokenList("start end"); + (0, _chai.expect)(_toConsumableArray(list)).to.be.an('array'); + (0, _chai.expect)(_toConsumableArray(list)).to.be.an('array').to.include('start').to.include('end'); + }); + }); + describe('.entries()', function () { + var list; + it('.entries() should return Array', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.entries()).to.be.an('array'); + }); + it('.entries() should return Array', function () { + list = new _tokenlist.TokenList("start end").entries(); + (0, _chai.expect)(list).to.be.an('array').to.include('start').to.include('end'); + }); + }); + describe('.forEach()', function () { + var list; + it('.forEach() should iterate over tokenlist', function () { + list = new _tokenlist.TokenList("aaa bbb ccc ddd eee fff"); + var result = ""; + list.forEach(function (a) { + result += "!" + a + "!"; + (0, _chai.expect)(a).to.be.an('string'); + }); + (0, _chai.expect)(result).is.equal("!aaa!!bbb!!ccc!!ddd!!eee!!fff!"); + }); + it('.entries() should return Array', function () { + list = new _tokenlist.TokenList("start end").entries(); + (0, _chai.expect)(list).to.be.an('array').to.include('start').to.include('end'); + }); + }); + describe('contains values', function () { + var list; + it('new TokenList(start, middle end) should contain middle', function () { + list = new _tokenlist.TokenList("start middle end"); + (0, _chai.expect)(list.contains('start')).to.be["true"]; + (0, _chai.expect)(list.contains('middle')).to.be["true"]; + (0, _chai.expect)(list.contains('end')).to.be["true"]; + (0, _chai.expect)(list.contains(['end', 'start', 'middle'])).to.be["true"]; + }); + it('new TokenList(start, middle end) should not contain xyz', function () { + list = new _tokenlist.TokenList("start middle end"); + (0, _chai.expect)(list.contains('xyz')).to.be["false"]; + (0, _chai.expect)(list.contains(['end', 'start', 'middle', 'xyz'])).to.be["false"]; + }); + it('new TokenList(start, middle end) should not contain undefined null NaN', function () { + list = new _tokenlist.TokenList("start middle end"); + (0, _chai.expect)(list.contains(undefined)).to.be["false"]; + (0, _chai.expect)(list.contains(parseInt("a"))).to.be["false"]; // NaN + + (0, _chai.expect)(list.contains(null)).to.be["false"]; // NaN + }); + }); + describe('toggle values', function () { + var list; + it('new TokenList(start middle end).toggle(new-value) should contain new-value', function () { + list = new _tokenlist.TokenList("start middle end"); + (0, _chai.expect)(list.toggle('new-value').toString()).is.equal("start middle end new-value"); + }); + it('new TokenList(start middle end).toggle(middle) should not contain middle', function () { + list = new _tokenlist.TokenList("start middle end"); + (0, _chai.expect)(list.toggle('middle').toString()).is.equal("start end"); + }); + it('new TokenList().toggle() should ...', function () { + (0, _chai.expect)(new _tokenlist.TokenList("abc def ghi").toggle("def xyz").toString()).to.equal("abc ghi xyz"); + }); + it('new TokenList().toggle() should ...', function () { + (0, _chai.expect)(new _tokenlist.TokenList("abc def ghi").toggle(["abc", "xyz"]).toString()).to.equal("def ghi xyz"); + }); + it('new TokenList().toggle() should ...', function () { + (0, _chai.expect)(new _tokenlist.TokenList("abc def ghi").toggle(undefined).toString()).to.equal("abc def ghi"); + }); + }); + describe('manipulate values', function () { + var list; + it('result TokenList("' + "start" + '") should be "' + "start" + '"', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.toString()).is.equal("start"); + }); + it('.add(' + "second" + ') should return TokenList', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.add("second")).to.be.an["instanceof"](_tokenlist.TokenList); + }); + it('.add(' + "second" + ').toString() should return "start second" ', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.add("second").toString()).is.equal("start second"); + }); + it('.add(' + "second third" + ').toString() should return "start second third" ', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.add("second third").toString()).is.equal("start second third"); + }); + it('.add(' + "[second,third]" + ').toString() should return "start second third" ', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.add(["second", "third"]).toString()).is.equal("start second third"); + }); + it('.clear().toString() should "" ', function () { + list = new _tokenlist.TokenList("start"); + (0, _chai.expect)(list.add(["second", "third"]).clear().toString()).is.equal(""); + }); + it('new TokenList("start second third end").remove(' + "second" + ') should return TokenList', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.remove("second")).to.be.an["instanceof"](_tokenlist.TokenList); + }); + it('new TokenList("start second third end").remove(' + "second" + ').toString() should return "start third end" ', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.remove("second").toString()).is.equal("start third end"); + }); + it('new TokenList("start second third end").remove(' + "second third" + ').toString() should return "start end" ', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.remove("second third").toString()).is.equal("start end"); + }); + it('new TokenList("start second third end").remove(' + "[second,third]" + ').toString() should return "start end" ', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.remove(["second", "third"]).toString()).is.equal("start end"); + }); + it('new TokenList("start second third end").replace(second, xyz).toString() should return "start xyz third end" ', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.replace("second", "xyz")).to.be.instanceOf(_tokenlist.TokenList); + (0, _chai.expect)(list.toString()).is.equal("start xyz third end"); + }); + it('new TokenList("start second third end").replace(end, xyz).toString() should return "start second third xyz" ', function () { + list = new _tokenlist.TokenList("start second third end"); + (0, _chai.expect)(list.replace("end", "xyz")).to.be.instanceOf(_tokenlist.TokenList); + (0, _chai.expect)(list.toString()).is.equal("start second third xyz"); + }); + }); +}); + +},{"../../../source/types/tokenlist.js":265,"chai":84}],284:[function(require,module,exports){ +"use strict"; + +var _validate = require("../../../source/types/validate.js"); + +var _chai = require("chai"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -53294,13 +54146,32 @@ describe('validate', function () { if (b === false) { it('.validatePrimitive(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validatePrimitive(a); - }); + (0, _chai.expect)(function () { + return (0, _validate.validatePrimitive)(a); + }).to["throw"](TypeError); }); } else { it('.validatePrimitive(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validatePrimitive(a) || true); + (0, _chai.expect)((0, _validate.validatePrimitive)(a)).to.be.undefined; + }); + } + }); + }); + describe('.validateIterable()', function () { + [['test1', true], [undefined, false], [null, false], [function () {}, false], [2, false], [false, false], [true, false], [4.5, false], [{}, false], [[1, 2, 3], true], [Symbol("foo"), false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + + if (b === false) { + it('.validateIterable(' + _typeof(a) + ') should throw TypeException ' + b, function () { + (0, _chai.expect)(function () { + (0, _validate.validateIterable)(a); + }).to["throw"](TypeError); + ; + }); + } else { + it('.validateIterable(' + _typeof(a) + ') should not throw TypeException ' + b, function () { + (0, _chai.expect)((0, _validate.validateIterable)(a)).to.be.undefined; }); } }); @@ -53312,13 +54183,13 @@ describe('validate', function () { if (b === false) { it('.validateBoolean(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validateBoolean(a); - }); + (0, _chai.expect)(function () { + (0, _validate.validateBoolean)(a); + }).to["throw"](TypeError); }); } else { it('.validateBoolean(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validateBoolean(a) || true); + (0, _chai.expect)((0, _validate.validateBoolean)(a)).to.be.undefined; }); } }); @@ -53330,13 +54201,14 @@ describe('validate', function () { if (b === false) { it('.validateString(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validateString(a); - }); + (0, _chai.expect)(function () { + (0, _validate.validateString)(a); + }).to["throw"](TypeError); + ; }); } else { it('.validateString(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validateString(a) || true); + (0, _chai.expect)((0, _validate.validateString)(a)).to.be.undefined; }); } }); @@ -53348,13 +54220,14 @@ describe('validate', function () { if (b === false) { it('.validateObject(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validateObject(a); - }); + (0, _chai.expect)(function () { + (0, _validate.validateObject)(a); + }).to["throw"](TypeError); + ; }); } else { it('.validateObject(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validateObject(a) || true); + (0, _chai.expect)((0, _validate.validateObject)(a)).to.be.undefined; }); } }); @@ -53366,13 +54239,14 @@ describe('validate', function () { if (b === false) { it('.validateArray(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validateArray(a); - }); + (0, _chai.expect)(function () { + (0, _validate.validateArray)(a); + }).to["throw"](TypeError); + ; }); } else { it('.validateArray(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validateArray(a) || true); + (0, _chai.expect)((0, _validate.validateArray)(a)).to.be.undefined; }); } }); @@ -53384,31 +54258,26 @@ describe('validate', function () { if (b === false) { it('.validateFunction(' + _typeof(a) + ') should throw TypeException ' + b, function () { - assert["throws"](function () { - _monster.Monster.Types.validateFunction(a); - }); + (0, _chai.expect)(function () { + (0, _validate.validateFunction)(a); + }).to["throw"](TypeError); + ; }); } else { it('.validateFunction(' + _typeof(a) + ') should not throw TypeException ' + b, function () { - assert.ok(_monster.Monster.Types.validateFunction(a) || true); + (0, _chai.expect)((0, _validate.validateFunction)(a)).to.be.undefined; }); } }); }); }); -},{"../../../source/monster.js":256,"assert":35}],274:[function(require,module,exports){ +},{"../../../source/types/validate.js":266,"chai":84}],285:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var assert = _interopRequireWildcard(require("assert")); +var _version = require("../../../source/types/version.js"); -var _monster = require("../../../source/monster.js"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _chai = require("chai"); describe('Version', function () { describe('.compareTo()', function () { @@ -53417,7 +54286,7 @@ describe('Version', function () { var b = data.shift(); var c = data.shift(); it('should return ' + c + ' when the value ' + a + ' is ' + b + '', function () { - assert.equal(new _monster.Monster.Types.Version(a).compareTo(b), c); + (0, _chai.expect)(new _version.Version(a).compareTo(b)).to.be.equal(c); }); }); }); @@ -53428,25 +54297,19 @@ describe('Version', function () { var c = data.shift(); var d = data.shift(); it('should return ' + d, function () { - assert.equal(new _monster.Monster.Types.Version(a, b, c).toString(), d); + (0, _chai.expect)(new _version.Version(a, b, c).toString()).to.be.equal(d); }); }); }); }); -},{"../../../source/monster.js":256,"assert":35}],275:[function(require,module,exports){ +},{"../../../source/types/version.js":267,"chai":84}],286:[function(require,module,exports){ "use strict"; -var assert = _interopRequireWildcard(require("assert")); - var _clone = require("../../../source/util/clone.js"); var _chai = require("chai"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -53512,24 +54375,24 @@ describe('Clone', function () { it('.clone(undefined) should undefined', function () { var a = undefined; var b = (0, _clone.clone)(a); - assert.ok(a === b); - assert.ok(typeof b === 'undefined'); - assert.ok(a === undefined); - assert.ok(b === undefined); + (0, _chai.expect)(a === b).to.be["true"]; + (0, _chai.expect)(typeof b === 'undefined').to.be["true"]; + (0, _chai.expect)(a === undefined).to.be["true"]; + (0, _chai.expect)(b === undefined).to.be["true"]; }); }); describe('.clone(object)', function () { it('.clone({}) should object', function () { var a = {}; var b = (0, _clone.clone)(a); - assert.ok(_typeof(b) === 'object'); + (0, _chai.expect)(_typeof(b) === 'object').to.be["true"]; }); it('.clone({x:1}) should object', function () { var a = { x: 1 }; var b = (0, _clone.clone)(a); - assert.equal(a.x, b.x); + (0, _chai.expect)(a.x).is.equal(b.x); }); }); describe('.clone(function)', function () { @@ -53537,7 +54400,7 @@ describe('Clone', function () { var a = function a() {}; var b = (0, _clone.clone)(a); - assert.ok(typeof b === 'function'); + (0, _chai.expect)(typeof b === 'function').to.be["true"]; }); }); describe('.clone()', function () { @@ -53548,13 +54411,130 @@ describe('Clone', function () { var b = data.shift(); it('.clone(' + JSON.stringify(a) + ') should ' + b + ' ', function () { var c = (0, _clone.clone)(a); - assert.equal(_typeof(c), b); + (0, _chai.expect)(_typeof(c)).is.equal(b); }); }); }); }); -},{"../../../source/util/clone.js":265,"assert":35,"chai":89}],276:[function(require,module,exports){ +},{"../../../source/util/clone.js":268,"chai":84}],287:[function(require,module,exports){ +"use strict"; + +var _chai = require("chai"); + +var _comparator = require("../../../source/util/comparator.js"); + +describe('Comparator', function () { + describe('create new instance', function () { + it('should return a comparator object', function () { + (0, _chai.expect)(new _comparator.Comparator()).to.be.a('object'); + }); + it('should return a comparator object', function () { + (0, _chai.expect)(new _comparator.Comparator(function () {})).to.be.a('object'); + }); + it('should throw TypeError', function () { + (0, _chai.expect)(function () { + return new _comparator.Comparator(true); + }).to["throw"](TypeError); + }); + it('should throw TypeError', function () { + (0, _chai.expect)(function () { + return new _comparator.Comparator("test"); + }).to["throw"](TypeError); + }); + }); + describe('equal()', function () { + [['test1', "test", false], [5.1, 5, false], [5.1, 5.1, true], [true, true, true], [false, true, false], [false, false, true], [-4, -4, true]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().equal(a, b)).is.equal(c); + }); + }); + }); + describe('equal()', function () { + [['test1', true], ['test1', 5], ['test1', null], ['test1', parseInt("a")], [false, 5], [undefined, null]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + it('should compare ' + a + ' and ' + b + ' throw TypeError', function () { + (0, _chai.expect)(function () { + return new _comparator.Comparator().equal(a, b); + }).to["throw"](TypeError); + }); + }); + }); + describe('greaterThan()', function () { + [['test1', "test", true], [5.1, 5, true], [5.1, 5.1, false], [true, true, false], [false, true, false], [false, false, false], [-4, -4, false], [-4, 4, false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().greaterThan(a, b)).is.equal(c); + }); + }); + }); + describe('reverse().greaterThan()', function () { + [['test1', "test", true], [5.1, 5, true], [5.1, 5.1, false], [true, true, false], [false, true, false], [false, false, false], [-4, -4, false], [-4, 4, false]].forEach(function (data) { + var b = data.shift(); + var a = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().reverse().greaterThan(a, b)).is.equal(c); + }); + }); + }); + describe('greaterThanOrEqual()', function () { + [['test1', "test", true], [5.1, 5, true], [5.1, 5.1, true], [true, true, true], [false, true, false], [false, false, true], [-4, -4, true], [-4, 4, false]].forEach(function (data) { + var a = data.shift(); + var b = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().greaterThanOrEqual(a, b)).is.equal(c); + }); + }); + }); + describe('lessThan()', function () { + [['test1', "test", true], [5.1, 5, true], [5.1, 5.1, false], [true, true, false], [false, true, false], [false, false, false], [-4, -4, false], [-4, 4, false]].forEach(function (data) { + var b = data.shift(); + var a = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().lessThan(a, b)).is.equal(c); + }); + }); + }); + describe('documentations', function () { + it('should run ...', function () { + (0, _chai.expect)(new _comparator.Comparator().lessThanOrEqual(2, 5)).to.be["true"]; + (0, _chai.expect)(new _comparator.Comparator().greaterThan(4, 2)).to.be["true"]; + (0, _chai.expect)(new _comparator.Comparator().equal(4, 4)).to.be["true"]; + (0, _chai.expect)(new _comparator.Comparator().equal(4, 5)).to.be["false"]; + }); + it('should run with own function ...', function () { + (0, _chai.expect)(new _comparator.Comparator(function (a, b) { + if (a.v === b.v) return 0; + return a.v < b.v ? -1 : 1; + }).equal({ + v: 2 + }, { + v: 2 + })).to.be["true"]; + }); + }); + describe('lessThanOrEqual()', function () { + [['test1', "test", true], [5.1, 5, true], [5.1, 5.1, true], [true, true, true], [false, true, false], [false, false, true], [-4, -4, true], [-4, 4, false]].forEach(function (data) { + var b = data.shift(); + var a = data.shift(); + var c = data.shift(); + it('should compare ' + a + ' and ' + b + ' return ' + c, function () { + (0, _chai.expect)(new _comparator.Comparator().lessThanOrEqual(a, b)).is.equal(c); + }); + }); + }); +}); + +},{"../../../source/util/comparator.js":269,"chai":84}],288:[function(require,module,exports){ "use strict"; require("../cases/types/observer.js"); @@ -53563,18 +54543,36 @@ require("../cases/types/observerlist.js"); require("../cases/types/is.js"); +require("../cases/types/proxyobserver.js"); + +require("../cases/types/tokenlist.js"); + require("../cases/types/version.js"); require("../cases/types/id.js"); require("../cases/types/validate.js"); +require("../cases/constraint/isobject.js"); + +require("../cases/constraint/valid.js"); + +require("../cases/constraint/invalid.js"); + +require("../cases/constraint/oroperator.js"); + +require("../cases/constraint/andoperator.js"); + +require("../cases/constraint/isarray.js"); + +require("../cases/util/comparator.js"); + require("../cases/util/clone.js"); require("../cases/math/random.js"); require("../cases/monster.js"); -},{"../cases/math/random.js":267,"../cases/monster.js":268,"../cases/types/id.js":269,"../cases/types/is.js":270,"../cases/types/observer.js":271,"../cases/types/observerlist.js":272,"../cases/types/validate.js":273,"../cases/types/version.js":274,"../cases/util/clone.js":275}],277:[function(require,module,exports){ -arguments[4][43][0].apply(exports,arguments) -},{"dup":43}]},{},[276]); +},{"../cases/constraint/andoperator.js":270,"../cases/constraint/invalid.js":271,"../cases/constraint/isarray.js":272,"../cases/constraint/isobject.js":273,"../cases/constraint/oroperator.js":274,"../cases/constraint/valid.js":275,"../cases/math/random.js":276,"../cases/monster.js":277,"../cases/types/id.js":278,"../cases/types/is.js":279,"../cases/types/observer.js":280,"../cases/types/observerlist.js":281,"../cases/types/proxyobserver.js":282,"../cases/types/tokenlist.js":283,"../cases/types/validate.js":284,"../cases/types/version.js":285,"../cases/util/clone.js":286,"../cases/util/comparator.js":287}],289:[function(require,module,exports){ +arguments[4][39][0].apply(exports,arguments) +},{"dup":39}]},{},[288]); diff --git a/playground/dev/index.html b/playground/dev/index.html index 4500d62090a772d4dbcd21ae6c38cc220577fd38..d3d8ac3d538705692c976683dc8a8c54685abd46 100644 --- a/playground/dev/index.html +++ b/playground/dev/index.html @@ -6,14 +6,9 @@ <!-- <script type="module" src="dist/index.js"></script>--> <script type="module"> - import {Monster} from '/monster/packages/monster/dist/modules/util/freeze.js'; - console.log(Monster.Util.deepFreeze({})) - </script> - Alternatively, you can also integrate this function individually. - - <script type="module"> - import {deepFreeze} from '/monster/packages/monster/dist/modules/util/freeze.js'; - console.log(deepFreeze({})) + import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.2.0/dist/modules/types/tokenlist.js'; + console.log(new TokenList("myclass row")) + console.log(new TokenList("myclass row").add(['a','b','c']).replace('b','4').toString()) </script> diff --git a/playground/dev/source/index.js b/playground/dev/source/index.js index 276b6b46b6d22d5dabb4d673a035b1f222765ad3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/playground/dev/source/index.js +++ b/playground/dev/source/index.js @@ -1,118 +0,0 @@ -// require('../node_modules/@schukai/monster'); -// -// -// const test = { -// string: "data", -// number: 231321, -// object: { -// string: "data", -// number: 32434 -// }, -// array: [ -// 1, 2, 3, 4, 5 -// ], -// }; -// -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots -// const handler = { -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver -// get: function (target, property, receiver) { -// console.log('get',target, property, receiver); -// const prop = target?.[property]; -// -// // return if property not found -// if (prop === undefined || typeof prop == 'undefined') { -// return undefined; -// } -// -// // set value as proxy if object or array -// if (typeof prop === 'object' && (Array.isArray(prop) || !(prop instanceof Proxy))) { -// target[property] = new Proxy(prop, handler); -// } -// -// return target[property]; -// -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver -// set: function (target, property, value, receiver) { -// target[property] = value -// return true; -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p -// deleteProperty: function (target, property) { -// if (property in target) { -// delete target[property]; -// return true; -// } -// return false; -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist -// apply: function (target, thisArg, parameters) { -// return target.apply(thisArg, parameters); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget -// construct(target, args) { -// return new target(...args); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc -// defineProperty: function (target, property, descriptor) { -// return Reflect.defineProperty(target, property, descriptor); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p -// has: function (target, property) { -// return property in target; -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-isextensible -// isExtensible(target) { -// return Reflect.isExtensible(target); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions -// preventExtensions(target) { -// return Reflect.preventExtensions(target); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys -// ownKeys: function (target) { -// return Reflect.ownKeys(target); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p -// getOwnPropertyDescriptor: function (target, property) { -// const p = Reflect.getOwnPropertyDescriptor(target, property) -// return p ? { -// value: p.value, -// writable: p.writable, -// enumerable: p.enumerable, -// configurable: p.configurable -// } : undefined; -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof -// getPrototypeOf: function (target) { -// return Reflect.getPrototypeOf(target); -// }, -// -// // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v -// setPrototypeOf: function (target, prototype) { -// return Reflect.setPrototypeOf(object1, prototype); -// } -// -// }; -// -// -// const proxy = new Proxy(test, handler); -// -// -// -// console.log(proxy,'proxy'); -// console.log(test,'test'); \ No newline at end of file diff --git a/templates/README.md b/templates/README.md index f7ac5045ee1ed21ffb7b9f389fbeac3fa4713b83..0f3f709b9c4a71b754137f8073a2dde873bf0c92 100644 --- a/templates/README.md +++ b/templates/README.md @@ -31,7 +31,7 @@ npm install @schukai/monster @schukai/%%NAME%% ``` <script type="module"> - import {Monster} from 'https://unpkg.com/@schukai/monster@1.0.15/dist/modules/monster.js'; + import {Monster} from 'https://unpkg.com/@schukai/monster@1.1.0/dist/modules/monster.js'; import {Monster} from 'https://unpkg.com/@schukai/%%NAME%%@1.0.15/dist/modules/monster.js'; console.log(Module.getVersion()) </script> @@ -41,7 +41,7 @@ nomodule for backwards compatibility ``` <script type="module" src="module.mjs"></script> -<script nomodule src="https://unpkg.com/@schukai/monster@1.0.15/dist/monster.js"></script> +<script nomodule src="https://unpkg.com/@schukai/monster@1.1.0/dist/monster.js"></script> <script nomodule src="https://unpkg.com/@schukai/%%NAME%%@1.0.15/dist/monster.js"></script> ``` diff --git a/templates/source/.gitkeep b/templates/source/monster.js similarity index 100% rename from templates/source/.gitkeep rename to templates/source/monster.js