@schukai/monster 1.30.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +17 -1
- package/README.md +55 -58
- package/example/constraints/andoperator.mjs +17 -0
- package/example/constraints/invalid.mjs +6 -0
- package/example/constraints/isarray.mjs +11 -0
- package/example/constraints/isobject.mjs +12 -0
- package/example/constraints/oroperator.mjs +15 -0
- package/example/constraints/valid.mjs +6 -0
- package/example/data/buildmap.mjs +67 -0
- package/example/data/datasource.mjs +7 -0
- package/example/data/diff.mjs +39 -0
- package/example/data/pathfinder-1.mjs +23 -0
- package/example/data/pathfinder-2.mjs +19 -0
- package/example/data/pipe.mjs +14 -0
- package/example/data/storage/restapi.mjs +11 -0
- package/example/data/transformer.mjs +9 -0
- package/example/dom/customelement.mjs +13 -0
- package/example/dom/theme.mjs +5 -0
- package/example/dom/updater.mjs +23 -0
- package/example/i18n/formatter.mjs +10 -0
- package/example/i18n/providers/fetch.mjs +5 -0
- package/example/i18n/translations.mjs +20 -0
- package/example/types/basewithoptions.mjs +10 -0
- package/example/types/is-1.mjs +5 -0
- package/example/types/is-10.mjs +6 -0
- package/example/types/is-2.mjs +4 -0
- package/example/types/is-3.mjs +4 -0
- package/example/types/is-4.mjs +5 -0
- package/example/types/is-5.mjs +4 -0
- package/example/types/is-6.mjs +4 -0
- package/example/types/is-7.mjs +4 -0
- package/example/types/is-8.mjs +4 -0
- package/example/types/is-9.mjs +6 -0
- package/example/types/noderecursiveiterator.mjs +32 -0
- package/example/types/observer.mjs +9 -0
- package/example/types/proxyobserver.mjs +25 -0
- package/example/types/queue.mjs +20 -0
- package/example/types/tokenlist-1.mjs +4 -0
- package/example/types/tokenlist-2.mjs +7 -0
- package/example/types/tokenlist-3.mjs +5 -0
- package/example/types/tokenlist-4.mjs +5 -0
- package/example/types/tokenlist-5.mjs +5 -0
- package/example/types/typeof.mjs +9 -0
- package/example/types/version-1.mjs +6 -0
- package/example/types/version-2.mjs +3 -0
- package/example/util/comparator.mjs +10 -0
- package/example/util/deadmansswitch.mjs +9 -0
- package/example/util/processing.mjs +17 -0
- package/package.json +5 -59
- package/source/{constants.js → constants.mjs} +7 -10
- package/source/constraints/{abstract.js → abstract.mjs} +8 -9
- package/source/constraints/{abstractoperator.js → abstractoperator.mjs} +11 -8
- package/source/constraints/andoperator.mjs +38 -0
- package/source/constraints/invalid.mjs +38 -0
- package/source/constraints/isarray.mjs +41 -0
- package/source/constraints/isobject.mjs +41 -0
- package/source/constraints/{namespace.js → namespace.mjs} +3 -8
- package/source/constraints/{oroperator.js → oroperator.mjs} +10 -42
- package/source/constraints/valid.mjs +38 -0
- package/source/data/{buildmap.js → buildmap.mjs} +18 -104
- package/source/data/{buildtree.js → buildtree.mjs} +11 -31
- package/source/data/datasource/{namespace.js → namespace.mjs} +1 -9
- package/source/data/datasource/restapi/namespace.mjs +8 -0
- package/source/data/datasource/restapi/{writeerror.js → writeerror.mjs} +8 -9
- package/source/data/datasource/{restapi.js → restapi.mjs} +15 -45
- package/source/data/datasource/storage/localstorage.mjs +45 -0
- package/source/data/datasource/storage/{namespace.js → namespace.mjs} +1 -9
- package/source/data/datasource/storage/sessionstorage.mjs +45 -0
- package/source/data/datasource/{storage.js → storage.mjs} +12 -35
- package/source/data/{datasource.js → datasource.mjs} +17 -45
- package/source/data/{diff.js → diff.mjs} +10 -69
- package/source/data/{extend.js → extend.mjs} +10 -28
- package/source/data/{namespace.js → namespace.mjs} +2 -8
- package/source/data/{pathfinder.js → pathfinder.mjs} +18 -77
- package/source/data/{pipe.js → pipe.mjs} +14 -46
- package/source/data/{transformer.js → transformer.mjs} +18 -43
- package/source/dom/{assembler.js → assembler.mjs} +12 -28
- package/source/dom/{attributes.js → attributes.mjs} +42 -253
- package/source/dom/{constants.js → constants.mjs} +110 -61
- package/source/dom/{customcontrol.js → customcontrol.mjs} +10 -17
- package/source/dom/{customelement.js → customelement.mjs} +55 -59
- package/source/dom/{events.js → events.mjs} +15 -64
- package/source/dom/{focusmanager.js → focusmanager.mjs} +13 -34
- package/source/dom/{locale.js → locale.mjs} +11 -26
- package/source/dom/{namespace.js → namespace.mjs} +1 -8
- package/source/dom/ready.mjs +63 -0
- package/source/dom/resource/{data.js → data.mjs} +11 -31
- package/source/dom/resource/link/namespace.mjs +10 -0
- package/source/dom/resource/link/stylesheet.mjs +35 -0
- package/source/dom/resource/{link.js → link.mjs} +9 -29
- package/source/dom/resource/namespace.mjs +8 -0
- package/source/dom/resource/{script.js → script.mjs} +9 -29
- package/source/dom/{resource.js → resource.mjs} +19 -39
- package/source/dom/{resourcemanager.js → resourcemanager.mjs} +17 -35
- package/source/dom/{template.js → template.mjs} +18 -43
- package/source/dom/{theme.js → theme.mjs} +14 -36
- package/source/dom/{updater.js → updater.mjs} +34 -68
- package/source/dom/{util.js → util.mjs} +17 -66
- package/source/dom/worker/{factory.js → factory.mjs} +13 -34
- package/source/dom/worker/namespace.mjs +8 -0
- package/source/i18n/{formatter.js → formatter.mjs} +14 -45
- package/source/i18n/{locale.js → locale.mjs} +15 -30
- package/source/i18n/{namespace.js → namespace.mjs} +1 -9
- package/source/i18n/provider.mjs +40 -0
- package/source/i18n/providers/{fetch.js → fetch.mjs} +18 -43
- package/source/i18n/providers/namespace.mjs +8 -0
- package/source/i18n/{translations.js → translations.mjs} +12 -52
- package/source/logging/handler/console.mjs +50 -0
- package/source/logging/handler/namespace.mjs +6 -0
- package/source/logging/{handler.js → handler.mjs} +13 -30
- package/source/logging/logentry.mjs +51 -0
- package/source/logging/{logger.js → logger.mjs} +12 -28
- package/source/logging/{namespace.js → namespace.mjs} +1 -9
- package/source/math/{namespace.js → namespace.mjs} +1 -9
- package/source/math/{random.js → random.mjs} +8 -34
- package/source/monster.mjs +114 -0
- package/source/text/{formatter.js → formatter.mjs} +17 -33
- package/source/text/{namespace.js → namespace.mjs} +1 -9
- package/source/types/base.mjs +31 -0
- package/source/types/{basewithoptions.js → basewithoptions.mjs} +17 -46
- package/source/types/{binary.js → binary.mjs} +10 -42
- package/source/types/{dataurl.js → dataurl.mjs} +12 -46
- package/source/types/{global.js → global.mjs} +20 -12
- package/source/types/{id.js → id.mjs} +10 -27
- package/source/types/is.mjs +225 -0
- package/source/types/{mediatype.js → mediatype.mjs} +13 -29
- package/source/types/{namespace.js → namespace.mjs} +1 -8
- package/source/types/{node.js → node.mjs} +11 -28
- package/source/types/{nodelist.js → nodelist.mjs} +17 -32
- package/source/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +14 -65
- package/source/types/{observer.js → observer.mjs} +15 -42
- package/source/types/{observerlist.js → observerlist.mjs} +12 -29
- package/source/types/{proxyobserver.js → proxyobserver.mjs} +19 -62
- package/source/types/{queue.js → queue.mjs} +10 -47
- package/source/types/randomid.mjs +45 -0
- package/source/types/regex.mjs +27 -0
- package/source/types/{stack.js → stack.mjs} +8 -24
- package/source/types/{tokenlist.js → tokenlist.mjs} +20 -64
- package/source/types/typeof.mjs +37 -0
- package/source/types/{uniquequeue.js → uniquequeue.mjs} +11 -27
- package/source/types/{uuid.js → uuid.mjs} +15 -33
- package/source/types/{validate.js → validate.mjs} +38 -155
- package/source/types/{version.js → version.mjs} +19 -62
- package/source/util/{clone.js → clone.mjs} +10 -28
- package/source/util/{comparator.js → comparator.mjs} +13 -43
- package/source/util/{deadmansswitch.js → deadmansswitch.mjs} +15 -40
- package/source/util/freeze.mjs +39 -0
- package/source/util/{namespace.js → namespace.mjs} +1 -9
- package/source/util/{processing.js → processing.mjs} +13 -51
- package/source/util/{trimspaces.js → trimspaces.mjs} +14 -21
- package/test/cases/constraint/{andoperator.js → andoperator.mjs} +3 -3
- package/test/cases/constraint/{invalid.js → invalid.mjs} +1 -1
- package/test/cases/constraint/{isarray.js → isarray.mjs} +1 -1
- package/test/cases/constraint/{isobject.js → isobject.mjs} +1 -1
- package/test/cases/constraint/{oroperator.js → oroperator.mjs} +3 -3
- package/test/cases/constraint/{valid.js → valid.mjs} +1 -1
- package/test/cases/data/{buildmap.js → buildmap.mjs} +1 -1
- package/test/cases/data/{buildtree.js → buildtree.mjs} +2 -2
- package/test/cases/data/datasource/{restapi.js → restapi.mjs} +5 -5
- package/test/cases/data/datasource/storage/{localstorage.js → localstorage.mjs} +5 -5
- package/test/cases/data/datasource/storage/{sessionstorage.js → sessionstorage.mjs} +5 -5
- package/test/cases/data/{datasource.js → datasource.mjs} +1 -1
- package/test/cases/data/{diff.js → diff.mjs} +2 -2
- package/test/cases/data/{extend.js → extend.mjs} +1 -1
- package/test/cases/data/{pathfinder.js → pathfinder.mjs} +1 -1
- package/test/cases/data/{pipe.js → pipe.mjs} +19 -5
- package/test/cases/data/{transformer.js → transformer.mjs} +14 -10
- package/test/cases/dom/{assembler.js → assembler.mjs} +2 -2
- package/test/cases/dom/{attributes.js → attributes.mjs} +2 -2
- package/test/cases/dom/{customcontrol.js → customcontrol.mjs} +6 -6
- package/test/cases/dom/{customelement.js → customelement.mjs} +6 -6
- package/test/cases/dom/{events.js → events.mjs} +2 -2
- package/test/cases/dom/{focusmanager.js → focusmanager.mjs} +3 -3
- package/test/cases/dom/{locale.js → locale.mjs} +2 -2
- package/test/cases/dom/ready.mjs +42 -0
- package/test/cases/dom/resource/{data.js → data.mjs} +9 -9
- package/test/cases/dom/resource/link/{stylesheet.js → stylesheet.mjs} +6 -6
- package/test/cases/dom/resource/{link.js → link.mjs} +6 -6
- package/test/cases/dom/resource/{script.js → script.mjs} +6 -6
- package/test/cases/dom/{resourcemanager.js → resourcemanager.mjs} +6 -6
- package/test/cases/dom/{template.js → template.mjs} +3 -3
- package/test/cases/dom/{theme.js → theme.mjs} +3 -3
- package/test/cases/dom/{updater.js → updater.mjs} +6 -6
- package/test/cases/dom/{util.js → util.mjs} +2 -2
- package/test/cases/dom/worker/{factory.js → factory.mjs} +4 -4
- package/test/cases/i18n/{formatter.js → formatter.mjs} +2 -2
- package/test/cases/i18n/{locale.js → locale.mjs} +1 -1
- package/test/cases/i18n/{provider.js → provider.mjs} +1 -1
- package/test/cases/i18n/providers/{fetch.js → fetch.mjs} +3 -3
- package/test/cases/i18n/{translations.js → translations.mjs} +2 -2
- package/test/cases/logging/handler/{console.js → console.mjs} +3 -3
- package/test/cases/logging/{handler.js → handler.mjs} +3 -3
- package/test/cases/logging/{logentry.js → logentry.mjs} +1 -1
- package/test/cases/logging/{logger.js → logger.mjs} +1 -1
- package/test/cases/math/random.mjs +101 -0
- package/test/cases/monster.mjs +20 -0
- package/test/cases/text/{formatter.js → formatter.mjs} +1 -1
- package/test/cases/types/{base.js → base.mjs} +1 -1
- package/test/cases/types/{basewithoptions.js → basewithoptions.mjs} +1 -1
- package/test/cases/types/{binary.js → binary.mjs} +1 -1
- package/test/cases/types/{dataurl.js → dataurl.mjs} +1 -1
- package/test/cases/types/{global.js → global.mjs} +1 -1
- package/test/cases/types/{id.js → id.mjs} +17 -6
- package/test/cases/types/{is.js → is.mjs} +20 -8
- package/test/cases/types/{mediatype.js → mediatype.mjs} +1 -1
- package/test/cases/types/{node.js → node.mjs} +3 -3
- package/test/cases/types/{nodelist.js → nodelist.mjs} +2 -2
- package/test/cases/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +3 -3
- package/test/cases/types/{observer.js → observer.mjs} +1 -1
- package/test/cases/types/{observerlist.js → observerlist.mjs} +2 -2
- package/test/cases/types/{proxyobserver.js → proxyobserver.mjs} +4 -4
- package/test/cases/types/{queue.js → queue.mjs} +1 -1
- package/test/cases/types/randomid.mjs +39 -0
- package/test/cases/types/regex.mjs +46 -0
- package/test/cases/types/{stack.js → stack.mjs} +1 -1
- package/test/cases/types/{tokenlist.js → tokenlist.mjs} +1 -1
- package/test/cases/types/{typeof.js → typeof.mjs} +3 -4
- package/test/cases/types/{uniquequeue.js → uniquequeue.mjs} +1 -1
- package/test/cases/types/{uuid.js → uuid.mjs} +30 -10
- package/test/cases/types/{validate.js → validate.mjs} +3 -4
- package/test/cases/types/{version.js → version.mjs} +1 -2
- package/test/cases/util/{clone.js → clone.mjs} +1 -1
- package/test/cases/util/{comparator.js → comparator.mjs} +1 -1
- package/test/cases/util/{deadmansswitch.js → deadmansswitch.mjs} +1 -1
- package/test/cases/util/{freeze.js → freeze.mjs} +1 -1
- package/test/cases/util/{processing.js → processing.mjs} +1 -1
- package/test/cases/util/{trimspaces.js → trimspaces.mjs} +1 -1
- package/test/util/{chai-dom.js → chai-dom.mjs} +0 -0
- package/test/util/{cleanupdom.js → cleanupdom.mjs} +0 -0
- package/test/util/{jsdom.js → jsdom.mjs} +2 -2
- package/test/util/{localstorage.js → localstorage.mjs} +0 -0
- package/test/web/import.js +77 -77
- package/test/web/prepare.js +0 -8
- package/test/web/test.html +5 -4
- package/test/web/tests.js +25731 -587
- package/dist/modules/constants.js +0 -2
- package/dist/modules/constraints/abstract.js +0 -2
- package/dist/modules/constraints/abstractoperator.js +0 -2
- package/dist/modules/constraints/andoperator.js +0 -2
- package/dist/modules/constraints/invalid.js +0 -2
- package/dist/modules/constraints/isarray.js +0 -2
- package/dist/modules/constraints/isobject.js +0 -2
- package/dist/modules/constraints/namespace.js +0 -2
- package/dist/modules/constraints/oroperator.js +0 -2
- package/dist/modules/constraints/valid.js +0 -2
- package/dist/modules/data/buildmap.js +0 -2
- package/dist/modules/data/buildtree.js +0 -2
- package/dist/modules/data/datasource/namespace.js +0 -2
- package/dist/modules/data/datasource/restapi/writeerror.js +0 -2
- package/dist/modules/data/datasource/restapi.js +0 -2
- package/dist/modules/data/datasource/storage/localstorage.js +0 -2
- package/dist/modules/data/datasource/storage/namespace.js +0 -2
- package/dist/modules/data/datasource/storage/sessionstorage.js +0 -2
- package/dist/modules/data/datasource/storage.js +0 -2
- package/dist/modules/data/datasource.js +0 -2
- package/dist/modules/data/diff.js +0 -2
- package/dist/modules/data/extend.js +0 -2
- package/dist/modules/data/namespace.js +0 -2
- package/dist/modules/data/pathfinder.js +0 -2
- package/dist/modules/data/pipe.js +0 -2
- package/dist/modules/data/transformer.js +0 -2
- package/dist/modules/dom/assembler.js +0 -2
- package/dist/modules/dom/attributes.js +0 -2
- package/dist/modules/dom/constants.js +0 -2
- package/dist/modules/dom/customcontrol.js +0 -2
- package/dist/modules/dom/customelement.js +0 -2
- package/dist/modules/dom/events.js +0 -2
- package/dist/modules/dom/focusmanager.js +0 -2
- package/dist/modules/dom/locale.js +0 -2
- package/dist/modules/dom/namespace.js +0 -2
- package/dist/modules/dom/resource/data.js +0 -2
- package/dist/modules/dom/resource/link/stylesheet.js +0 -2
- package/dist/modules/dom/resource/link.js +0 -2
- package/dist/modules/dom/resource/script.js +0 -2
- package/dist/modules/dom/resource.js +0 -2
- package/dist/modules/dom/resourcemanager.js +0 -2
- package/dist/modules/dom/template.js +0 -2
- package/dist/modules/dom/theme.js +0 -2
- package/dist/modules/dom/updater.js +0 -2
- package/dist/modules/dom/util.js +0 -2
- package/dist/modules/dom/worker/factory.js +0 -2
- package/dist/modules/i18n/formatter.js +0 -2
- package/dist/modules/i18n/locale.js +0 -2
- package/dist/modules/i18n/namespace.js +0 -2
- package/dist/modules/i18n/provider.js +0 -2
- package/dist/modules/i18n/providers/fetch.js +0 -2
- package/dist/modules/i18n/providers/namespace.js +0 -2
- package/dist/modules/i18n/translations.js +0 -2
- package/dist/modules/logging/handler/console.js +0 -2
- package/dist/modules/logging/handler/namespace.js +0 -2
- package/dist/modules/logging/handler.js +0 -2
- package/dist/modules/logging/logentry.js +0 -2
- package/dist/modules/logging/logger.js +0 -2
- package/dist/modules/logging/namespace.js +0 -2
- package/dist/modules/math/namespace.js +0 -2
- package/dist/modules/math/random.js +0 -2
- package/dist/modules/monster.js +0 -2
- package/dist/modules/namespace.js +0 -2
- package/dist/modules/text/formatter.js +0 -2
- package/dist/modules/text/namespace.js +0 -2
- package/dist/modules/types/base.js +0 -2
- package/dist/modules/types/basewithoptions.js +0 -2
- package/dist/modules/types/binary.js +0 -2
- package/dist/modules/types/dataurl.js +0 -2
- package/dist/modules/types/global.js +0 -2
- package/dist/modules/types/id.js +0 -2
- package/dist/modules/types/is.js +0 -2
- package/dist/modules/types/mediatype.js +0 -2
- package/dist/modules/types/namespace.js +0 -2
- package/dist/modules/types/node.js +0 -2
- package/dist/modules/types/nodelist.js +0 -2
- package/dist/modules/types/noderecursiveiterator.js +0 -2
- package/dist/modules/types/observer.js +0 -2
- package/dist/modules/types/observerlist.js +0 -2
- package/dist/modules/types/proxyobserver.js +0 -2
- package/dist/modules/types/queue.js +0 -2
- package/dist/modules/types/randomid.js +0 -2
- package/dist/modules/types/regex.js +0 -2
- package/dist/modules/types/stack.js +0 -2
- package/dist/modules/types/tokenlist.js +0 -2
- package/dist/modules/types/typeof.js +0 -2
- package/dist/modules/types/uniquequeue.js +0 -2
- package/dist/modules/types/uuid.js +0 -2
- package/dist/modules/types/validate.js +0 -2
- package/dist/modules/types/version.js +0 -2
- package/dist/modules/util/clone.js +0 -2
- package/dist/modules/util/comparator.js +0 -2
- package/dist/modules/util/deadmansswitch.js +0 -2
- package/dist/modules/util/freeze.js +0 -2
- package/dist/modules/util/namespace.js +0 -2
- package/dist/modules/util/processing.js +0 -2
- package/dist/modules/util/trimspaces.js +0 -2
- package/dist/monster.dev.js +0 -15469
- package/dist/monster.dev.js.map +0 -1
- package/dist/monster.js +0 -2
- package/source/constraints/andoperator.js +0 -71
- package/source/constraints/invalid.js +0 -63
- package/source/constraints/isarray.js +0 -71
- package/source/constraints/isobject.js +0 -72
- package/source/constraints/valid.js +0 -63
- package/source/data/datasource/storage/localstorage.js +0 -64
- package/source/data/datasource/storage/sessionstorage.js +0 -61
- package/source/dom/resource/link/stylesheet.js +0 -54
- package/source/i18n/provider.js +0 -58
- package/source/i18n/providers/namespace.js +0 -16
- package/source/logging/handler/console.js +0 -66
- package/source/logging/handler/namespace.js +0 -14
- package/source/logging/logentry.js +0 -68
- package/source/monster.js +0 -80
- package/source/namespace.js +0 -170
- package/source/types/base.js +0 -50
- package/source/types/is.js +0 -429
- package/source/types/package.d.ts +0 -1
- package/source/types/randomid.js +0 -60
- package/source/types/regex.js +0 -49
- package/source/types/typeof.js +0 -63
- package/source/util/freeze.js +0 -57
- package/test/cases/math/random.js +0 -82
- package/test/cases/monster.js +0 -23
- package/test/cases/namespace.js +0 -93
- package/test/cases/types/randomid.js +0 -24
- package/test/cases/types/regex.js +0 -32
- package/test/web/monster-dev.html +0 -22
- package/test/web/monster.html +0 -21
@@ -1,40 +1,19 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
|
+
*/
|
7
|
+
|
8
|
+
import {Base} from './base.mjs';
|
2
9
|
|
3
|
-
|
4
|
-
import {Base} from './base.js';
|
10
|
+
export {Version, getMonsterVersion}
|
5
11
|
|
6
12
|
/**
|
7
|
-
* The version object contains a
|
8
|
-
*
|
9
|
-
* You can create the object via the monster namespace `new Monster.Types.Version()`.
|
10
|
-
*
|
11
|
-
* ```
|
12
|
-
* <script type="module">
|
13
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
14
|
-
* console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3
|
15
|
-
* console.log(new Monster.Types.Version('1')) // ↦ 1.0.0
|
16
|
-
* </script>
|
17
|
-
* ```
|
18
|
-
*
|
19
|
-
* Alternatively, you can also integrate this class individually.
|
20
|
-
*
|
21
|
-
* ```
|
22
|
-
* <script type="module">
|
23
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/types/version.js';
|
24
|
-
* console.log(new Version('1.2.3')) // ↦ 1.2.3
|
25
|
-
* console.log(new Version('1')) // ↦ 1.0.0
|
26
|
-
* </script>
|
27
|
-
* ```
|
28
|
-
*
|
29
|
-
* @example
|
30
|
-
*
|
31
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/types/version.js';
|
32
|
-
*
|
33
|
-
* new Version('1.0.0') // ↦ 1.0.0
|
34
|
-
* new Version(1) // ↦ 1.0.0
|
35
|
-
* new Version(1, 0, 0) // ↦ 1.0.0
|
36
|
-
* new Version('1.2.3', 4, 5) // ↦ 1.4.5
|
13
|
+
* The version object contains a semantic version number
|
37
14
|
*
|
15
|
+
* @externalExample ../../example/types/version-1.mjs
|
16
|
+
* @license AGPLv3
|
38
17
|
* @since 1.0.0
|
39
18
|
* @author schukai GmbH
|
40
19
|
* @copyright schukai GmbH
|
@@ -103,7 +82,7 @@ class Version extends Base {
|
|
103
82
|
|
104
83
|
/**
|
105
84
|
* returns 0 if equal, -1 if the object version is less and 1 if greater
|
106
|
-
*
|
85
|
+
* than the compared version
|
107
86
|
*
|
108
87
|
* @param {string|Version} version Version to compare
|
109
88
|
* @returns {number}
|
@@ -139,49 +118,27 @@ class Version extends Base {
|
|
139
118
|
|
140
119
|
}
|
141
120
|
|
142
|
-
assignToNamespace('Monster.Types', Version);
|
143
|
-
|
144
|
-
|
145
121
|
let monsterVersion;
|
146
122
|
|
147
123
|
/**
|
148
124
|
* Version of monster
|
149
125
|
*
|
150
|
-
*
|
151
|
-
*
|
152
|
-
* ```
|
153
|
-
* <script type="module">
|
154
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
155
|
-
* console.log(Monster.getVersion())
|
156
|
-
* </script>
|
157
|
-
* ```
|
158
|
-
*
|
159
|
-
* Alternatively, you can also integrate this function individually.
|
160
|
-
*
|
161
|
-
* ```
|
162
|
-
* <script type="module">
|
163
|
-
* import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/types/version.js';
|
164
|
-
* console.log(getVersion())
|
165
|
-
* </script>
|
166
|
-
* ```
|
167
|
-
*
|
126
|
+
* @externalExample ../../example/types/version-2.mjs
|
168
127
|
* @returns {Monster.Types.Version}
|
128
|
+
* @license AGPLv3
|
169
129
|
* @since 1.0.0
|
170
130
|
* @copyright schukai GmbH
|
171
131
|
* @author schukai GmbH
|
172
132
|
* @memberOf Monster
|
173
133
|
*/
|
174
|
-
function
|
134
|
+
function getMonsterVersion() {
|
175
135
|
if (monsterVersion instanceof Version) {
|
176
136
|
return monsterVersion;
|
177
137
|
}
|
178
|
-
|
179
|
-
|
180
|
-
|
138
|
+
|
139
|
+
/** don't touch, replaced by make with package.json version */
|
140
|
+
monsterVersion = new Version('2.0.0')
|
181
141
|
|
182
142
|
return monsterVersion;
|
183
143
|
|
184
144
|
}
|
185
|
-
|
186
|
-
assignToNamespace('Monster', getVersion);
|
187
|
-
export {Monster, Version, getVersion}
|
@@ -1,15 +1,16 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
6
|
*/
|
6
7
|
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {validateObject} from "../types/validate.js";
|
8
|
+
import {getGlobal} from '../types/global.mjs';
|
9
|
+
import {isArray, isFunction, isObject, isPrimitive} from '../types/is.mjs';
|
10
|
+
import {typeOf} from "../types/typeof.mjs";
|
11
|
+
import {validateObject} from "../types/validate.mjs";
|
12
12
|
|
13
|
+
export {clone}
|
13
14
|
|
14
15
|
/**
|
15
16
|
* With this function, objects can be cloned.
|
@@ -20,26 +21,9 @@ import {validateObject} from "../types/validate.js";
|
|
20
21
|
*
|
21
22
|
* If an object has a method `getClone()`, this method is used to create the clone.
|
22
23
|
*
|
23
|
-
* You can call the method via the monster namespace `Monster.Util.clone()`.
|
24
|
-
*
|
25
|
-
* ```
|
26
|
-
* <script type="module">
|
27
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
28
|
-
* Monster.Util.clone({})
|
29
|
-
* </script>
|
30
|
-
* ```
|
31
|
-
*
|
32
|
-
* Alternatively, you can also integrate this function individually.
|
33
|
-
*
|
34
|
-
* ```
|
35
|
-
* <script type="module">
|
36
|
-
* import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/clone.js';
|
37
|
-
* clone({})
|
38
|
-
* </script>
|
39
|
-
* ```
|
40
|
-
*
|
41
24
|
* @param {*} obj object to be cloned
|
42
25
|
* @returns {*}
|
26
|
+
* @license AGPLv3
|
43
27
|
* @since 1.0.0
|
44
28
|
* @memberOf Monster.Util
|
45
29
|
* @copyright schukai GmbH
|
@@ -156,5 +140,3 @@ function cloneObject(obj) {
|
|
156
140
|
return copy;
|
157
141
|
}
|
158
142
|
|
159
|
-
assignToNamespace('Monster.Util', clone);
|
160
|
-
export {Monster, clone}
|
@@ -1,31 +1,18 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
6
|
*/
|
6
|
-
|
7
|
-
import {Base} from '../types/base.
|
8
|
-
import {isFunction} from '../types/is.
|
7
|
+
|
8
|
+
import {Base} from '../types/base.mjs';
|
9
|
+
import {isFunction} from '../types/is.mjs';
|
10
|
+
|
11
|
+
export {Comparator}
|
9
12
|
|
10
13
|
/**
|
11
14
|
* The comparator allows a comparison function to be abstracted.
|
12
|
-
*
|
13
|
-
* ```
|
14
|
-
* <script type="module">
|
15
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
16
|
-
* new Monster.Util.Comparator()
|
17
|
-
* </script>
|
18
|
-
* ```
|
19
|
-
*
|
20
|
-
* Alternatively, you can also integrate this function individually.
|
21
|
-
*
|
22
|
-
* ```
|
23
|
-
* <script type="module">
|
24
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/comparator.js';
|
25
|
-
* console.log(new Comparator())
|
26
|
-
* </script>
|
27
|
-
* ```
|
28
|
-
*
|
15
|
+
*
|
29
16
|
* The following are some examples of the application of the class.
|
30
17
|
*
|
31
18
|
* ```
|
@@ -44,19 +31,8 @@ import {isFunction} from '../types/is.js';
|
|
44
31
|
* }).equal({v: 2}, {v: 2}); // ↦ true
|
45
32
|
* ```
|
46
33
|
*
|
47
|
-
* @example
|
48
|
-
*
|
49
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/comparator.js';
|
50
|
-
*
|
51
|
-
* console.log(new Comparator().lessThanOrEqual(2, 5))
|
52
|
-
* // ↦ true
|
53
|
-
* console.log(new Comparator().greaterThan(4, 2))
|
54
|
-
* // ↦ true
|
55
|
-
* console.log(new Comparator().equal(4, 4))
|
56
|
-
* // ↦ true
|
57
|
-
* console.log(new Comparator().equal(4, 5))
|
58
|
-
* // ↦ false
|
59
|
-
*
|
34
|
+
* @externalExample ../../example/util/comparator.mjs
|
35
|
+
* @license AGPLv3
|
60
36
|
* @since 1.3.0
|
61
37
|
* @memberOf Monster.Util
|
62
38
|
*/
|
@@ -88,7 +64,7 @@ class Comparator extends Base {
|
|
88
64
|
this.compare = function (a, b) {
|
89
65
|
|
90
66
|
if (typeof a !== typeof b) {
|
91
|
-
throw new TypeError("impractical comparison", "types/comparator.
|
67
|
+
throw new TypeError("impractical comparison", "types/comparator.mjs")
|
92
68
|
}
|
93
69
|
|
94
70
|
if (a === b) {
|
@@ -194,9 +170,3 @@ class Comparator extends Base {
|
|
194
170
|
* @see Monster.Util.Comparator
|
195
171
|
*/
|
196
172
|
|
197
|
-
|
198
|
-
/**
|
199
|
-
*
|
200
|
-
*/
|
201
|
-
assignToNamespace('Monster.Util', Comparator);
|
202
|
-
export {Monster, Comparator}
|
@@ -1,54 +1,29 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
6
|
*/
|
6
7
|
|
8
|
+
import {internalSymbol} from "../constants.mjs";
|
9
|
+
|
10
|
+
import {Base} from "../types/base.mjs";
|
11
|
+
import {isInteger} from "../types/is.mjs";
|
12
|
+
import {validateFunction, validateInteger} from "../types/validate.mjs";
|
7
13
|
|
8
|
-
|
9
|
-
import {assignToNamespace, Monster} from '../namespace.js';
|
10
|
-
import {Base} from "../types/base.js";
|
11
|
-
import {isInteger} from "../types/is.js";
|
12
|
-
import {validateFunction, validateInteger} from "../types/validate.js";
|
14
|
+
export {DeadMansSwitch}
|
13
15
|
|
14
16
|
/**
|
15
17
|
* The dead man's switch allows to set a timer which can be reset again and again within a defined period of time.
|
16
18
|
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
* ```
|
20
|
-
* <script type="module">
|
21
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
22
|
-
* new Monster.Util.DeadMansSwitch()
|
23
|
-
* </script>
|
24
|
-
* ```
|
25
|
-
*
|
26
|
-
* Alternatively, you can also integrate this class individually.
|
27
|
-
*
|
28
|
-
* ```
|
29
|
-
* <script type="module">
|
30
|
-
* import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/deadmansswitch.js';
|
31
|
-
* new DeadMansSwitch();
|
32
|
-
* </script>
|
33
|
-
* ```
|
34
|
-
*
|
35
|
-
* @example
|
36
|
-
* import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/deadmansswitch.js';
|
37
|
-
*
|
38
|
-
* const deadmansswitch = new DeadMansSwitch(100, ()=>{
|
39
|
-
* console.log('yeah!')
|
40
|
-
* // ↦ "yeah!"
|
41
|
-
* })
|
42
|
-
*
|
43
|
-
* deadmansswitch.touch(); // from here wait again 100 ms
|
44
|
-
* deadmansswitch.touch(200); // from here wait 200 ms
|
45
|
-
*
|
19
|
+
* @externalExample ../../example/util/deadmansswitch.mjs
|
46
20
|
* @copyright schukai GmbH
|
21
|
+
* @license AGPLv3
|
47
22
|
* @since 1.29.0
|
48
23
|
* @memberOf Monster.Util
|
49
24
|
* @summary Class to be able to execute function chains
|
50
25
|
*/
|
51
|
-
class DeadMansSwitch extends Base {
|
26
|
+
class DeadMansSwitch extends Base {
|
52
27
|
|
53
28
|
/**
|
54
29
|
* Create new dead man's switch
|
@@ -120,5 +95,5 @@ function init(delay, callback) {
|
|
120
95
|
|
121
96
|
}
|
122
97
|
|
123
|
-
|
124
|
-
|
98
|
+
|
99
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
|
+
*/
|
7
|
+
|
8
|
+
import {validateObject} from '../types/validate.mjs';
|
9
|
+
|
10
|
+
export {deepFreeze}
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Deep freeze a object
|
14
|
+
*
|
15
|
+
* @param {object} object object to be freeze
|
16
|
+
* @license AGPLv3
|
17
|
+
* @since 1.0.0
|
18
|
+
* @returns {object}
|
19
|
+
* @memberOf Monster.Util
|
20
|
+
* @copyright schukai GmbH
|
21
|
+
* @throws {TypeError} value is not a object
|
22
|
+
*/
|
23
|
+
function deepFreeze(object) {
|
24
|
+
|
25
|
+
validateObject(object)
|
26
|
+
|
27
|
+
// Retrieve the defined property names of the object
|
28
|
+
var propNames = Object.getOwnPropertyNames(object);
|
29
|
+
|
30
|
+
// Freeze properties before freezing yourself
|
31
|
+
for (let name of propNames) {
|
32
|
+
let value = object[name];
|
33
|
+
|
34
|
+
object[name] = (value && typeof value === "object") ?
|
35
|
+
deepFreeze(value) : value;
|
36
|
+
}
|
37
|
+
|
38
|
+
return Object.freeze(object);
|
39
|
+
}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
6
|
*/
|
6
7
|
|
8
|
+
import {internalSymbol} from "../constants.mjs";
|
9
|
+
import {Base} from "../types/base.mjs";
|
10
|
+
import {getGlobalFunction} from "../types/global.mjs";
|
11
|
+
import {isFunction, isInteger} from "../types/is.mjs";
|
12
|
+
import {Queue} from "../types/queue.mjs";
|
13
|
+
import {validateFunction, validateInteger} from "../types/validate.mjs";
|
7
14
|
|
8
|
-
|
9
|
-
import {assignToNamespace, Monster} from '../namespace.js';
|
10
|
-
import {Base} from "../types/base.js";
|
11
|
-
import {getGlobalFunction} from "../types/global.js";
|
12
|
-
import {isFunction, isInteger} from "../types/is.js";
|
13
|
-
import {Queue} from "../types/queue.js";
|
14
|
-
import {validateFunction, validateInteger} from "../types/validate.js";
|
15
|
-
|
15
|
+
export {Processing}
|
16
16
|
|
17
17
|
/**
|
18
18
|
* @private
|
@@ -73,44 +73,9 @@ class Callback {
|
|
73
73
|
*
|
74
74
|
* The result of `run()` is a promise.
|
75
75
|
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
* ```
|
79
|
-
* <script type="module">
|
80
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
81
|
-
* new Monster.Util.Processing()
|
82
|
-
* </script>
|
83
|
-
* ```
|
84
|
-
*
|
85
|
-
* Alternatively, you can also integrate this class individually.
|
86
|
-
*
|
87
|
-
* ```
|
88
|
-
* <script type="module">
|
89
|
-
* import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/processing.js';
|
90
|
-
* new Processing();
|
91
|
-
* </script>
|
92
|
-
* ```
|
93
|
-
*
|
94
|
-
* @example
|
95
|
-
* import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/util/processing.js';
|
96
|
-
*
|
97
|
-
* let startTime = +new Date();
|
98
|
-
*
|
99
|
-
* new Processing((url)=>{
|
100
|
-
* return fetch(url)
|
101
|
-
* },(response)=>{
|
102
|
-
* // do something with the response
|
103
|
-
* console.log(response.status, +new Date()-startTime)
|
104
|
-
* },200,()=>{
|
105
|
-
* // this function is called 200 seconds after fetch is received.
|
106
|
-
* console.log('finished', +new Date()-startTime)
|
107
|
-
* return 'done'
|
108
|
-
* }).run('https://monsterjs.org/assets/world.json').then(r=>{
|
109
|
-
* console.log(r)
|
110
|
-
* // ↦ "done"
|
111
|
-
* })
|
112
|
-
*
|
76
|
+
* @externalExample ../../example/util/processing.mjs
|
113
77
|
* @copyright schukai GmbH
|
78
|
+
* @license AGPLv3
|
114
79
|
* @since 1.21.0
|
115
80
|
* @memberOf Monster.Util
|
116
81
|
* @summary Class to be able to execute function chains
|
@@ -189,6 +154,3 @@ class Processing extends Base {
|
|
189
154
|
}
|
190
155
|
|
191
156
|
}
|
192
|
-
|
193
|
-
assignToNamespace('Monster.Util', Processing);
|
194
|
-
export {Monster, Processing}
|
@@ -1,31 +1,25 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
|
3
3
|
/**
|
4
|
-
*
|
4
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
5
|
+
* Node module: @schukai/monster
|
6
|
+
* This file is licensed under the AGPLv3 License.
|
7
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
8
|
*/
|
6
9
|
|
7
|
-
|
8
|
-
import {ID} from "../types/id.
|
9
|
-
import {isObject} from "../types/is.
|
10
|
-
import {validateString} from "../types/validate.
|
10
|
+
|
11
|
+
import {ID} from "../types/id.mjs";
|
12
|
+
import {isObject} from "../types/is.mjs";
|
13
|
+
import {validateString} from "../types/validate.mjs";
|
14
|
+
|
15
|
+
export {trimSpaces}
|
11
16
|
|
12
17
|
/**
|
13
18
|
* This special trim function allows to trim spaces that have been protected by a special escape character.
|
14
19
|
*
|
15
|
-
* You can call the method via the monster namespace `Monster.Util.trimSpaces()`.
|
16
|
-
*
|
17
|
-
* ```
|
18
|
-
* <script type="module">
|
19
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
20
|
-
* Monster.Util.trimSpaces(" hello ")
|
21
|
-
* </script>
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* Alternatively, you can also integrate this function individually.
|
25
|
-
*
|
26
20
|
* ```
|
27
21
|
* <script type="module">
|
28
|
-
* import {trimSpaces} from '
|
22
|
+
* import {trimSpaces} from '@schukai/monster/source/util/trimspaces.mjs';
|
29
23
|
* trimSpaces(' hello \\ ')
|
30
24
|
* </script>
|
31
25
|
* ```
|
@@ -37,6 +31,7 @@ import {validateString} from "../types/validate.js";
|
|
37
31
|
* a\\ b ↦ a\ b
|
38
32
|
* ```
|
39
33
|
*
|
34
|
+
* @license AGPLv3
|
40
35
|
* @since 1.24.0
|
41
36
|
* @memberOf Monster.Util
|
42
37
|
* @copyright schukai GmbH
|
@@ -44,7 +39,7 @@ import {validateString} from "../types/validate.js";
|
|
44
39
|
* @return {string}
|
45
40
|
* @throws {TypeError} value is not a string
|
46
41
|
*/
|
47
|
-
function trimSpaces(value) {
|
42
|
+
function trimSpaces(value) {
|
48
43
|
|
49
44
|
validateString(value);
|
50
45
|
|
@@ -81,5 +76,3 @@ function trimSpaces(value) {
|
|
81
76
|
|
82
77
|
}
|
83
78
|
|
84
|
-
assignToNamespace('Monster.Util', trimSpaces);
|
85
|
-
export {Monster, trimSpaces}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {Valid} from "
|
2
|
-
import {Invalid} from "
|
3
|
-
import {AndOperator} from "
|
1
|
+
import {Valid} from "../../../../application/source/constraints/valid.mjs";
|
2
|
+
import {Invalid} from "../../../../application/source/constraints/invalid.mjs";
|
3
|
+
import {AndOperator} from "../../../../application/source/constraints/andoperator.mjs";
|
4
4
|
|
5
5
|
describe('AndOperator', function () {
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {Valid} from "
|
2
|
-
import {Invalid} from "
|
3
|
-
import {OrOperator} from "
|
1
|
+
import {Valid} from "../../../../application/source/constraints/valid.mjs";
|
2
|
+
import {Invalid} from "../../../../application/source/constraints/invalid.mjs";
|
3
|
+
import {OrOperator} from "../../../../application/source/constraints/oroperator.mjs";
|
4
4
|
|
5
5
|
describe('OrOperator', function () {
|
6
6
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import {expect} from "chai"
|
4
|
-
import {buildTree} from "
|
5
|
-
import {NodeList} from "
|
4
|
+
import {buildTree} from "../../../../application/source/data/buildtree.mjs";
|
5
|
+
import {NodeList} from "../../../../application/source/types/nodelist.mjs";
|
6
6
|
|
7
7
|
|
8
8
|
describe('buildTree', function () {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import {expect} from "chai"
|
4
|
-
import {RestAPI} from "
|
5
|
-
import {validateObject} from "
|
4
|
+
import {RestAPI} from "../../../../../application/source/data/datasource/restapi.mjs";
|
5
|
+
import {validateObject} from "../../../../../application/source/types/validate.mjs";
|
6
6
|
|
7
7
|
|
8
8
|
describe('RestAPI', function () {
|
@@ -11,14 +11,14 @@ describe('RestAPI', function () {
|
|
11
11
|
let returnStatus;
|
12
12
|
|
13
13
|
afterEach(() => {
|
14
|
-
|
14
|
+
globalThis['fetch'] = fetchReference;
|
15
15
|
});
|
16
16
|
|
17
17
|
beforeEach(() => {
|
18
18
|
|
19
19
|
returnStatus = 200;
|
20
|
-
fetchReference =
|
21
|
-
|
20
|
+
fetchReference = globalThis['fetch'];
|
21
|
+
globalThis['fetch'] = function (url, options) {
|
22
22
|
|
23
23
|
if (!url) throw new Error('missing url')
|
24
24
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import {expect} from "chai"
|
4
|
-
import {LocalStorage} from "
|
5
|
-
import {createStorage} from "../../../../util/localstorage.
|
4
|
+
import {LocalStorage} from "../../../../../../application/source/data/datasource/storage/localstorage.mjs";
|
5
|
+
import {createStorage} from "../../../../util/localstorage.mjs";
|
6
6
|
|
7
7
|
|
8
8
|
let localStorageReference;
|
@@ -10,13 +10,13 @@ let localStorageReference;
|
|
10
10
|
describe('LocalStorage', function () {
|
11
11
|
|
12
12
|
afterEach(() => {
|
13
|
-
|
13
|
+
globalThis['localStorage'] = localStorageReference;
|
14
14
|
});
|
15
15
|
|
16
16
|
beforeEach(function () {
|
17
17
|
|
18
|
-
localStorageReference =
|
19
|
-
|
18
|
+
localStorageReference = globalThis['localStorage']
|
19
|
+
globalThis['localStorage'] = createStorage();
|
20
20
|
|
21
21
|
})
|
22
22
|
|