@schukai/monster 3.4.2 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/example/i18n/providers/embed.mjs +5 -0
  2. package/package.json +1 -1
  3. package/source/constants.mjs +4 -9
  4. package/source/constraints/abstract.mjs +4 -6
  5. package/source/constraints/abstractoperator.mjs +6 -12
  6. package/source/constraints/andoperator.mjs +3 -6
  7. package/source/constraints/invalid.mjs +3 -6
  8. package/source/constraints/isarray.mjs +6 -9
  9. package/source/constraints/isobject.mjs +4 -7
  10. package/source/constraints/namespace.mjs +1 -3
  11. package/source/constraints/oroperator.mjs +26 -25
  12. package/source/constraints/valid.mjs +3 -6
  13. package/source/data/buildmap.mjs +20 -36
  14. package/source/data/buildtree.mjs +29 -29
  15. package/source/data/datasource/namespace.mjs +1 -1
  16. package/source/data/datasource/server/restapi/writeerror.mjs +6 -6
  17. package/source/data/datasource/server/restapi.mjs +51 -65
  18. package/source/data/datasource/server/webconnect.mjs +26 -35
  19. package/source/data/datasource/server.mjs +17 -21
  20. package/source/data/datasource/storage/localstorage.mjs +8 -11
  21. package/source/data/datasource/storage/sessionstorage.mjs +8 -10
  22. package/source/data/datasource/storage.mjs +18 -22
  23. package/source/data/datasource.mjs +27 -43
  24. package/source/data/diff.mjs +20 -32
  25. package/source/data/extend.mjs +20 -14
  26. package/source/data/namespace.mjs +1 -3
  27. package/source/data/pathfinder.mjs +40 -67
  28. package/source/data/pipe.mjs +6 -10
  29. package/source/data/transformer.mjs +141 -157
  30. package/source/dom/assembler.mjs +6 -9
  31. package/source/dom/attributes.mjs +36 -48
  32. package/source/dom/constants.mjs +55 -71
  33. package/source/dom/customcontrol.mjs +16 -21
  34. package/source/dom/customelement.mjs +140 -164
  35. package/source/dom/events.mjs +17 -24
  36. package/source/dom/focusmanager.mjs +30 -48
  37. package/source/dom/locale.mjs +41 -10
  38. package/source/dom/namespace.mjs +1 -1
  39. package/source/dom/ready.mjs +7 -10
  40. package/source/dom/resource/data.mjs +38 -46
  41. package/source/dom/resource/link/namespace.mjs +1 -3
  42. package/source/dom/resource/link/stylesheet.mjs +7 -11
  43. package/source/dom/resource/link.mjs +36 -17
  44. package/source/dom/resource/namespace.mjs +1 -1
  45. package/source/dom/resource/script.mjs +23 -13
  46. package/source/dom/resource.mjs +47 -60
  47. package/source/dom/resourcemanager.mjs +36 -43
  48. package/source/dom/template.mjs +17 -24
  49. package/source/dom/theme.mjs +8 -12
  50. package/source/dom/updater.mjs +150 -196
  51. package/source/dom/util.mjs +11 -12
  52. package/source/dom/worker/factory.mjs +21 -25
  53. package/source/dom/worker/namespace.mjs +1 -1
  54. package/source/i18n/formatter.mjs +20 -24
  55. package/source/i18n/locale.mjs +40 -42
  56. package/source/i18n/namespace.mjs +1 -1
  57. package/source/i18n/provider.mjs +4 -7
  58. package/source/i18n/providers/embed.mjs +115 -0
  59. package/source/i18n/providers/fetch.mjs +33 -38
  60. package/source/i18n/translations.mjs +16 -20
  61. package/source/logging/handler/console.mjs +6 -10
  62. package/source/logging/handler.mjs +15 -18
  63. package/source/logging/logentry.mjs +8 -9
  64. package/source/logging/logger.mjs +73 -55
  65. package/source/logging/namespace.mjs +1 -1
  66. package/source/math/namespace.mjs +1 -1
  67. package/source/math/random.mjs +13 -14
  68. package/source/monster.mjs +132 -100
  69. package/source/net/namespace.mjs +1 -3
  70. package/source/net/webconnect/message.mjs +6 -8
  71. package/source/net/webconnect/namespace.mjs +1 -3
  72. package/source/net/webconnect.mjs +28 -39
  73. package/source/text/formatter.mjs +44 -55
  74. package/source/types/base.mjs +16 -26
  75. package/source/types/basewithoptions.mjs +8 -14
  76. package/source/types/binary.mjs +4 -5
  77. package/source/types/dataurl.mjs +19 -27
  78. package/source/types/global.mjs +14 -26
  79. package/source/types/id.mjs +4 -6
  80. package/source/types/is.mjs +11 -16
  81. package/source/types/mediatype.mjs +29 -44
  82. package/source/types/namespace.mjs +0 -1
  83. package/source/types/node.mjs +16 -22
  84. package/source/types/nodelist.mjs +10 -14
  85. package/source/types/noderecursiveiterator.mjs +11 -14
  86. package/source/types/observablequeue.mjs +13 -16
  87. package/source/types/observer.mjs +16 -23
  88. package/source/types/observerlist.mjs +18 -21
  89. package/source/types/proxyobserver.mjs +24 -37
  90. package/source/types/queue.mjs +8 -13
  91. package/source/types/randomid.mjs +10 -10
  92. package/source/types/regex.mjs +3 -5
  93. package/source/types/stack.mjs +4 -8
  94. package/source/types/tokenlist.mjs +24 -31
  95. package/source/types/typeof.mjs +5 -7
  96. package/source/types/uniquequeue.mjs +8 -13
  97. package/source/types/uuid.mjs +18 -25
  98. package/source/types/validate.mjs +26 -27
  99. package/source/types/version.mjs +17 -25
  100. package/source/util/clone.mjs +23 -32
  101. package/source/util/comparator.mjs +7 -15
  102. package/source/util/deadmansswitch.mjs +16 -23
  103. package/source/util/freeze.mjs +5 -7
  104. package/source/util/namespace.mjs +1 -1
  105. package/source/util/processing.mjs +33 -39
  106. package/source/util/trimspaces.mjs +17 -24
  107. package/test/cases/dom/locale.mjs +15 -0
  108. package/test/cases/i18n/providers/embed.mjs +72 -0
  109. package/test/cases/monster.mjs +1 -1
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  /**
4
2
  * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
5
3
  * Node module: @schukai/monster
@@ -7,22 +5,21 @@
7
5
  * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
8
6
  */
9
7
 
10
-
11
- import {Base} from '../types/base.mjs';
12
- import {getGlobal, getGlobalObject} from "../types/global.mjs";
13
- import {ID} from '../types/id.mjs';
14
- import {isArray, isObject, isString} from '../types/is.mjs';
8
+ import { Base } from "../types/base.mjs";
9
+ import { getGlobal, getGlobalObject } from "../types/global.mjs";
10
+ import { ID } from "../types/id.mjs";
11
+ import { isArray, isObject, isString } from "../types/is.mjs";
15
12
  import {
16
13
  validateFunction,
17
14
  validateInteger,
18
15
  validateObject,
19
16
  validatePrimitive,
20
- validateString
21
- } from '../types/validate.mjs';
22
- import {clone} from "../util/clone.mjs";
23
- import {Pathfinder} from "./pathfinder.mjs";
17
+ validateString,
18
+ } from "../types/validate.mjs";
19
+ import { clone } from "../util/clone.mjs";
20
+ import { Pathfinder } from "./pathfinder.mjs";
24
21
 
25
- export {Transformer}
22
+ export { Transformer };
26
23
 
27
24
  /**
28
25
  * The transformer class is a swiss army knife for manipulating values. especially in combination with the pipe, processing chains can be built up.
@@ -82,7 +79,7 @@ export {Transformer}
82
79
  * url: 'http://example.com/',
83
80
  * pretendToBeVisual: true
84
81
  * });
85
- *
82
+ *
86
83
  * [
87
84
  * 'self',
88
85
  * 'document',
@@ -120,9 +117,8 @@ class Transformer extends Base {
120
117
  constructor(definition) {
121
118
  super();
122
119
  this.args = disassemble(definition);
123
- this.command = this.args.shift()
120
+ this.command = this.args.shift();
124
121
  this.callbacks = new Map();
125
-
126
122
  }
127
123
 
128
124
  /**
@@ -135,8 +131,8 @@ class Transformer extends Base {
135
131
  * @throws {TypeError} value is not a function
136
132
  */
137
133
  setCallback(name, callback, context) {
138
- validateString(name)
139
- validateFunction(callback)
134
+ validateString(name);
135
+ validateFunction(callback);
140
136
 
141
137
  if (context !== undefined) {
142
138
  validateObject(context);
@@ -159,7 +155,7 @@ class Transformer extends Base {
159
155
  * @throws {Error} type not supported
160
156
  */
161
157
  run(value) {
162
- return transform.apply(this, [value])
158
+ return transform.apply(this, [value]);
163
159
  }
164
160
  }
165
161
 
@@ -170,33 +166,31 @@ class Transformer extends Base {
170
166
  * @private
171
167
  */
172
168
  function disassemble(command) {
173
-
174
169
  validateString(command);
175
170
 
176
- let placeholder = new Map;
177
- const regex = /((?<pattern>\\(?<char>.)){1})/mig;
171
+ let placeholder = new Map();
172
+ const regex = /((?<pattern>\\(?<char>.)){1})/gim;
178
173
 
179
174
  // The separator for args must be escaped
180
175
  // undefined string which should not occur normally and is also not a regex
181
- let result = command.matchAll(regex)
176
+ let result = command.matchAll(regex);
182
177
 
183
178
  for (let m of result) {
184
- let g = m?.['groups'];
179
+ let g = m?.["groups"];
185
180
  if (!isObject(g)) {
186
181
  continue;
187
182
  }
188
183
 
189
- let p = g?.['pattern'];
190
- let c = g?.['char'];
184
+ let p = g?.["pattern"];
185
+ let c = g?.["char"];
191
186
 
192
187
  if (p && c) {
193
- let r = '__' + new ID().toString() + '__';
188
+ let r = `__${new ID().toString()}__`;
194
189
  placeholder.set(r, c);
195
190
  command = command.replace(p, r);
196
191
  }
197
-
198
192
  }
199
- let parts = command.split(':');
193
+ let parts = command.split(":");
200
194
 
201
195
  parts = parts.map(function (value) {
202
196
  let v = value.trim();
@@ -204,11 +198,9 @@ function disassemble(command) {
204
198
  v = v.replace(k[0], k[1]);
205
199
  }
206
200
  return v;
207
-
208
-
209
201
  });
210
202
 
211
- return parts
203
+ return parts;
212
204
  }
213
205
 
214
206
  /**
@@ -219,12 +211,11 @@ function disassemble(command) {
219
211
  * @private
220
212
  */
221
213
  function convertToString(value) {
222
-
223
- if (isObject(value) && value.hasOwnProperty('toString')) {
214
+ if (isObject(value) && value.hasOwnProperty("toString")) {
224
215
  value = value.toString();
225
216
  }
226
217
 
227
- validateString(value)
218
+ validateString(value);
228
219
  return value;
229
220
  }
230
221
 
@@ -239,59 +230,56 @@ function convertToString(value) {
239
230
  * @throws {Error} missing key parameter
240
231
  */
241
232
  function transform(value) {
242
-
243
- const console = getGlobalObject('console');
233
+ const console = getGlobalObject("console");
244
234
 
245
235
  let args = clone(this.args);
246
- let key, defaultValue;
236
+ let key;
237
+ let defaultValue;
247
238
 
248
239
  switch (this.command) {
240
+ case "static":
241
+ return this.args.join(":");
249
242
 
250
- case 'static':
251
- return this.args.join(':');
252
-
253
- case 'tolower':
254
- case 'strtolower':
255
- case 'tolowercase':
256
- validateString(value)
243
+ case "tolower":
244
+ case "strtolower":
245
+ case "tolowercase":
246
+ validateString(value);
257
247
  return value.toLowerCase();
258
248
 
259
- case 'toupper':
260
- case 'strtoupper':
261
- case 'touppercase':
262
- validateString(value)
249
+ case "toupper":
250
+ case "strtoupper":
251
+ case "touppercase":
252
+ validateString(value);
263
253
  return value.toUpperCase();
264
254
 
265
- case 'tostring':
266
- return "" + value;
255
+ case "tostring":
256
+ return `${value}`;
267
257
 
268
- case 'tointeger':
258
+ case "tointeger":
269
259
  let n = parseInt(value);
270
260
  validateInteger(n);
271
- return n
261
+ return n;
272
262
 
273
- case 'tojson':
263
+ case "tojson":
274
264
  return JSON.stringify(value);
275
265
 
276
- case 'fromjson':
266
+ case "fromjson":
277
267
  return JSON.parse(value);
278
268
 
279
- case 'trim':
280
- validateString(value)
269
+ case "trim":
270
+ validateString(value);
281
271
  return value.trim();
282
272
 
283
- case 'rawurlencode':
284
- validateString(value)
273
+ case "rawurlencode":
274
+ validateString(value);
285
275
  return encodeURIComponent(value)
286
- .replace(/!/g, '%21')
287
- .replace(/'/g, '%27')
288
- .replace(/\(/g, '%28')
289
- .replace(/\)/g, '%29')
290
- .replace(/\*/g, '%2A');
291
-
292
-
293
- case 'call':
276
+ .replace(/!/g, "%21")
277
+ .replace(/'/g, "%27")
278
+ .replace(/\(/g, "%28")
279
+ .replace(/\)/g, "%29")
280
+ .replace(/\*/g, "%2A");
294
281
 
282
+ case "call":
295
283
  /**
296
284
  * callback-definition
297
285
  * function callback(value, ...args) {
@@ -307,9 +295,9 @@ function transform(value) {
307
295
  callback = value[callbackName];
308
296
  } else if (this.callbacks.has(callbackName)) {
309
297
  let s = this.callbacks.get(callbackName);
310
- callback = s?.['callback'];
311
- context = s?.['context'];
312
- } else if (typeof window === 'object' && window.hasOwnProperty(callbackName)) {
298
+ callback = s?.["callback"];
299
+ context = s?.["context"];
300
+ } else if (typeof window === "object" && window.hasOwnProperty(callbackName)) {
313
301
  callback = window[callbackName];
314
302
  }
315
303
  validateFunction(callback);
@@ -317,119 +305,117 @@ function transform(value) {
317
305
  args.unshift(value);
318
306
  return callback.call(context, ...args);
319
307
 
320
- case 'plain':
321
- case 'plaintext':
308
+ case "plain":
309
+ case "plaintext":
322
310
  validateString(value);
323
- let doc = new DOMParser().parseFromString(value, 'text/html');
311
+ let doc = new DOMParser().parseFromString(value, "text/html");
324
312
  return doc.body.textContent || "";
325
313
 
326
- case 'if':
327
- case '?':
328
-
314
+ case "if":
315
+ case "?":
329
316
  validatePrimitive(value);
330
317
 
331
- let trueStatement = (args.shift() || undefined);
332
- let falseStatement = (args.shift() || undefined);
318
+ let trueStatement = args.shift() || undefined;
319
+ let falseStatement = args.shift() || undefined;
333
320
 
334
- if (trueStatement === 'value') {
321
+ if (trueStatement === "value") {
335
322
  trueStatement = value;
336
323
  }
337
- if (trueStatement === '\\value') {
338
- trueStatement = 'value';
324
+ if (trueStatement === "\\value") {
325
+ trueStatement = "value";
339
326
  }
340
- if (falseStatement === 'value') {
327
+ if (falseStatement === "value") {
341
328
  falseStatement = value;
342
329
  }
343
- if (falseStatement === '\\value') {
344
- falseStatement = 'value';
330
+ if (falseStatement === "\\value") {
331
+ falseStatement = "value";
345
332
  }
346
333
 
347
- let condition = ((value !== undefined && value !== '' && value !== 'off' && value !== 'false' && value !== false) || value === 'on' || value === 'true' || value === true);
334
+ let condition =
335
+ (value !== undefined && value !== "" && value !== "off" && value !== "false" && value !== false) ||
336
+ value === "on" ||
337
+ value === "true" ||
338
+ value === true;
348
339
  return condition ? trueStatement : falseStatement;
349
340
 
350
-
351
- case 'ucfirst':
341
+ case "ucfirst":
352
342
  validateString(value);
353
343
 
354
344
  let firstchar = value.charAt(0).toUpperCase();
355
345
  return firstchar + value.substr(1);
356
- case 'ucwords':
346
+ case "ucwords":
357
347
  validateString(value);
358
348
 
359
349
  return value.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function (v) {
360
350
  return v.toUpperCase();
361
351
  });
362
352
 
363
- case 'count':
364
- case 'length':
365
-
366
- if ((isString(value) || isObject(value) || isArray(value)) && value.hasOwnProperty('length')) {
353
+ case "count":
354
+ case "length":
355
+ if ((isString(value) || isObject(value) || isArray(value)) && value.hasOwnProperty("length")) {
367
356
  return value.length;
368
357
  }
369
358
 
370
- throw new TypeError("unsupported type " + typeof value);
359
+ throw new TypeError(`unsupported type ${typeof value}`);
371
360
 
372
- case 'to-base64':
373
- case 'btoa':
374
- case 'base64':
361
+ case "to-base64":
362
+ case "btoa":
363
+ case "base64":
375
364
  return btoa(convertToString(value));
376
365
 
377
- case 'atob':
378
- case 'from-base64':
366
+ case "atob":
367
+ case "from-base64":
379
368
  return atob(convertToString(value));
380
369
 
381
- case 'empty':
382
- return '';
370
+ case "empty":
371
+ return "";
383
372
 
384
- case 'undefined':
373
+ case "undefined":
385
374
  return undefined;
386
375
 
387
- case 'debug':
388
-
376
+ case "debug":
389
377
  if (isObject(console)) {
390
378
  console.log(value);
391
379
  }
392
380
 
393
381
  return value;
394
382
 
395
- case 'prefix':
383
+ case "prefix":
396
384
  validateString(value);
397
385
  let prefix = args?.[0];
398
386
  return prefix + value;
399
387
 
400
- case 'suffix':
388
+ case "suffix":
401
389
  validateString(value);
402
390
  let suffix = args?.[0];
403
391
  return value + suffix;
404
392
 
405
- case 'uniqid':
406
- return (new ID()).toString();
407
-
408
- case 'first-key':
409
- case 'last-key':
410
- case 'nth-last-key':
411
- case 'nth-key':
393
+ case "uniqid":
394
+ return new ID().toString();
412
395
 
396
+ case "first-key":
397
+ case "last-key":
398
+ case "nth-last-key":
399
+ case "nth-key":
413
400
  if (!isObject(value)) {
414
- throw new Error("type not supported")
401
+ throw new Error("type not supported");
415
402
  }
416
403
 
417
- const keys = Object.keys(value).sort()
404
+ const keys = Object.keys(value).sort();
418
405
 
419
- if (this.command === 'first-key') {
406
+ if (this.command === "first-key") {
420
407
  key = 0;
421
- } else if (this.command === 'last-key') {
408
+ } else if (this.command === "last-key") {
422
409
  key = keys.length - 1;
423
410
  } else {
424
-
425
411
  key = validateInteger(parseInt(args.shift()));
426
412
 
427
- if (this.command === 'nth-last-key') {
413
+ if (this.command === "nth-last-key") {
428
414
  key = keys.length - key - 1;
429
415
  }
430
416
  }
431
417
 
432
- defaultValue = (args.shift() || '');
418
+ defaultValue = args.shift() || "";
433
419
 
434
420
  let useKey = keys?.[key];
435
421
 
@@ -439,18 +425,16 @@ function transform(value) {
439
425
 
440
426
  return defaultValue;
441
427
 
442
-
443
- case 'key':
444
- case 'property':
445
- case 'index':
446
-
428
+ case "key":
429
+ case "property":
430
+ case "index":
447
431
  key = args.shift() || undefined;
448
432
 
449
433
  if (key === undefined) {
450
- throw new Error("missing key parameter")
434
+ throw new Error("missing key parameter");
451
435
  }
452
436
 
453
- defaultValue = (args.shift() || undefined);
437
+ defaultValue = args.shift() || undefined;
454
438
 
455
439
  if (value instanceof Map) {
456
440
  if (!value.has(key)) {
@@ -460,7 +444,6 @@ function transform(value) {
460
444
  }
461
445
 
462
446
  if (isObject(value) || isArray(value)) {
463
-
464
447
  if (value?.[key]) {
465
448
  return value?.[key];
466
449
  }
@@ -468,22 +451,20 @@ function transform(value) {
468
451
  return defaultValue;
469
452
  }
470
453
 
471
- throw new Error("type not supported")
472
-
473
- case 'path-exists':
454
+ throw new Error("type not supported");
474
455
 
456
+ case "path-exists":
475
457
  key = args.shift();
476
458
  if (key === undefined) {
477
- throw new Error("missing key parameter")
459
+ throw new Error("missing key parameter");
478
460
  }
479
461
 
480
462
  return new Pathfinder(value).exists(key);
481
463
 
482
- case 'path':
483
-
464
+ case "path":
484
465
  key = args.shift();
485
466
  if (key === undefined) {
486
- throw new Error("missing key parameter")
467
+ throw new Error("missing key parameter");
487
468
  }
488
469
 
489
470
  let pf = new Pathfinder(value);
@@ -494,9 +475,7 @@ function transform(value) {
494
475
 
495
476
  return pf.getVia(key);
496
477
 
497
-
498
- case 'substring':
499
-
478
+ case "substring":
500
479
  validateString(value);
501
480
 
502
481
  let start = parseInt(args[0]) || 0;
@@ -504,11 +483,11 @@ function transform(value) {
504
483
 
505
484
  return value.substring(start, end);
506
485
 
507
- case 'nop':
486
+ case "nop":
508
487
  return value;
509
488
 
510
- case '??':
511
- case 'default':
489
+ case "??":
490
+ case "default":
512
491
  if (value !== undefined && value !== null) {
513
492
  return value;
514
493
  }
@@ -516,34 +495,39 @@ function transform(value) {
516
495
  defaultValue = args.shift();
517
496
  let defaultType = args.shift();
518
497
  if (defaultType === undefined) {
519
- defaultType = 'string';
498
+ defaultType = "string";
520
499
  }
521
500
 
522
501
  switch (defaultType) {
523
- case 'int':
524
- case 'integer':
502
+ case "int":
503
+ case "integer":
525
504
  return parseInt(defaultValue);
526
- case 'float':
505
+ case "float":
527
506
  return parseFloat(defaultValue);
528
- case 'undefined':
529
- return undefined
530
- case 'bool':
531
- case 'boolean':
532
- defaultValue = defaultValue.toLowerCase()
533
- return ((defaultValue !== 'undefined' && defaultValue !== '' && defaultValue !== 'off' && defaultValue !== 'false' && defaultValue !== 'false') || defaultValue === 'on' || defaultValue === 'true' || defaultValue === 'true');
534
- case 'string':
535
- return "" + defaultValue;
507
+ case "undefined":
508
+ return undefined;
509
+ case "bool":
510
+ case "boolean":
511
+ defaultValue = defaultValue.toLowerCase();
512
+ return (
513
+ (defaultValue !== "undefined" &&
514
+ defaultValue !== "" &&
515
+ defaultValue !== "off" &&
516
+ defaultValue !== "false" &&
517
+ defaultValue !== "false") ||
518
+ defaultValue === "on" ||
519
+ defaultValue === "true" ||
520
+ defaultValue === "true"
521
+ );
522
+ case "string":
523
+ return `${defaultValue}`;
536
524
  case "object":
537
525
  return JSON.parse(atob(defaultValue));
538
526
  }
539
527
 
540
- throw new Error("type not supported")
541
-
528
+ throw new Error("type not supported");
542
529
 
543
530
  default:
544
- throw new Error("unknown command " + this.command)
531
+ throw new Error(`unknown command ${this.command}`);
545
532
  }
546
-
547
- return value;
548
533
  }
549
-
@@ -5,12 +5,12 @@
5
5
  * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
6
6
  */
7
7
 
8
- import {Base} from '../types/base.mjs';
9
- import {getGlobalFunction} from "../types/global.mjs";
10
- import {ProxyObserver} from "../types/proxyobserver.mjs";
11
- import {validateInstance, validateString} from "../types/validate.mjs";
8
+ import { Base } from "../types/base.mjs";
9
+ import { getGlobalFunction } from "../types/global.mjs";
10
+ import { ProxyObserver } from "../types/proxyobserver.mjs";
11
+ import { validateInstance, validateString } from "../types/validate.mjs";
12
12
 
13
- export {ATTRIBUTEPREFIX,Assembler}
13
+ export { ATTRIBUTEPREFIX, Assembler };
14
14
 
15
15
  /**
16
16
  * attribute prefix
@@ -30,7 +30,6 @@ const ATTRIBUTEPREFIX = "data-monster-";
30
30
  * @summary Allows you to build an html fragment
31
31
  */
32
32
  class Assembler extends Base {
33
-
34
33
  /**
35
34
  * @param {DocumentFragment} fragment
36
35
  * @throws {TypeError} value is not an instance of
@@ -40,7 +39,7 @@ class Assembler extends Base {
40
39
  constructor(fragment) {
41
40
  super();
42
41
  this.attributePrefix = ATTRIBUTEPREFIX;
43
- validateInstance(fragment, getGlobalFunction('DocumentFragment'));
42
+ validateInstance(fragment, getGlobalFunction("DocumentFragment"));
44
43
  this.fragment = fragment;
45
44
  }
46
45
 
@@ -71,7 +70,6 @@ class Assembler extends Base {
71
70
  * @throws {TypeError} value is not an instance of
72
71
  */
73
72
  createDocumentFragment(data) {
74
-
75
73
  if (data === undefined) {
76
74
  data = new ProxyObserver({});
77
75
  }
@@ -80,5 +78,4 @@ class Assembler extends Base {
80
78
  let fragment = this.fragment.cloneNode(true);
81
79
  return fragment;
82
80
  }
83
-
84
81
  }