1 | (() => {
|
2 | var __webpack_modules__ = ({
|
3 |
|
4 | "./node_modules/assertion-error/index.js":
|
5 |
|
6 |
|
7 |
|
8 | ((module) => {
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function exclude () {
|
26 | var excludes = [].slice.call(arguments);
|
27 |
|
28 | function excludeProps (res, obj) {
|
29 | Object.keys(obj).forEach(function (key) {
|
30 | if (!~excludes.indexOf(key)) res[key] = obj[key];
|
31 | });
|
32 | }
|
33 |
|
34 | return function extendExclude () {
|
35 | var args = [].slice.call(arguments)
|
36 | , i = 0
|
37 | , res = {};
|
38 |
|
39 | for (; i < args.length; i++) {
|
40 | excludeProps(res, args[i]);
|
41 | }
|
42 |
|
43 | return res;
|
44 | };
|
45 | };
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | module.exports = AssertionError;
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | function AssertionError (message, _props, ssf) {
|
65 | var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
66 | , props = extend(_props || {});
|
67 |
|
68 |
|
69 | this.message = message || 'Unspecified AssertionError';
|
70 | this.showDiff = false;
|
71 |
|
72 |
|
73 | for (var key in props) {
|
74 | this[key] = props[key];
|
75 | }
|
76 |
|
77 |
|
78 | ssf = ssf || AssertionError;
|
79 | if (Error.captureStackTrace) {
|
80 | Error.captureStackTrace(this, ssf);
|
81 | } else {
|
82 | try {
|
83 | throw new Error();
|
84 | } catch(e) {
|
85 | this.stack = e.stack;
|
86 | }
|
87 | }
|
88 | }
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | AssertionError.prototype = Object.create(Error.prototype);
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | AssertionError.prototype.name = 'AssertionError';
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | AssertionError.prototype.constructor = AssertionError;
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | AssertionError.prototype.toJSON = function (stack) {
|
116 | var extend = exclude('constructor', 'toJSON', 'stack')
|
117 | , props = extend({ name: this.name }, this);
|
118 |
|
119 |
|
120 | if (false !== stack && this.stack) {
|
121 | props.stack = this.stack;
|
122 | }
|
123 |
|
124 | return props;
|
125 | };
|
126 |
|
127 |
|
128 | }),
|
129 |
|
130 | "./node_modules/call-bind/callBound.js":
|
131 |
|
132 |
|
133 |
|
134 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
135 |
|
136 | "use strict";
|
137 |
|
138 |
|
139 | var GetIntrinsic = __webpack_require__( "./node_modules/get-intrinsic/index.js");
|
140 |
|
141 | var callBind = __webpack_require__( "./node_modules/call-bind/index.js");
|
142 |
|
143 | var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
144 |
|
145 | module.exports = function callBoundIntrinsic(name, allowMissing) {
|
146 | var intrinsic = GetIntrinsic(name, !!allowMissing);
|
147 | if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
148 | return callBind(intrinsic);
|
149 | }
|
150 | return intrinsic;
|
151 | };
|
152 |
|
153 |
|
154 | }),
|
155 |
|
156 | "./node_modules/call-bind/index.js":
|
157 |
|
158 |
|
159 |
|
160 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
161 |
|
162 | "use strict";
|
163 |
|
164 |
|
165 | var bind = __webpack_require__( "./node_modules/function-bind/index.js");
|
166 | var GetIntrinsic = __webpack_require__( "./node_modules/get-intrinsic/index.js");
|
167 |
|
168 | var $apply = GetIntrinsic('%Function.prototype.apply%');
|
169 | var $call = GetIntrinsic('%Function.prototype.call%');
|
170 | var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
171 |
|
172 | var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
173 | var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
174 | var $max = GetIntrinsic('%Math.max%');
|
175 |
|
176 | if ($defineProperty) {
|
177 | try {
|
178 | $defineProperty({}, 'a', { value: 1 });
|
179 | } catch (e) {
|
180 |
|
181 | $defineProperty = null;
|
182 | }
|
183 | }
|
184 |
|
185 | module.exports = function callBind(originalFunction) {
|
186 | var func = $reflectApply(bind, $call, arguments);
|
187 | if ($gOPD && $defineProperty) {
|
188 | var desc = $gOPD(func, 'length');
|
189 | if (desc.configurable) {
|
190 |
|
191 | $defineProperty(
|
192 | func,
|
193 | 'length',
|
194 | { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
195 | );
|
196 | }
|
197 | }
|
198 | return func;
|
199 | };
|
200 |
|
201 | var applyBind = function applyBind() {
|
202 | return $reflectApply(bind, $apply, arguments);
|
203 | };
|
204 |
|
205 | if ($defineProperty) {
|
206 | $defineProperty(module.exports, 'apply', { value: applyBind });
|
207 | } else {
|
208 | module.exports.apply = applyBind;
|
209 | }
|
210 |
|
211 |
|
212 | }),
|
213 |
|
214 | "./node_modules/chai/index.js":
|
215 |
|
216 |
|
217 |
|
218 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
219 |
|
220 | module.exports = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
221 |
|
222 |
|
223 | }),
|
224 |
|
225 | "./node_modules/chai/lib/chai.js":
|
226 |
|
227 |
|
228 |
|
229 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 | var used = [];
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 | exports.version = '4.3.3';
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 | exports.AssertionError = __webpack_require__( "./node_modules/assertion-error/index.js");
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 | var util = __webpack_require__( "./node_modules/chai/lib/chai/utils/index.js");
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 | exports.use = function (fn) {
|
268 | if (!~used.indexOf(fn)) {
|
269 | fn(exports, util);
|
270 | used.push(fn);
|
271 | }
|
272 |
|
273 | return exports;
|
274 | };
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 | exports.util = util;
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
287 | exports.config = config;
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 | var assertion = __webpack_require__( "./node_modules/chai/lib/chai/assertion.js");
|
294 | exports.use(assertion);
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 | var core = __webpack_require__( "./node_modules/chai/lib/chai/core/assertions.js");
|
301 | exports.use(core);
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 | var expect = __webpack_require__( "./node_modules/chai/lib/chai/interface/expect.js");
|
308 | exports.use(expect);
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 | var should = __webpack_require__( "./node_modules/chai/lib/chai/interface/should.js");
|
315 | exports.use(should);
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 | var assert = __webpack_require__( "./node_modules/chai/lib/chai/interface/assert.js");
|
322 | exports.use(assert);
|
323 |
|
324 |
|
325 | }),
|
326 |
|
327 | "./node_modules/chai/lib/chai/assertion.js":
|
328 |
|
329 |
|
330 |
|
331 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
341 |
|
342 | module.exports = function (_chai, util) {
|
343 | |
344 |
|
345 |
|
346 |
|
347 | var AssertionError = _chai.AssertionError
|
348 | , flag = util.flag;
|
349 |
|
350 | |
351 |
|
352 |
|
353 |
|
354 | _chai.Assertion = Assertion;
|
355 |
|
356 | |
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 | function Assertion (obj, msg, ssfi, lockSsfi) {
|
395 | flag(this, 'ssfi', ssfi || Assertion);
|
396 | flag(this, 'lockSsfi', lockSsfi);
|
397 | flag(this, 'object', obj);
|
398 | flag(this, 'message', msg);
|
399 |
|
400 | return util.proxify(this);
|
401 | }
|
402 |
|
403 | Object.defineProperty(Assertion, 'includeStack', {
|
404 | get: function() {
|
405 | console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
406 | return config.includeStack;
|
407 | },
|
408 | set: function(value) {
|
409 | console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
410 | config.includeStack = value;
|
411 | }
|
412 | });
|
413 |
|
414 | Object.defineProperty(Assertion, 'showDiff', {
|
415 | get: function() {
|
416 | console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
417 | return config.showDiff;
|
418 | },
|
419 | set: function(value) {
|
420 | console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
421 | config.showDiff = value;
|
422 | }
|
423 | });
|
424 |
|
425 | Assertion.addProperty = function (name, fn) {
|
426 | util.addProperty(this.prototype, name, fn);
|
427 | };
|
428 |
|
429 | Assertion.addMethod = function (name, fn) {
|
430 | util.addMethod(this.prototype, name, fn);
|
431 | };
|
432 |
|
433 | Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
434 | util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
435 | };
|
436 |
|
437 | Assertion.overwriteProperty = function (name, fn) {
|
438 | util.overwriteProperty(this.prototype, name, fn);
|
439 | };
|
440 |
|
441 | Assertion.overwriteMethod = function (name, fn) {
|
442 | util.overwriteMethod(this.prototype, name, fn);
|
443 | };
|
444 |
|
445 | Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
446 | util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
447 | };
|
448 |
|
449 | |
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
465 | var ok = util.test(this, arguments);
|
466 | if (false !== showDiff) showDiff = true;
|
467 | if (undefined === expected && undefined === _actual) showDiff = false;
|
468 | if (true !== config.showDiff) showDiff = false;
|
469 |
|
470 | if (!ok) {
|
471 | msg = util.getMessage(this, arguments);
|
472 | var actual = util.getActual(this, arguments);
|
473 | var assertionErrorObjectProperties = {
|
474 | actual: actual
|
475 | , expected: expected
|
476 | , showDiff: showDiff
|
477 | };
|
478 |
|
479 | var operator = util.getOperator(this, arguments);
|
480 | if (operator) {
|
481 | assertionErrorObjectProperties.operator = operator;
|
482 | }
|
483 |
|
484 | throw new AssertionError(
|
485 | msg,
|
486 | assertionErrorObjectProperties,
|
487 | (config.includeStack) ? this.assert : flag(this, 'ssfi'));
|
488 | }
|
489 | };
|
490 |
|
491 | |
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 | Object.defineProperty(Assertion.prototype, '_obj',
|
500 | { get: function () {
|
501 | return flag(this, 'object');
|
502 | }
|
503 | , set: function (val) {
|
504 | flag(this, 'object', val);
|
505 | }
|
506 | });
|
507 | };
|
508 |
|
509 |
|
510 | }),
|
511 |
|
512 | "./node_modules/chai/lib/chai/config.js":
|
513 |
|
514 |
|
515 |
|
516 | ((module) => {
|
517 |
|
518 | module.exports = {
|
519 |
|
520 | |
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | includeStack: false,
|
534 |
|
535 | |
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 | showDiff: true,
|
549 |
|
550 | |
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 | truncateThreshold: 40,
|
571 |
|
572 | |
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 | useProxy: true,
|
591 |
|
592 | |
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 | proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON']
|
611 | };
|
612 |
|
613 |
|
614 | }),
|
615 |
|
616 | "./node_modules/chai/lib/chai/core/assertions.js":
|
617 |
|
618 |
|
619 |
|
620 | ((module) => {
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 | module.exports = function (chai, _) {
|
630 | var Assertion = chai.Assertion
|
631 | , AssertionError = chai.AssertionError
|
632 | , flag = _.flag;
|
633 |
|
634 | |
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 | [ 'to', 'be', 'been', 'is'
|
666 | , 'and', 'has', 'have', 'with'
|
667 | , 'that', 'which', 'at', 'of'
|
668 | , 'same', 'but', 'does', 'still', "also" ].forEach(function (chain) {
|
669 | Assertion.addProperty(chain);
|
670 | });
|
671 |
|
672 | |
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 | Assertion.addProperty('not', function () {
|
696 | flag(this, 'negate', true);
|
697 | });
|
698 |
|
699 | |
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | Assertion.addProperty('deep', function () {
|
737 | flag(this, 'deep', true);
|
738 | });
|
739 |
|
740 | |
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 | Assertion.addProperty('nested', function () {
|
763 | flag(this, 'nested', true);
|
764 | });
|
765 |
|
766 | |
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 | Assertion.addProperty('own', function () {
|
789 | flag(this, 'own', true);
|
790 | });
|
791 |
|
792 | |
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 | Assertion.addProperty('ordered', function () {
|
813 | flag(this, 'ordered', true);
|
814 | });
|
815 |
|
816 | |
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 | Assertion.addProperty('any', function () {
|
833 | flag(this, 'any', true);
|
834 | flag(this, 'all', false);
|
835 | });
|
836 |
|
837 | |
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 | Assertion.addProperty('all', function () {
|
858 | flag(this, 'all', true);
|
859 | flag(this, 'any', false);
|
860 | });
|
861 |
|
862 | |
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 | function an (type, msg) {
|
923 | if (msg) flag(this, 'message', msg);
|
924 | type = type.toLowerCase();
|
925 | var obj = flag(this, 'object')
|
926 | , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a ';
|
927 |
|
928 | this.assert(
|
929 | type === _.type(obj).toLowerCase()
|
930 | , 'expected #{this} to be ' + article + type
|
931 | , 'expected #{this} not to be ' + article + type
|
932 | );
|
933 | }
|
934 |
|
935 | Assertion.addChainableMethod('an', an);
|
936 | Assertion.addChainableMethod('a', an);
|
937 |
|
938 | |
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 | function SameValueZero(a, b) {
|
1086 | return (_.isNaN(a) && _.isNaN(b)) || a === b;
|
1087 | }
|
1088 |
|
1089 | function includeChainingBehavior () {
|
1090 | flag(this, 'contains', true);
|
1091 | }
|
1092 |
|
1093 | function include (val, msg) {
|
1094 | if (msg) flag(this, 'message', msg);
|
1095 |
|
1096 | var obj = flag(this, 'object')
|
1097 | , objType = _.type(obj).toLowerCase()
|
1098 | , flagMsg = flag(this, 'message')
|
1099 | , negate = flag(this, 'negate')
|
1100 | , ssfi = flag(this, 'ssfi')
|
1101 | , isDeep = flag(this, 'deep')
|
1102 | , descriptor = isDeep ? 'deep ' : '';
|
1103 |
|
1104 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
1105 |
|
1106 | var included = false;
|
1107 |
|
1108 | switch (objType) {
|
1109 | case 'string':
|
1110 | included = obj.indexOf(val) !== -1;
|
1111 | break;
|
1112 |
|
1113 | case 'weakset':
|
1114 | if (isDeep) {
|
1115 | throw new AssertionError(
|
1116 | flagMsg + 'unable to use .deep.include with WeakSet',
|
1117 | undefined,
|
1118 | ssfi
|
1119 | );
|
1120 | }
|
1121 |
|
1122 | included = obj.has(val);
|
1123 | break;
|
1124 |
|
1125 | case 'map':
|
1126 | var isEql = isDeep ? _.eql : SameValueZero;
|
1127 | obj.forEach(function (item) {
|
1128 | included = included || isEql(item, val);
|
1129 | });
|
1130 | break;
|
1131 |
|
1132 | case 'set':
|
1133 | if (isDeep) {
|
1134 | obj.forEach(function (item) {
|
1135 | included = included || _.eql(item, val);
|
1136 | });
|
1137 | } else {
|
1138 | included = obj.has(val);
|
1139 | }
|
1140 | break;
|
1141 |
|
1142 | case 'array':
|
1143 | if (isDeep) {
|
1144 | included = obj.some(function (item) {
|
1145 | return _.eql(item, val);
|
1146 | })
|
1147 | } else {
|
1148 | included = obj.indexOf(val) !== -1;
|
1149 | }
|
1150 | break;
|
1151 |
|
1152 | default:
|
1153 |
|
1154 |
|
1155 |
|
1156 | if (val !== Object(val)) {
|
1157 | throw new AssertionError(
|
1158 | flagMsg + 'the given combination of arguments ('
|
1159 | + objType + ' and '
|
1160 | + _.type(val).toLowerCase() + ')'
|
1161 | + ' is invalid for this assertion. '
|
1162 | + 'You can use an array, a map, an object, a set, a string, '
|
1163 | + 'or a weakset instead of a '
|
1164 | + _.type(val).toLowerCase(),
|
1165 | undefined,
|
1166 | ssfi
|
1167 | );
|
1168 | }
|
1169 |
|
1170 | var props = Object.keys(val)
|
1171 | , firstErr = null
|
1172 | , numErrs = 0;
|
1173 |
|
1174 | props.forEach(function (prop) {
|
1175 | var propAssertion = new Assertion(obj);
|
1176 | _.transferFlags(this, propAssertion, true);
|
1177 | flag(propAssertion, 'lockSsfi', true);
|
1178 |
|
1179 | if (!negate || props.length === 1) {
|
1180 | propAssertion.property(prop, val[prop]);
|
1181 | return;
|
1182 | }
|
1183 |
|
1184 | try {
|
1185 | propAssertion.property(prop, val[prop]);
|
1186 | } catch (err) {
|
1187 | if (!_.checkError.compatibleConstructor(err, AssertionError)) {
|
1188 | throw err;
|
1189 | }
|
1190 | if (firstErr === null) firstErr = err;
|
1191 | numErrs++;
|
1192 | }
|
1193 | }, this);
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | if (negate && props.length > 1 && numErrs === props.length) {
|
1200 | throw firstErr;
|
1201 | }
|
1202 | return;
|
1203 | }
|
1204 |
|
1205 |
|
1206 | this.assert(
|
1207 | included
|
1208 | , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val)
|
1209 | , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val));
|
1210 | }
|
1211 |
|
1212 | Assertion.addChainableMethod('include', include, includeChainingBehavior);
|
1213 | Assertion.addChainableMethod('contain', include, includeChainingBehavior);
|
1214 | Assertion.addChainableMethod('contains', include, includeChainingBehavior);
|
1215 | Assertion.addChainableMethod('includes', include, includeChainingBehavior);
|
1216 |
|
1217 | |
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | Assertion.addProperty('ok', function () {
|
1254 | this.assert(
|
1255 | flag(this, 'object')
|
1256 | , 'expected #{this} to be truthy'
|
1257 | , 'expected #{this} to be falsy');
|
1258 | });
|
1259 |
|
1260 | |
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 | Assertion.addProperty('true', function () {
|
1287 | this.assert(
|
1288 | true === flag(this, 'object')
|
1289 | , 'expected #{this} to be true'
|
1290 | , 'expected #{this} to be false'
|
1291 | , flag(this, 'negate') ? false : true
|
1292 | );
|
1293 | });
|
1294 |
|
1295 | |
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 | Assertion.addProperty('false', function () {
|
1322 | this.assert(
|
1323 | false === flag(this, 'object')
|
1324 | , 'expected #{this} to be false'
|
1325 | , 'expected #{this} to be true'
|
1326 | , flag(this, 'negate') ? true : false
|
1327 | );
|
1328 | });
|
1329 |
|
1330 | |
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 | Assertion.addProperty('null', function () {
|
1354 | this.assert(
|
1355 | null === flag(this, 'object')
|
1356 | , 'expected #{this} to be null'
|
1357 | , 'expected #{this} not to be null'
|
1358 | );
|
1359 | });
|
1360 |
|
1361 | |
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 | Assertion.addProperty('undefined', function () {
|
1385 | this.assert(
|
1386 | undefined === flag(this, 'object')
|
1387 | , 'expected #{this} to be undefined'
|
1388 | , 'expected #{this} not to be undefined'
|
1389 | );
|
1390 | });
|
1391 |
|
1392 | |
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 | Assertion.addProperty('NaN', function () {
|
1416 | this.assert(
|
1417 | _.isNaN(flag(this, 'object'))
|
1418 | , 'expected #{this} to be NaN'
|
1419 | , 'expected #{this} not to be NaN'
|
1420 | );
|
1421 | });
|
1422 |
|
1423 | |
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 | function assertExist () {
|
1457 | var val = flag(this, 'object');
|
1458 | this.assert(
|
1459 | val !== null && val !== undefined
|
1460 | , 'expected #{this} to exist'
|
1461 | , 'expected #{this} to not exist'
|
1462 | );
|
1463 | }
|
1464 |
|
1465 | Assertion.addProperty('exist', assertExist);
|
1466 | Assertion.addProperty('exists', assertExist);
|
1467 |
|
1468 | |
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 | Assertion.addProperty('empty', function () {
|
1518 | var val = flag(this, 'object')
|
1519 | , ssfi = flag(this, 'ssfi')
|
1520 | , flagMsg = flag(this, 'message')
|
1521 | , itemsCount;
|
1522 |
|
1523 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
1524 |
|
1525 | switch (_.type(val).toLowerCase()) {
|
1526 | case 'array':
|
1527 | case 'string':
|
1528 | itemsCount = val.length;
|
1529 | break;
|
1530 | case 'map':
|
1531 | case 'set':
|
1532 | itemsCount = val.size;
|
1533 | break;
|
1534 | case 'weakmap':
|
1535 | case 'weakset':
|
1536 | throw new AssertionError(
|
1537 | flagMsg + '.empty was passed a weak collection',
|
1538 | undefined,
|
1539 | ssfi
|
1540 | );
|
1541 | case 'function':
|
1542 | var msg = flagMsg + '.empty was passed a function ' + _.getName(val);
|
1543 | throw new AssertionError(msg.trim(), undefined, ssfi);
|
1544 | default:
|
1545 | if (val !== Object(val)) {
|
1546 | throw new AssertionError(
|
1547 | flagMsg + '.empty was passed non-string primitive ' + _.inspect(val),
|
1548 | undefined,
|
1549 | ssfi
|
1550 | );
|
1551 | }
|
1552 | itemsCount = Object.keys(val).length;
|
1553 | }
|
1554 |
|
1555 | this.assert(
|
1556 | 0 === itemsCount
|
1557 | , 'expected #{this} to be empty'
|
1558 | , 'expected #{this} not to be empty'
|
1559 | );
|
1560 | });
|
1561 |
|
1562 | |
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 | function checkArguments () {
|
1593 | var obj = flag(this, 'object')
|
1594 | , type = _.type(obj);
|
1595 | this.assert(
|
1596 | 'Arguments' === type
|
1597 | , 'expected #{this} to be arguments but got ' + type
|
1598 | , 'expected #{this} to not be arguments'
|
1599 | );
|
1600 | }
|
1601 |
|
1602 | Assertion.addProperty('arguments', checkArguments);
|
1603 | Assertion.addProperty('Arguments', checkArguments);
|
1604 |
|
1605 | |
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 | function assertEqual (val, msg) {
|
1651 | if (msg) flag(this, 'message', msg);
|
1652 | var obj = flag(this, 'object');
|
1653 | if (flag(this, 'deep')) {
|
1654 | var prevLockSsfi = flag(this, 'lockSsfi');
|
1655 | flag(this, 'lockSsfi', true);
|
1656 | this.eql(val);
|
1657 | flag(this, 'lockSsfi', prevLockSsfi);
|
1658 | } else {
|
1659 | this.assert(
|
1660 | val === obj
|
1661 | , 'expected #{this} to equal #{exp}'
|
1662 | , 'expected #{this} to not equal #{exp}'
|
1663 | , val
|
1664 | , this._obj
|
1665 | , true
|
1666 | );
|
1667 | }
|
1668 | }
|
1669 |
|
1670 | Assertion.addMethod('equal', assertEqual);
|
1671 | Assertion.addMethod('equals', assertEqual);
|
1672 | Assertion.addMethod('eq', assertEqual);
|
1673 |
|
1674 | |
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 | function assertEql(obj, msg) {
|
1716 | if (msg) flag(this, 'message', msg);
|
1717 | this.assert(
|
1718 | _.eql(obj, flag(this, 'object'))
|
1719 | , 'expected #{this} to deeply equal #{exp}'
|
1720 | , 'expected #{this} to not deeply equal #{exp}'
|
1721 | , obj
|
1722 | , this._obj
|
1723 | , true
|
1724 | );
|
1725 | }
|
1726 |
|
1727 | Assertion.addMethod('eql', assertEql);
|
1728 | Assertion.addMethod('eqls', assertEql);
|
1729 |
|
1730 | |
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 | function assertAbove (n, msg) {
|
1774 | if (msg) flag(this, 'message', msg);
|
1775 | var obj = flag(this, 'object')
|
1776 | , doLength = flag(this, 'doLength')
|
1777 | , flagMsg = flag(this, 'message')
|
1778 | , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
|
1779 | , ssfi = flag(this, 'ssfi')
|
1780 | , objType = _.type(obj).toLowerCase()
|
1781 | , nType = _.type(n).toLowerCase()
|
1782 | , errorMessage
|
1783 | , shouldThrow = true;
|
1784 |
|
1785 | if (doLength && objType !== 'map' && objType !== 'set') {
|
1786 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
1787 | }
|
1788 |
|
1789 | if (!doLength && (objType === 'date' && nType !== 'date')) {
|
1790 | errorMessage = msgPrefix + 'the argument to above must be a date';
|
1791 | } else if (nType !== 'number' && (doLength || objType === 'number')) {
|
1792 | errorMessage = msgPrefix + 'the argument to above must be a number';
|
1793 | } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
|
1794 | var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
|
1795 | errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
|
1796 | } else {
|
1797 | shouldThrow = false;
|
1798 | }
|
1799 |
|
1800 | if (shouldThrow) {
|
1801 | throw new AssertionError(errorMessage, undefined, ssfi);
|
1802 | }
|
1803 |
|
1804 | if (doLength) {
|
1805 | var descriptor = 'length'
|
1806 | , itemsCount;
|
1807 | if (objType === 'map' || objType === 'set') {
|
1808 | descriptor = 'size';
|
1809 | itemsCount = obj.size;
|
1810 | } else {
|
1811 | itemsCount = obj.length;
|
1812 | }
|
1813 | this.assert(
|
1814 | itemsCount > n
|
1815 | , 'expected #{this} to have a ' + descriptor + ' above #{exp} but got #{act}'
|
1816 | , 'expected #{this} to not have a ' + descriptor + ' above #{exp}'
|
1817 | , n
|
1818 | , itemsCount
|
1819 | );
|
1820 | } else {
|
1821 | this.assert(
|
1822 | obj > n
|
1823 | , 'expected #{this} to be above #{exp}'
|
1824 | , 'expected #{this} to be at most #{exp}'
|
1825 | , n
|
1826 | );
|
1827 | }
|
1828 | }
|
1829 |
|
1830 | Assertion.addMethod('above', assertAbove);
|
1831 | Assertion.addMethod('gt', assertAbove);
|
1832 | Assertion.addMethod('greaterThan', assertAbove);
|
1833 |
|
1834 | |
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 | function assertLeast (n, msg) {
|
1879 | if (msg) flag(this, 'message', msg);
|
1880 | var obj = flag(this, 'object')
|
1881 | , doLength = flag(this, 'doLength')
|
1882 | , flagMsg = flag(this, 'message')
|
1883 | , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
|
1884 | , ssfi = flag(this, 'ssfi')
|
1885 | , objType = _.type(obj).toLowerCase()
|
1886 | , nType = _.type(n).toLowerCase()
|
1887 | , errorMessage
|
1888 | , shouldThrow = true;
|
1889 |
|
1890 | if (doLength && objType !== 'map' && objType !== 'set') {
|
1891 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
1892 | }
|
1893 |
|
1894 | if (!doLength && (objType === 'date' && nType !== 'date')) {
|
1895 | errorMessage = msgPrefix + 'the argument to least must be a date';
|
1896 | } else if (nType !== 'number' && (doLength || objType === 'number')) {
|
1897 | errorMessage = msgPrefix + 'the argument to least must be a number';
|
1898 | } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
|
1899 | var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
|
1900 | errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
|
1901 | } else {
|
1902 | shouldThrow = false;
|
1903 | }
|
1904 |
|
1905 | if (shouldThrow) {
|
1906 | throw new AssertionError(errorMessage, undefined, ssfi);
|
1907 | }
|
1908 |
|
1909 | if (doLength) {
|
1910 | var descriptor = 'length'
|
1911 | , itemsCount;
|
1912 | if (objType === 'map' || objType === 'set') {
|
1913 | descriptor = 'size';
|
1914 | itemsCount = obj.size;
|
1915 | } else {
|
1916 | itemsCount = obj.length;
|
1917 | }
|
1918 | this.assert(
|
1919 | itemsCount >= n
|
1920 | , 'expected #{this} to have a ' + descriptor + ' at least #{exp} but got #{act}'
|
1921 | , 'expected #{this} to have a ' + descriptor + ' below #{exp}'
|
1922 | , n
|
1923 | , itemsCount
|
1924 | );
|
1925 | } else {
|
1926 | this.assert(
|
1927 | obj >= n
|
1928 | , 'expected #{this} to be at least #{exp}'
|
1929 | , 'expected #{this} to be below #{exp}'
|
1930 | , n
|
1931 | );
|
1932 | }
|
1933 | }
|
1934 |
|
1935 | Assertion.addMethod('least', assertLeast);
|
1936 | Assertion.addMethod('gte', assertLeast);
|
1937 | Assertion.addMethod('greaterThanOrEqual', assertLeast);
|
1938 |
|
1939 | |
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 | function assertBelow (n, msg) {
|
1983 | if (msg) flag(this, 'message', msg);
|
1984 | var obj = flag(this, 'object')
|
1985 | , doLength = flag(this, 'doLength')
|
1986 | , flagMsg = flag(this, 'message')
|
1987 | , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
|
1988 | , ssfi = flag(this, 'ssfi')
|
1989 | , objType = _.type(obj).toLowerCase()
|
1990 | , nType = _.type(n).toLowerCase()
|
1991 | , errorMessage
|
1992 | , shouldThrow = true;
|
1993 |
|
1994 | if (doLength && objType !== 'map' && objType !== 'set') {
|
1995 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
1996 | }
|
1997 |
|
1998 | if (!doLength && (objType === 'date' && nType !== 'date')) {
|
1999 | errorMessage = msgPrefix + 'the argument to below must be a date';
|
2000 | } else if (nType !== 'number' && (doLength || objType === 'number')) {
|
2001 | errorMessage = msgPrefix + 'the argument to below must be a number';
|
2002 | } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
|
2003 | var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
|
2004 | errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
|
2005 | } else {
|
2006 | shouldThrow = false;
|
2007 | }
|
2008 |
|
2009 | if (shouldThrow) {
|
2010 | throw new AssertionError(errorMessage, undefined, ssfi);
|
2011 | }
|
2012 |
|
2013 | if (doLength) {
|
2014 | var descriptor = 'length'
|
2015 | , itemsCount;
|
2016 | if (objType === 'map' || objType === 'set') {
|
2017 | descriptor = 'size';
|
2018 | itemsCount = obj.size;
|
2019 | } else {
|
2020 | itemsCount = obj.length;
|
2021 | }
|
2022 | this.assert(
|
2023 | itemsCount < n
|
2024 | , 'expected #{this} to have a ' + descriptor + ' below #{exp} but got #{act}'
|
2025 | , 'expected #{this} to not have a ' + descriptor + ' below #{exp}'
|
2026 | , n
|
2027 | , itemsCount
|
2028 | );
|
2029 | } else {
|
2030 | this.assert(
|
2031 | obj < n
|
2032 | , 'expected #{this} to be below #{exp}'
|
2033 | , 'expected #{this} to be at least #{exp}'
|
2034 | , n
|
2035 | );
|
2036 | }
|
2037 | }
|
2038 |
|
2039 | Assertion.addMethod('below', assertBelow);
|
2040 | Assertion.addMethod('lt', assertBelow);
|
2041 | Assertion.addMethod('lessThan', assertBelow);
|
2042 |
|
2043 | |
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 | function assertMost (n, msg) {
|
2088 | if (msg) flag(this, 'message', msg);
|
2089 | var obj = flag(this, 'object')
|
2090 | , doLength = flag(this, 'doLength')
|
2091 | , flagMsg = flag(this, 'message')
|
2092 | , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
|
2093 | , ssfi = flag(this, 'ssfi')
|
2094 | , objType = _.type(obj).toLowerCase()
|
2095 | , nType = _.type(n).toLowerCase()
|
2096 | , errorMessage
|
2097 | , shouldThrow = true;
|
2098 |
|
2099 | if (doLength && objType !== 'map' && objType !== 'set') {
|
2100 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
2101 | }
|
2102 |
|
2103 | if (!doLength && (objType === 'date' && nType !== 'date')) {
|
2104 | errorMessage = msgPrefix + 'the argument to most must be a date';
|
2105 | } else if (nType !== 'number' && (doLength || objType === 'number')) {
|
2106 | errorMessage = msgPrefix + 'the argument to most must be a number';
|
2107 | } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
|
2108 | var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
|
2109 | errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
|
2110 | } else {
|
2111 | shouldThrow = false;
|
2112 | }
|
2113 |
|
2114 | if (shouldThrow) {
|
2115 | throw new AssertionError(errorMessage, undefined, ssfi);
|
2116 | }
|
2117 |
|
2118 | if (doLength) {
|
2119 | var descriptor = 'length'
|
2120 | , itemsCount;
|
2121 | if (objType === 'map' || objType === 'set') {
|
2122 | descriptor = 'size';
|
2123 | itemsCount = obj.size;
|
2124 | } else {
|
2125 | itemsCount = obj.length;
|
2126 | }
|
2127 | this.assert(
|
2128 | itemsCount <= n
|
2129 | , 'expected #{this} to have a ' + descriptor + ' at most #{exp} but got #{act}'
|
2130 | , 'expected #{this} to have a ' + descriptor + ' above #{exp}'
|
2131 | , n
|
2132 | , itemsCount
|
2133 | );
|
2134 | } else {
|
2135 | this.assert(
|
2136 | obj <= n
|
2137 | , 'expected #{this} to be at most #{exp}'
|
2138 | , 'expected #{this} to be above #{exp}'
|
2139 | , n
|
2140 | );
|
2141 | }
|
2142 | }
|
2143 |
|
2144 | Assertion.addMethod('most', assertMost);
|
2145 | Assertion.addMethod('lte', assertMost);
|
2146 | Assertion.addMethod('lessThanOrEqual', assertMost);
|
2147 |
|
2148 | |
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 | Assertion.addMethod('within', function (start, finish, msg) {
|
2192 | if (msg) flag(this, 'message', msg);
|
2193 | var obj = flag(this, 'object')
|
2194 | , doLength = flag(this, 'doLength')
|
2195 | , flagMsg = flag(this, 'message')
|
2196 | , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '')
|
2197 | , ssfi = flag(this, 'ssfi')
|
2198 | , objType = _.type(obj).toLowerCase()
|
2199 | , startType = _.type(start).toLowerCase()
|
2200 | , finishType = _.type(finish).toLowerCase()
|
2201 | , errorMessage
|
2202 | , shouldThrow = true
|
2203 | , range = (startType === 'date' && finishType === 'date')
|
2204 | ? start.toISOString() + '..' + finish.toISOString()
|
2205 | : start + '..' + finish;
|
2206 |
|
2207 | if (doLength && objType !== 'map' && objType !== 'set') {
|
2208 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
2209 | }
|
2210 |
|
2211 | if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) {
|
2212 | errorMessage = msgPrefix + 'the arguments to within must be dates';
|
2213 | } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) {
|
2214 | errorMessage = msgPrefix + 'the arguments to within must be numbers';
|
2215 | } else if (!doLength && (objType !== 'date' && objType !== 'number')) {
|
2216 | var printObj = (objType === 'string') ? "'" + obj + "'" : obj;
|
2217 | errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date';
|
2218 | } else {
|
2219 | shouldThrow = false;
|
2220 | }
|
2221 |
|
2222 | if (shouldThrow) {
|
2223 | throw new AssertionError(errorMessage, undefined, ssfi);
|
2224 | }
|
2225 |
|
2226 | if (doLength) {
|
2227 | var descriptor = 'length'
|
2228 | , itemsCount;
|
2229 | if (objType === 'map' || objType === 'set') {
|
2230 | descriptor = 'size';
|
2231 | itemsCount = obj.size;
|
2232 | } else {
|
2233 | itemsCount = obj.length;
|
2234 | }
|
2235 | this.assert(
|
2236 | itemsCount >= start && itemsCount <= finish
|
2237 | , 'expected #{this} to have a ' + descriptor + ' within ' + range
|
2238 | , 'expected #{this} to not have a ' + descriptor + ' within ' + range
|
2239 | );
|
2240 | } else {
|
2241 | this.assert(
|
2242 | obj >= start && obj <= finish
|
2243 | , 'expected #{this} to be within ' + range
|
2244 | , 'expected #{this} to not be within ' + range
|
2245 | );
|
2246 | }
|
2247 | });
|
2248 |
|
2249 | |
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 |
|
2287 |
|
2288 | function assertInstanceOf (constructor, msg) {
|
2289 | if (msg) flag(this, 'message', msg);
|
2290 |
|
2291 | var target = flag(this, 'object')
|
2292 | var ssfi = flag(this, 'ssfi');
|
2293 | var flagMsg = flag(this, 'message');
|
2294 |
|
2295 | try {
|
2296 | var isInstanceOf = target instanceof constructor;
|
2297 | } catch (err) {
|
2298 | if (err instanceof TypeError) {
|
2299 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
2300 | throw new AssertionError(
|
2301 | flagMsg + 'The instanceof assertion needs a constructor but '
|
2302 | + _.type(constructor) + ' was given.',
|
2303 | undefined,
|
2304 | ssfi
|
2305 | );
|
2306 | }
|
2307 | throw err;
|
2308 | }
|
2309 |
|
2310 | var name = _.getName(constructor);
|
2311 | if (name === null) {
|
2312 | name = 'an unnamed constructor';
|
2313 | }
|
2314 |
|
2315 | this.assert(
|
2316 | isInstanceOf
|
2317 | , 'expected #{this} to be an instance of ' + name
|
2318 | , 'expected #{this} to not be an instance of ' + name
|
2319 | );
|
2320 | };
|
2321 |
|
2322 | Assertion.addMethod('instanceof', assertInstanceOf);
|
2323 | Assertion.addMethod('instanceOf', assertInstanceOf);
|
2324 |
|
2325 | |
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 | function assertProperty (name, val, msg) {
|
2438 | if (msg) flag(this, 'message', msg);
|
2439 |
|
2440 | var isNested = flag(this, 'nested')
|
2441 | , isOwn = flag(this, 'own')
|
2442 | , flagMsg = flag(this, 'message')
|
2443 | , obj = flag(this, 'object')
|
2444 | , ssfi = flag(this, 'ssfi')
|
2445 | , nameType = typeof name;
|
2446 |
|
2447 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
2448 |
|
2449 | if (isNested) {
|
2450 | if (nameType !== 'string') {
|
2451 | throw new AssertionError(
|
2452 | flagMsg + 'the argument to property must be a string when using nested syntax',
|
2453 | undefined,
|
2454 | ssfi
|
2455 | );
|
2456 | }
|
2457 | } else {
|
2458 | if (nameType !== 'string' && nameType !== 'number' && nameType !== 'symbol') {
|
2459 | throw new AssertionError(
|
2460 | flagMsg + 'the argument to property must be a string, number, or symbol',
|
2461 | undefined,
|
2462 | ssfi
|
2463 | );
|
2464 | }
|
2465 | }
|
2466 |
|
2467 | if (isNested && isOwn) {
|
2468 | throw new AssertionError(
|
2469 | flagMsg + 'The "nested" and "own" flags cannot be combined.',
|
2470 | undefined,
|
2471 | ssfi
|
2472 | );
|
2473 | }
|
2474 |
|
2475 | if (obj === null || obj === undefined) {
|
2476 | throw new AssertionError(
|
2477 | flagMsg + 'Target cannot be null or undefined.',
|
2478 | undefined,
|
2479 | ssfi
|
2480 | );
|
2481 | }
|
2482 |
|
2483 | var isDeep = flag(this, 'deep')
|
2484 | , negate = flag(this, 'negate')
|
2485 | , pathInfo = isNested ? _.getPathInfo(obj, name) : null
|
2486 | , value = isNested ? pathInfo.value : obj[name];
|
2487 |
|
2488 | var descriptor = '';
|
2489 | if (isDeep) descriptor += 'deep ';
|
2490 | if (isOwn) descriptor += 'own ';
|
2491 | if (isNested) descriptor += 'nested ';
|
2492 | descriptor += 'property ';
|
2493 |
|
2494 | var hasProperty;
|
2495 | if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name);
|
2496 | else if (isNested) hasProperty = pathInfo.exists;
|
2497 | else hasProperty = _.hasProperty(obj, name);
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 | if (!negate || arguments.length === 1) {
|
2505 | this.assert(
|
2506 | hasProperty
|
2507 | , 'expected #{this} to have ' + descriptor + _.inspect(name)
|
2508 | , 'expected #{this} to not have ' + descriptor + _.inspect(name));
|
2509 | }
|
2510 |
|
2511 | if (arguments.length > 1) {
|
2512 | this.assert(
|
2513 | hasProperty && (isDeep ? _.eql(val, value) : val === value)
|
2514 | , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'
|
2515 | , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}'
|
2516 | , val
|
2517 | , value
|
2518 | );
|
2519 | }
|
2520 |
|
2521 | flag(this, 'object', value);
|
2522 | }
|
2523 |
|
2524 | Assertion.addMethod('property', assertProperty);
|
2525 |
|
2526 | function assertOwnProperty (name, value, msg) {
|
2527 | flag(this, 'own', true);
|
2528 | assertProperty.apply(this, arguments);
|
2529 | }
|
2530 |
|
2531 | Assertion.addMethod('ownProperty', assertOwnProperty);
|
2532 | Assertion.addMethod('haveOwnProperty', assertOwnProperty);
|
2533 |
|
2534 | |
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 | function assertOwnPropertyDescriptor (name, descriptor, msg) {
|
2654 | if (typeof descriptor === 'string') {
|
2655 | msg = descriptor;
|
2656 | descriptor = null;
|
2657 | }
|
2658 | if (msg) flag(this, 'message', msg);
|
2659 | var obj = flag(this, 'object');
|
2660 | var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
|
2661 | if (actualDescriptor && descriptor) {
|
2662 | this.assert(
|
2663 | _.eql(descriptor, actualDescriptor)
|
2664 | , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor)
|
2665 | , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor)
|
2666 | , descriptor
|
2667 | , actualDescriptor
|
2668 | , true
|
2669 | );
|
2670 | } else {
|
2671 | this.assert(
|
2672 | actualDescriptor
|
2673 | , 'expected #{this} to have an own property descriptor for ' + _.inspect(name)
|
2674 | , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name)
|
2675 | );
|
2676 | }
|
2677 | flag(this, 'object', actualDescriptor);
|
2678 | }
|
2679 |
|
2680 | Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor);
|
2681 | Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor);
|
2682 |
|
2683 | |
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 | function assertLengthChain () {
|
2742 | flag(this, 'doLength', true);
|
2743 | }
|
2744 |
|
2745 | function assertLength (n, msg) {
|
2746 | if (msg) flag(this, 'message', msg);
|
2747 | var obj = flag(this, 'object')
|
2748 | , objType = _.type(obj).toLowerCase()
|
2749 | , flagMsg = flag(this, 'message')
|
2750 | , ssfi = flag(this, 'ssfi')
|
2751 | , descriptor = 'length'
|
2752 | , itemsCount;
|
2753 |
|
2754 | switch (objType) {
|
2755 | case 'map':
|
2756 | case 'set':
|
2757 | descriptor = 'size';
|
2758 | itemsCount = obj.size;
|
2759 | break;
|
2760 | default:
|
2761 | new Assertion(obj, flagMsg, ssfi, true).to.have.property('length');
|
2762 | itemsCount = obj.length;
|
2763 | }
|
2764 |
|
2765 | this.assert(
|
2766 | itemsCount == n
|
2767 | , 'expected #{this} to have a ' + descriptor + ' of #{exp} but got #{act}'
|
2768 | , 'expected #{this} to not have a ' + descriptor + ' of #{act}'
|
2769 | , n
|
2770 | , itemsCount
|
2771 | );
|
2772 | }
|
2773 |
|
2774 | Assertion.addChainableMethod('length', assertLength, assertLengthChain);
|
2775 | Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain);
|
2776 |
|
2777 | |
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 | function assertMatch(re, msg) {
|
2805 | if (msg) flag(this, 'message', msg);
|
2806 | var obj = flag(this, 'object');
|
2807 | this.assert(
|
2808 | re.exec(obj)
|
2809 | , 'expected #{this} to match ' + re
|
2810 | , 'expected #{this} not to match ' + re
|
2811 | );
|
2812 | }
|
2813 |
|
2814 | Assertion.addMethod('match', assertMatch);
|
2815 | Assertion.addMethod('matches', assertMatch);
|
2816 |
|
2817 | |
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 | Assertion.addMethod('string', function (str, msg) {
|
2843 | if (msg) flag(this, 'message', msg);
|
2844 | var obj = flag(this, 'object')
|
2845 | , flagMsg = flag(this, 'message')
|
2846 | , ssfi = flag(this, 'ssfi');
|
2847 | new Assertion(obj, flagMsg, ssfi, true).is.a('string');
|
2848 |
|
2849 | this.assert(
|
2850 | ~obj.indexOf(str)
|
2851 | , 'expected #{this} to contain ' + _.inspect(str)
|
2852 | , 'expected #{this} to not contain ' + _.inspect(str)
|
2853 | );
|
2854 | });
|
2855 |
|
2856 | |
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 |
|
2960 | function assertKeys (keys) {
|
2961 | var obj = flag(this, 'object')
|
2962 | , objType = _.type(obj)
|
2963 | , keysType = _.type(keys)
|
2964 | , ssfi = flag(this, 'ssfi')
|
2965 | , isDeep = flag(this, 'deep')
|
2966 | , str
|
2967 | , deepStr = ''
|
2968 | , actual
|
2969 | , ok = true
|
2970 | , flagMsg = flag(this, 'message');
|
2971 |
|
2972 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
2973 | var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments';
|
2974 |
|
2975 | if (objType === 'Map' || objType === 'Set') {
|
2976 | deepStr = isDeep ? 'deeply ' : '';
|
2977 | actual = [];
|
2978 |
|
2979 |
|
2980 | obj.forEach(function (val, key) { actual.push(key) });
|
2981 |
|
2982 | if (keysType !== 'Array') {
|
2983 | keys = Array.prototype.slice.call(arguments);
|
2984 | }
|
2985 | } else {
|
2986 | actual = _.getOwnEnumerableProperties(obj);
|
2987 |
|
2988 | switch (keysType) {
|
2989 | case 'Array':
|
2990 | if (arguments.length > 1) {
|
2991 | throw new AssertionError(mixedArgsMsg, undefined, ssfi);
|
2992 | }
|
2993 | break;
|
2994 | case 'Object':
|
2995 | if (arguments.length > 1) {
|
2996 | throw new AssertionError(mixedArgsMsg, undefined, ssfi);
|
2997 | }
|
2998 | keys = Object.keys(keys);
|
2999 | break;
|
3000 | default:
|
3001 | keys = Array.prototype.slice.call(arguments);
|
3002 | }
|
3003 |
|
3004 |
|
3005 | keys = keys.map(function (val) {
|
3006 | return typeof val === 'symbol' ? val : String(val);
|
3007 | });
|
3008 | }
|
3009 |
|
3010 | if (!keys.length) {
|
3011 | throw new AssertionError(flagMsg + 'keys required', undefined, ssfi);
|
3012 | }
|
3013 |
|
3014 | var len = keys.length
|
3015 | , any = flag(this, 'any')
|
3016 | , all = flag(this, 'all')
|
3017 | , expected = keys;
|
3018 |
|
3019 | if (!any && !all) {
|
3020 | all = true;
|
3021 | }
|
3022 |
|
3023 |
|
3024 | if (any) {
|
3025 | ok = expected.some(function(expectedKey) {
|
3026 | return actual.some(function(actualKey) {
|
3027 | if (isDeep) {
|
3028 | return _.eql(expectedKey, actualKey);
|
3029 | } else {
|
3030 | return expectedKey === actualKey;
|
3031 | }
|
3032 | });
|
3033 | });
|
3034 | }
|
3035 |
|
3036 |
|
3037 | if (all) {
|
3038 | ok = expected.every(function(expectedKey) {
|
3039 | return actual.some(function(actualKey) {
|
3040 | if (isDeep) {
|
3041 | return _.eql(expectedKey, actualKey);
|
3042 | } else {
|
3043 | return expectedKey === actualKey;
|
3044 | }
|
3045 | });
|
3046 | });
|
3047 |
|
3048 | if (!flag(this, 'contains')) {
|
3049 | ok = ok && keys.length == actual.length;
|
3050 | }
|
3051 | }
|
3052 |
|
3053 |
|
3054 | if (len > 1) {
|
3055 | keys = keys.map(function(key) {
|
3056 | return _.inspect(key);
|
3057 | });
|
3058 | var last = keys.pop();
|
3059 | if (all) {
|
3060 | str = keys.join(', ') + ', and ' + last;
|
3061 | }
|
3062 | if (any) {
|
3063 | str = keys.join(', ') + ', or ' + last;
|
3064 | }
|
3065 | } else {
|
3066 | str = _.inspect(keys[0]);
|
3067 | }
|
3068 |
|
3069 |
|
3070 | str = (len > 1 ? 'keys ' : 'key ') + str;
|
3071 |
|
3072 |
|
3073 | str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;
|
3074 |
|
3075 |
|
3076 | this.assert(
|
3077 | ok
|
3078 | , 'expected #{this} to ' + deepStr + str
|
3079 | , 'expected #{this} to not ' + deepStr + str
|
3080 | , expected.slice(0).sort(_.compareByInspect)
|
3081 | , actual.sort(_.compareByInspect)
|
3082 | , true
|
3083 | );
|
3084 | }
|
3085 |
|
3086 | Assertion.addMethod('keys', assertKeys);
|
3087 | Assertion.addMethod('key', assertKeys);
|
3088 |
|
3089 | |
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 | function assertThrows (errorLike, errMsgMatcher, msg) {
|
3255 | if (msg) flag(this, 'message', msg);
|
3256 | var obj = flag(this, 'object')
|
3257 | , ssfi = flag(this, 'ssfi')
|
3258 | , flagMsg = flag(this, 'message')
|
3259 | , negate = flag(this, 'negate') || false;
|
3260 | new Assertion(obj, flagMsg, ssfi, true).is.a('function');
|
3261 |
|
3262 | if (errorLike instanceof RegExp || typeof errorLike === 'string') {
|
3263 | errMsgMatcher = errorLike;
|
3264 | errorLike = null;
|
3265 | }
|
3266 |
|
3267 | var caughtErr;
|
3268 | try {
|
3269 | obj();
|
3270 | } catch (err) {
|
3271 | caughtErr = err;
|
3272 | }
|
3273 |
|
3274 |
|
3275 |
|
3276 | var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined;
|
3277 |
|
3278 |
|
3279 |
|
3280 | var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
|
3281 | var errorLikeFail = false;
|
3282 | var errMsgMatcherFail = false;
|
3283 |
|
3284 |
|
3285 | if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
|
3286 |
|
3287 | var errorLikeString = 'an error';
|
3288 | if (errorLike instanceof Error) {
|
3289 | errorLikeString = '#{exp}';
|
3290 | } else if (errorLike) {
|
3291 | errorLikeString = _.checkError.getConstructorName(errorLike);
|
3292 | }
|
3293 |
|
3294 | this.assert(
|
3295 | caughtErr
|
3296 | , 'expected #{this} to throw ' + errorLikeString
|
3297 | , 'expected #{this} to not throw an error but #{act} was thrown'
|
3298 | , errorLike && errorLike.toString()
|
3299 | , (caughtErr instanceof Error ?
|
3300 | caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr &&
|
3301 | _.checkError.getConstructorName(caughtErr)))
|
3302 | );
|
3303 | }
|
3304 |
|
3305 | if (errorLike && caughtErr) {
|
3306 |
|
3307 | if (errorLike instanceof Error) {
|
3308 | var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike);
|
3309 |
|
3310 | if (isCompatibleInstance === negate) {
|
3311 |
|
3312 |
|
3313 | if (everyArgIsDefined && negate) {
|
3314 | errorLikeFail = true;
|
3315 | } else {
|
3316 | this.assert(
|
3317 | negate
|
3318 | , 'expected #{this} to throw #{exp} but #{act} was thrown'
|
3319 | , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '')
|
3320 | , errorLike.toString()
|
3321 | , caughtErr.toString()
|
3322 | );
|
3323 | }
|
3324 | }
|
3325 | }
|
3326 |
|
3327 | var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike);
|
3328 | if (isCompatibleConstructor === negate) {
|
3329 | if (everyArgIsDefined && negate) {
|
3330 | errorLikeFail = true;
|
3331 | } else {
|
3332 | this.assert(
|
3333 | negate
|
3334 | , 'expected #{this} to throw #{exp} but #{act} was thrown'
|
3335 | , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')
|
3336 | , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))
|
3337 | , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))
|
3338 | );
|
3339 | }
|
3340 | }
|
3341 | }
|
3342 |
|
3343 | if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) {
|
3344 |
|
3345 | var placeholder = 'including';
|
3346 | if (errMsgMatcher instanceof RegExp) {
|
3347 | placeholder = 'matching'
|
3348 | }
|
3349 |
|
3350 | var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher);
|
3351 | if (isCompatibleMessage === negate) {
|
3352 | if (everyArgIsDefined && negate) {
|
3353 | errMsgMatcherFail = true;
|
3354 | } else {
|
3355 | this.assert(
|
3356 | negate
|
3357 | , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}'
|
3358 | , 'expected #{this} to throw error not ' + placeholder + ' #{exp}'
|
3359 | , errMsgMatcher
|
3360 | , _.checkError.getMessage(caughtErr)
|
3361 | );
|
3362 | }
|
3363 | }
|
3364 | }
|
3365 |
|
3366 |
|
3367 | if (errorLikeFail && errMsgMatcherFail) {
|
3368 | this.assert(
|
3369 | negate
|
3370 | , 'expected #{this} to throw #{exp} but #{act} was thrown'
|
3371 | , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '')
|
3372 | , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike))
|
3373 | , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr))
|
3374 | );
|
3375 | }
|
3376 |
|
3377 | flag(this, 'object', caughtErr);
|
3378 | };
|
3379 |
|
3380 | Assertion.addMethod('throw', assertThrows);
|
3381 | Assertion.addMethod('throws', assertThrows);
|
3382 | Assertion.addMethod('Throw', assertThrows);
|
3383 |
|
3384 | |
3385 |
|
3386 |
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 | function respondTo (method, msg) {
|
3450 | if (msg) flag(this, 'message', msg);
|
3451 | var obj = flag(this, 'object')
|
3452 | , itself = flag(this, 'itself')
|
3453 | , context = ('function' === typeof obj && !itself)
|
3454 | ? obj.prototype[method]
|
3455 | : obj[method];
|
3456 |
|
3457 | this.assert(
|
3458 | 'function' === typeof context
|
3459 | , 'expected #{this} to respond to ' + _.inspect(method)
|
3460 | , 'expected #{this} to not respond to ' + _.inspect(method)
|
3461 | );
|
3462 | }
|
3463 |
|
3464 | Assertion.addMethod('respondTo', respondTo);
|
3465 | Assertion.addMethod('respondsTo', respondTo);
|
3466 |
|
3467 | |
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 | Assertion.addProperty('itself', function () {
|
3488 | flag(this, 'itself', true);
|
3489 | });
|
3490 |
|
3491 | |
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 | function satisfy (matcher, msg) {
|
3530 | if (msg) flag(this, 'message', msg);
|
3531 | var obj = flag(this, 'object');
|
3532 | var result = matcher(obj);
|
3533 | this.assert(
|
3534 | result
|
3535 | , 'expected #{this} to satisfy ' + _.objDisplay(matcher)
|
3536 | , 'expected #{this} to not satisfy' + _.objDisplay(matcher)
|
3537 | , flag(this, 'negate') ? false : true
|
3538 | , result
|
3539 | );
|
3540 | }
|
3541 |
|
3542 | Assertion.addMethod('satisfy', satisfy);
|
3543 | Assertion.addMethod('satisfies', satisfy);
|
3544 |
|
3545 | |
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 | function closeTo(expected, delta, msg) {
|
3584 | if (msg) flag(this, 'message', msg);
|
3585 | var obj = flag(this, 'object')
|
3586 | , flagMsg = flag(this, 'message')
|
3587 | , ssfi = flag(this, 'ssfi');
|
3588 |
|
3589 | new Assertion(obj, flagMsg, ssfi, true).is.a('number');
|
3590 | if (typeof expected !== 'number' || typeof delta !== 'number') {
|
3591 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
3592 | var deltaMessage = delta === undefined ? ", and a delta is required" : "";
|
3593 | throw new AssertionError(
|
3594 | flagMsg + 'the arguments to closeTo or approximately must be numbers' + deltaMessage,
|
3595 | undefined,
|
3596 | ssfi
|
3597 | );
|
3598 | }
|
3599 |
|
3600 | this.assert(
|
3601 | Math.abs(obj - expected) <= delta
|
3602 | , 'expected #{this} to be close to ' + expected + ' +/- ' + delta
|
3603 | , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta
|
3604 | );
|
3605 | }
|
3606 |
|
3607 | Assertion.addMethod('closeTo', closeTo);
|
3608 | Assertion.addMethod('approximately', closeTo);
|
3609 |
|
3610 |
|
3611 | function isSubsetOf(subset, superset, cmp, contains, ordered) {
|
3612 | if (!contains) {
|
3613 | if (subset.length !== superset.length) return false;
|
3614 | superset = superset.slice();
|
3615 | }
|
3616 |
|
3617 | return subset.every(function(elem, idx) {
|
3618 | if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
|
3619 |
|
3620 | if (!cmp) {
|
3621 | var matchIdx = superset.indexOf(elem);
|
3622 | if (matchIdx === -1) return false;
|
3623 |
|
3624 |
|
3625 | if (!contains) superset.splice(matchIdx, 1);
|
3626 | return true;
|
3627 | }
|
3628 |
|
3629 | return superset.some(function(elem2, matchIdx) {
|
3630 | if (!cmp(elem, elem2)) return false;
|
3631 |
|
3632 |
|
3633 | if (!contains) superset.splice(matchIdx, 1);
|
3634 | return true;
|
3635 | });
|
3636 | });
|
3637 | }
|
3638 |
|
3639 | |
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 |
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 |
|
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 | Assertion.addMethod('members', function (subset, msg) {
|
3709 | if (msg) flag(this, 'message', msg);
|
3710 | var obj = flag(this, 'object')
|
3711 | , flagMsg = flag(this, 'message')
|
3712 | , ssfi = flag(this, 'ssfi');
|
3713 |
|
3714 | new Assertion(obj, flagMsg, ssfi, true).to.be.an('array');
|
3715 | new Assertion(subset, flagMsg, ssfi, true).to.be.an('array');
|
3716 |
|
3717 | var contains = flag(this, 'contains');
|
3718 | var ordered = flag(this, 'ordered');
|
3719 |
|
3720 | var subject, failMsg, failNegateMsg;
|
3721 |
|
3722 | if (contains) {
|
3723 | subject = ordered ? 'an ordered superset' : 'a superset';
|
3724 | failMsg = 'expected #{this} to be ' + subject + ' of #{exp}';
|
3725 | failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}';
|
3726 | } else {
|
3727 | subject = ordered ? 'ordered members' : 'members';
|
3728 | failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}';
|
3729 | failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}';
|
3730 | }
|
3731 |
|
3732 | var cmp = flag(this, 'deep') ? _.eql : undefined;
|
3733 |
|
3734 | this.assert(
|
3735 | isSubsetOf(subset, obj, cmp, contains, ordered)
|
3736 | , failMsg
|
3737 | , failNegateMsg
|
3738 | , subset
|
3739 | , obj
|
3740 | , true
|
3741 | );
|
3742 | });
|
3743 |
|
3744 | |
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 | function oneOf (list, msg) {
|
3783 | if (msg) flag(this, 'message', msg);
|
3784 | var expected = flag(this, 'object')
|
3785 | , flagMsg = flag(this, 'message')
|
3786 | , ssfi = flag(this, 'ssfi')
|
3787 | , contains = flag(this, 'contains')
|
3788 | , isDeep = flag(this, 'deep');
|
3789 | new Assertion(list, flagMsg, ssfi, true).to.be.an('array');
|
3790 |
|
3791 | if (contains) {
|
3792 | this.assert(
|
3793 | list.some(function(possibility) { return expected.indexOf(possibility) > -1 })
|
3794 | , 'expected #{this} to contain one of #{exp}'
|
3795 | , 'expected #{this} to not contain one of #{exp}'
|
3796 | , list
|
3797 | , expected
|
3798 | );
|
3799 | } else {
|
3800 | if (isDeep) {
|
3801 | this.assert(
|
3802 | list.some(function(possibility) { return _.eql(expected, possibility) })
|
3803 | , 'expected #{this} to deeply equal one of #{exp}'
|
3804 | , 'expected #{this} to deeply equal one of #{exp}'
|
3805 | , list
|
3806 | , expected
|
3807 | );
|
3808 | } else {
|
3809 | this.assert(
|
3810 | list.indexOf(expected) > -1
|
3811 | , 'expected #{this} to be one of #{exp}'
|
3812 | , 'expected #{this} to not be one of #{exp}'
|
3813 | , list
|
3814 | , expected
|
3815 | );
|
3816 | }
|
3817 | }
|
3818 | }
|
3819 |
|
3820 | Assertion.addMethod('oneOf', oneOf);
|
3821 |
|
3822 | |
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 | function assertChanges (subject, prop, msg) {
|
3918 | if (msg) flag(this, 'message', msg);
|
3919 | var fn = flag(this, 'object')
|
3920 | , flagMsg = flag(this, 'message')
|
3921 | , ssfi = flag(this, 'ssfi');
|
3922 | new Assertion(fn, flagMsg, ssfi, true).is.a('function');
|
3923 |
|
3924 | var initial;
|
3925 | if (!prop) {
|
3926 | new Assertion(subject, flagMsg, ssfi, true).is.a('function');
|
3927 | initial = subject();
|
3928 | } else {
|
3929 | new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
3930 | initial = subject[prop];
|
3931 | }
|
3932 |
|
3933 | fn();
|
3934 |
|
3935 | var final = prop === undefined || prop === null ? subject() : subject[prop];
|
3936 | var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
|
3937 |
|
3938 |
|
3939 | flag(this, 'deltaMsgObj', msgObj);
|
3940 | flag(this, 'initialDeltaValue', initial);
|
3941 | flag(this, 'finalDeltaValue', final);
|
3942 | flag(this, 'deltaBehavior', 'change');
|
3943 | flag(this, 'realDelta', final !== initial);
|
3944 |
|
3945 | this.assert(
|
3946 | initial !== final
|
3947 | , 'expected ' + msgObj + ' to change'
|
3948 | , 'expected ' + msgObj + ' to not change'
|
3949 | );
|
3950 | }
|
3951 |
|
3952 | Assertion.addMethod('change', assertChanges);
|
3953 | Assertion.addMethod('changes', assertChanges);
|
3954 |
|
3955 | |
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 | function assertIncreases (subject, prop, msg) {
|
4035 | if (msg) flag(this, 'message', msg);
|
4036 | var fn = flag(this, 'object')
|
4037 | , flagMsg = flag(this, 'message')
|
4038 | , ssfi = flag(this, 'ssfi');
|
4039 | new Assertion(fn, flagMsg, ssfi, true).is.a('function');
|
4040 |
|
4041 | var initial;
|
4042 | if (!prop) {
|
4043 | new Assertion(subject, flagMsg, ssfi, true).is.a('function');
|
4044 | initial = subject();
|
4045 | } else {
|
4046 | new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
4047 | initial = subject[prop];
|
4048 | }
|
4049 |
|
4050 |
|
4051 | new Assertion(initial, flagMsg, ssfi, true).is.a('number');
|
4052 |
|
4053 | fn();
|
4054 |
|
4055 | var final = prop === undefined || prop === null ? subject() : subject[prop];
|
4056 | var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
|
4057 |
|
4058 | flag(this, 'deltaMsgObj', msgObj);
|
4059 | flag(this, 'initialDeltaValue', initial);
|
4060 | flag(this, 'finalDeltaValue', final);
|
4061 | flag(this, 'deltaBehavior', 'increase');
|
4062 | flag(this, 'realDelta', final - initial);
|
4063 |
|
4064 | this.assert(
|
4065 | final - initial > 0
|
4066 | , 'expected ' + msgObj + ' to increase'
|
4067 | , 'expected ' + msgObj + ' to not increase'
|
4068 | );
|
4069 | }
|
4070 |
|
4071 | Assertion.addMethod('increase', assertIncreases);
|
4072 | Assertion.addMethod('increases', assertIncreases);
|
4073 |
|
4074 | |
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 |
|
4144 |
|
4145 |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 | function assertDecreases (subject, prop, msg) {
|
4154 | if (msg) flag(this, 'message', msg);
|
4155 | var fn = flag(this, 'object')
|
4156 | , flagMsg = flag(this, 'message')
|
4157 | , ssfi = flag(this, 'ssfi');
|
4158 | new Assertion(fn, flagMsg, ssfi, true).is.a('function');
|
4159 |
|
4160 | var initial;
|
4161 | if (!prop) {
|
4162 | new Assertion(subject, flagMsg, ssfi, true).is.a('function');
|
4163 | initial = subject();
|
4164 | } else {
|
4165 | new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
|
4166 | initial = subject[prop];
|
4167 | }
|
4168 |
|
4169 |
|
4170 | new Assertion(initial, flagMsg, ssfi, true).is.a('number');
|
4171 |
|
4172 | fn();
|
4173 |
|
4174 | var final = prop === undefined || prop === null ? subject() : subject[prop];
|
4175 | var msgObj = prop === undefined || prop === null ? initial : '.' + prop;
|
4176 |
|
4177 | flag(this, 'deltaMsgObj', msgObj);
|
4178 | flag(this, 'initialDeltaValue', initial);
|
4179 | flag(this, 'finalDeltaValue', final);
|
4180 | flag(this, 'deltaBehavior', 'decrease');
|
4181 | flag(this, 'realDelta', initial - final);
|
4182 |
|
4183 | this.assert(
|
4184 | final - initial < 0
|
4185 | , 'expected ' + msgObj + ' to decrease'
|
4186 | , 'expected ' + msgObj + ' to not decrease'
|
4187 | );
|
4188 | }
|
4189 |
|
4190 | Assertion.addMethod('decrease', assertDecreases);
|
4191 | Assertion.addMethod('decreases', assertDecreases);
|
4192 |
|
4193 | |
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 | function assertDelta(delta, msg) {
|
4260 | if (msg) flag(this, 'message', msg);
|
4261 |
|
4262 | var msgObj = flag(this, 'deltaMsgObj');
|
4263 | var initial = flag(this, 'initialDeltaValue');
|
4264 | var final = flag(this, 'finalDeltaValue');
|
4265 | var behavior = flag(this, 'deltaBehavior');
|
4266 | var realDelta = flag(this, 'realDelta');
|
4267 |
|
4268 | var expression;
|
4269 | if (behavior === 'change') {
|
4270 | expression = Math.abs(final - initial) === Math.abs(delta);
|
4271 | } else {
|
4272 | expression = realDelta === Math.abs(delta);
|
4273 | }
|
4274 |
|
4275 | this.assert(
|
4276 | expression
|
4277 | , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta
|
4278 | , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta
|
4279 | );
|
4280 | }
|
4281 |
|
4282 | Assertion.addMethod('by', assertDelta);
|
4283 |
|
4284 | |
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 |
|
4310 |
|
4311 |
|
4312 | Assertion.addProperty('extensible', function() {
|
4313 | var obj = flag(this, 'object');
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 | var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
|
4321 |
|
4322 | this.assert(
|
4323 | isExtensible
|
4324 | , 'expected #{this} to be extensible'
|
4325 | , 'expected #{this} to not be extensible'
|
4326 | );
|
4327 | });
|
4328 |
|
4329 | |
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | Assertion.addProperty('sealed', function() {
|
4358 | var obj = flag(this, 'object');
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 | var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
|
4366 |
|
4367 | this.assert(
|
4368 | isSealed
|
4369 | , 'expected #{this} to be sealed'
|
4370 | , 'expected #{this} to not be sealed'
|
4371 | );
|
4372 | });
|
4373 |
|
4374 | |
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 | Assertion.addProperty('frozen', function() {
|
4400 | var obj = flag(this, 'object');
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 | var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
|
4408 |
|
4409 | this.assert(
|
4410 | isFrozen
|
4411 | , 'expected #{this} to be frozen'
|
4412 | , 'expected #{this} to not be frozen'
|
4413 | );
|
4414 | });
|
4415 |
|
4416 | |
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 | Assertion.addProperty('finite', function(msg) {
|
4466 | var obj = flag(this, 'object');
|
4467 |
|
4468 | this.assert(
|
4469 | typeof obj === 'number' && isFinite(obj)
|
4470 | , 'expected #{this} to be a finite number'
|
4471 | , 'expected #{this} to not be a finite number'
|
4472 | );
|
4473 | });
|
4474 | };
|
4475 |
|
4476 |
|
4477 | }),
|
4478 |
|
4479 | "./node_modules/chai/lib/chai/interface/assert.js":
|
4480 |
|
4481 |
|
4482 |
|
4483 | ((module) => {
|
4484 |
|
4485 |
|
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 | module.exports = function (chai, util) {
|
4492 | |
4493 |
|
4494 |
|
4495 |
|
4496 | var Assertion = chai.Assertion
|
4497 | , flag = util.flag;
|
4498 |
|
4499 | |
4500 |
|
4501 |
|
4502 |
|
4503 | |
4504 |
|
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 |
|
4518 | var assert = chai.assert = function (express, errmsg) {
|
4519 | var test = new Assertion(null, null, chai.assert, true);
|
4520 | test.assert(
|
4521 | express
|
4522 | , errmsg
|
4523 | , '[ negation message unavailable ]'
|
4524 | );
|
4525 | };
|
4526 |
|
4527 | |
4528 |
|
4529 |
|
4530 |
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 | assert.fail = function (actual, expected, message, operator) {
|
4550 | if (arguments.length < 2) {
|
4551 |
|
4552 |
|
4553 | message = actual;
|
4554 | actual = undefined;
|
4555 | }
|
4556 |
|
4557 | message = message || 'assert.fail()';
|
4558 | throw new chai.AssertionError(message, {
|
4559 | actual: actual
|
4560 | , expected: expected
|
4561 | , operator: operator
|
4562 | }, assert.fail);
|
4563 | };
|
4564 |
|
4565 | |
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 | assert.isOk = function (val, msg) {
|
4582 | new Assertion(val, msg, assert.isOk, true).is.ok;
|
4583 | };
|
4584 |
|
4585 | |
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 | assert.isNotOk = function (val, msg) {
|
4602 | new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
|
4603 | };
|
4604 |
|
4605 | |
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 | assert.equal = function (act, exp, msg) {
|
4621 | var test = new Assertion(act, msg, assert.equal, true);
|
4622 |
|
4623 | test.assert(
|
4624 | exp == flag(test, 'object')
|
4625 | , 'expected #{this} to equal #{exp}'
|
4626 | , 'expected #{this} to not equal #{act}'
|
4627 | , exp
|
4628 | , act
|
4629 | , true
|
4630 | );
|
4631 | };
|
4632 |
|
4633 | |
4634 |
|
4635 |
|
4636 |
|
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 | assert.notEqual = function (act, exp, msg) {
|
4649 | var test = new Assertion(act, msg, assert.notEqual, true);
|
4650 |
|
4651 | test.assert(
|
4652 | exp != flag(test, 'object')
|
4653 | , 'expected #{this} to not equal #{exp}'
|
4654 | , 'expected #{this} to equal #{act}'
|
4655 | , exp
|
4656 | , act
|
4657 | , true
|
4658 | );
|
4659 | };
|
4660 |
|
4661 | |
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 |
|
4676 | assert.strictEqual = function (act, exp, msg) {
|
4677 | new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
|
4678 | };
|
4679 |
|
4680 | |
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 |
|
4687 |
|
4688 |
|
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 |
|
4695 | assert.notStrictEqual = function (act, exp, msg) {
|
4696 | new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
|
4697 | };
|
4698 |
|
4699 | |
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 | assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) {
|
4716 | new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
|
4717 | };
|
4718 |
|
4719 | |
4720 |
|
4721 |
|
4722 |
|
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 |
|
4734 | assert.notDeepEqual = function (act, exp, msg) {
|
4735 | new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
|
4736 | };
|
4737 |
|
4738 | |
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 |
|
4747 |
|
4748 |
|
4749 |
|
4750 |
|
4751 |
|
4752 |
|
4753 | assert.isAbove = function (val, abv, msg) {
|
4754 | new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
|
4755 | };
|
4756 |
|
4757 | |
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 | assert.isAtLeast = function (val, atlst, msg) {
|
4774 | new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
|
4775 | };
|
4776 |
|
4777 | |
4778 |
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 | assert.isBelow = function (val, blw, msg) {
|
4793 | new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
|
4794 | };
|
4795 |
|
4796 | |
4797 |
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 | assert.isAtMost = function (val, atmst, msg) {
|
4813 | new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
|
4814 | };
|
4815 |
|
4816 | |
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 | assert.isTrue = function (val, msg) {
|
4832 | new Assertion(val, msg, assert.isTrue, true).is['true'];
|
4833 | };
|
4834 |
|
4835 | |
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 | assert.isNotTrue = function (val, msg) {
|
4851 | new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
|
4852 | };
|
4853 |
|
4854 | |
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 | assert.isFalse = function (val, msg) {
|
4870 | new Assertion(val, msg, assert.isFalse, true).is['false'];
|
4871 | };
|
4872 |
|
4873 | |
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 | assert.isNotFalse = function (val, msg) {
|
4889 | new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
|
4890 | };
|
4891 |
|
4892 | |
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 |
|
4906 | assert.isNull = function (val, msg) {
|
4907 | new Assertion(val, msg, assert.isNull, true).to.equal(null);
|
4908 | };
|
4909 |
|
4910 | |
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 | assert.isNotNull = function (val, msg) {
|
4926 | new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
|
4927 | };
|
4928 |
|
4929 | |
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 | assert.isNaN = function (val, msg) {
|
4944 | new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
|
4945 | };
|
4946 |
|
4947 | |
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 |
|
4958 |
|
4959 |
|
4960 | assert.isNotNaN = function (val, msg) {
|
4961 | new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN;
|
4962 | };
|
4963 |
|
4964 | |
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 |
|
4977 |
|
4978 |
|
4979 |
|
4980 | assert.exists = function (val, msg) {
|
4981 | new Assertion(val, msg, assert.exists, true).to.exist;
|
4982 | };
|
4983 |
|
4984 | |
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 | assert.notExists = function (val, msg) {
|
5003 | new Assertion(val, msg, assert.notExists, true).to.not.exist;
|
5004 | };
|
5005 |
|
5006 | |
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 |
|
5017 |
|
5018 |
|
5019 |
|
5020 |
|
5021 | assert.isUndefined = function (val, msg) {
|
5022 | new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined);
|
5023 | };
|
5024 |
|
5025 | |
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 |
|
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 |
|
5040 | assert.isDefined = function (val, msg) {
|
5041 | new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined);
|
5042 | };
|
5043 |
|
5044 | |
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 |
|
5059 | assert.isFunction = function (val, msg) {
|
5060 | new Assertion(val, msg, assert.isFunction, true).to.be.a('function');
|
5061 | };
|
5062 |
|
5063 | |
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 | assert.isNotFunction = function (val, msg) {
|
5079 | new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function');
|
5080 | };
|
5081 |
|
5082 | |
5083 |
|
5084 |
|
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 |
|
5090 |
|
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 | assert.isObject = function (val, msg) {
|
5099 | new Assertion(val, msg, assert.isObject, true).to.be.a('object');
|
5100 | };
|
5101 |
|
5102 | |
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 | assert.isNotObject = function (val, msg) {
|
5119 | new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object');
|
5120 | };
|
5121 |
|
5122 | |
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 |
|
5129 |
|
5130 |
|
5131 |
|
5132 |
|
5133 |
|
5134 |
|
5135 |
|
5136 |
|
5137 | assert.isArray = function (val, msg) {
|
5138 | new Assertion(val, msg, assert.isArray, true).to.be.an('array');
|
5139 | };
|
5140 |
|
5141 | |
5142 |
|
5143 |
|
5144 |
|
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 | assert.isNotArray = function (val, msg) {
|
5157 | new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array');
|
5158 | };
|
5159 |
|
5160 | |
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 | assert.isString = function (val, msg) {
|
5176 | new Assertion(val, msg, assert.isString, true).to.be.a('string');
|
5177 | };
|
5178 |
|
5179 | |
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 | assert.isNotString = function (val, msg) {
|
5195 | new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string');
|
5196 | };
|
5197 |
|
5198 | |
5199 |
|
5200 |
|
5201 |
|
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 |
|
5213 | assert.isNumber = function (val, msg) {
|
5214 | new Assertion(val, msg, assert.isNumber, true).to.be.a('number');
|
5215 | };
|
5216 |
|
5217 | |
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 |
|
5224 |
|
5225 |
|
5226 |
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 | assert.isNotNumber = function (val, msg) {
|
5233 | new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number');
|
5234 | };
|
5235 |
|
5236 | |
5237 |
|
5238 |
|
5239 |
|
5240 |
|
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 |
|
5253 | assert.isFinite = function (val, msg) {
|
5254 | new Assertion(val, msg, assert.isFinite, true).to.be.finite;
|
5255 | };
|
5256 |
|
5257 | |
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 |
|
5270 |
|
5271 |
|
5272 |
|
5273 |
|
5274 |
|
5275 | assert.isBoolean = function (val, msg) {
|
5276 | new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean');
|
5277 | };
|
5278 |
|
5279 | |
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 |
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 |
|
5297 | assert.isNotBoolean = function (val, msg) {
|
5298 | new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean');
|
5299 | };
|
5300 |
|
5301 | |
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 | assert.typeOf = function (val, type, msg) {
|
5323 | new Assertion(val, msg, assert.typeOf, true).to.be.a(type);
|
5324 | };
|
5325 |
|
5326 | |
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 |
|
5342 | assert.notTypeOf = function (val, type, msg) {
|
5343 | new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type);
|
5344 | };
|
5345 |
|
5346 | |
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 |
|
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 |
|
5362 |
|
5363 |
|
5364 | assert.instanceOf = function (val, type, msg) {
|
5365 | new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type);
|
5366 | };
|
5367 |
|
5368 | |
5369 |
|
5370 |
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 |
|
5386 | assert.notInstanceOf = function (val, type, msg) {
|
5387 | new Assertion(val, msg, assert.notInstanceOf, true)
|
5388 | .to.not.be.instanceOf(type);
|
5389 | };
|
5390 |
|
5391 | |
5392 |
|
5393 |
|
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 |
|
5408 |
|
5409 |
|
5410 |
|
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 |
|
5416 |
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 |
|
5422 | assert.include = function (exp, inc, msg) {
|
5423 | new Assertion(exp, msg, assert.include, true).include(inc);
|
5424 | };
|
5425 |
|
5426 | |
5427 |
|
5428 |
|
5429 |
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 | assert.notInclude = function (exp, inc, msg) {
|
5459 | new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
|
5460 | };
|
5461 |
|
5462 | |
5463 |
|
5464 |
|
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 |
|
5478 |
|
5479 |
|
5480 |
|
5481 |
|
5482 |
|
5483 | assert.deepInclude = function (exp, inc, msg) {
|
5484 | new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
|
5485 | };
|
5486 |
|
5487 | |
5488 |
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 |
|
5507 |
|
5508 | assert.notDeepInclude = function (exp, inc, msg) {
|
5509 | new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
|
5510 | };
|
5511 |
|
5512 | |
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 | assert.nestedInclude = function (exp, inc, msg) {
|
5534 | new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
|
5535 | };
|
5536 |
|
5537 | |
5538 |
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 |
|
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 |
|
5553 |
|
5554 |
|
5555 |
|
5556 |
|
5557 |
|
5558 | assert.notNestedInclude = function (exp, inc, msg) {
|
5559 | new Assertion(exp, msg, assert.notNestedInclude, true)
|
5560 | .not.nested.include(inc);
|
5561 | };
|
5562 |
|
5563 | |
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 | assert.deepNestedInclude = function(exp, inc, msg) {
|
5585 | new Assertion(exp, msg, assert.deepNestedInclude, true)
|
5586 | .deep.nested.include(inc);
|
5587 | };
|
5588 |
|
5589 | |
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 | assert.notDeepNestedInclude = function(exp, inc, msg) {
|
5611 | new Assertion(exp, msg, assert.notDeepNestedInclude, true)
|
5612 | .not.deep.nested.include(inc);
|
5613 | };
|
5614 |
|
5615 | |
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 | assert.ownInclude = function(exp, inc, msg) {
|
5633 | new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
|
5634 | };
|
5635 |
|
5636 | |
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 | assert.notOwnInclude = function(exp, inc, msg) {
|
5656 | new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
|
5657 | };
|
5658 |
|
5659 | |
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 |
|
5675 |
|
5676 | assert.deepOwnInclude = function(exp, inc, msg) {
|
5677 | new Assertion(exp, msg, assert.deepOwnInclude, true)
|
5678 | .deep.own.include(inc);
|
5679 | };
|
5680 |
|
5681 | |
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 | assert.notDeepOwnInclude = function(exp, inc, msg) {
|
5699 | new Assertion(exp, msg, assert.notDeepOwnInclude, true)
|
5700 | .not.deep.own.include(inc);
|
5701 | };
|
5702 |
|
5703 | |
5704 |
|
5705 |
|
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 | assert.match = function (exp, re, msg) {
|
5719 | new Assertion(exp, msg, assert.match, true).to.match(re);
|
5720 | };
|
5721 |
|
5722 | |
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 | assert.notMatch = function (exp, re, msg) {
|
5738 | new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
|
5739 | };
|
5740 |
|
5741 | |
5742 |
|
5743 |
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 |
|
5758 | assert.property = function (obj, prop, msg) {
|
5759 | new Assertion(obj, msg, assert.property, true).to.have.property(prop);
|
5760 | };
|
5761 |
|
5762 | |
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 | assert.notProperty = function (obj, prop, msg) {
|
5779 | new Assertion(obj, msg, assert.notProperty, true)
|
5780 | .to.not.have.property(prop);
|
5781 | };
|
5782 |
|
5783 | |
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 | assert.propertyVal = function (obj, prop, val, msg) {
|
5802 | new Assertion(obj, msg, assert.propertyVal, true)
|
5803 | .to.have.property(prop, val);
|
5804 | };
|
5805 |
|
5806 | |
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 |
|
5823 |
|
5824 |
|
5825 | assert.notPropertyVal = function (obj, prop, val, msg) {
|
5826 | new Assertion(obj, msg, assert.notPropertyVal, true)
|
5827 | .to.not.have.property(prop, val);
|
5828 | };
|
5829 |
|
5830 | |
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 |
|
5846 |
|
5847 | assert.deepPropertyVal = function (obj, prop, val, msg) {
|
5848 | new Assertion(obj, msg, assert.deepPropertyVal, true)
|
5849 | .to.have.deep.property(prop, val);
|
5850 | };
|
5851 |
|
5852 | |
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 |
|
5869 |
|
5870 |
|
5871 | assert.notDeepPropertyVal = function (obj, prop, val, msg) {
|
5872 | new Assertion(obj, msg, assert.notDeepPropertyVal, true)
|
5873 | .to.not.have.deep.property(prop, val);
|
5874 | };
|
5875 |
|
5876 | |
5877 |
|
5878 |
|
5879 |
|
5880 |
|
5881 |
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 | assert.ownProperty = function (obj, prop, msg) {
|
5892 | new Assertion(obj, msg, assert.ownProperty, true)
|
5893 | .to.have.own.property(prop);
|
5894 | };
|
5895 |
|
5896 | |
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 | assert.notOwnProperty = function (obj, prop, msg) {
|
5913 | new Assertion(obj, msg, assert.notOwnProperty, true)
|
5914 | .to.not.have.own.property(prop);
|
5915 | };
|
5916 |
|
5917 | |
5918 |
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 | assert.ownPropertyVal = function (obj, prop, value, msg) {
|
5935 | new Assertion(obj, msg, assert.ownPropertyVal, true)
|
5936 | .to.have.own.property(prop, value);
|
5937 | };
|
5938 |
|
5939 | |
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 | assert.notOwnPropertyVal = function (obj, prop, value, msg) {
|
5958 | new Assertion(obj, msg, assert.notOwnPropertyVal, true)
|
5959 | .to.not.have.own.property(prop, value);
|
5960 | };
|
5961 |
|
5962 | |
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 |
|
5979 | assert.deepOwnPropertyVal = function (obj, prop, value, msg) {
|
5980 | new Assertion(obj, msg, assert.deepOwnPropertyVal, true)
|
5981 | .to.have.deep.own.property(prop, value);
|
5982 | };
|
5983 |
|
5984 | |
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 | assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) {
|
6005 | new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true)
|
6006 | .to.not.have.deep.own.property(prop, value);
|
6007 | };
|
6008 |
|
6009 | |
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 | assert.nestedProperty = function (obj, prop, msg) {
|
6027 | new Assertion(obj, msg, assert.nestedProperty, true)
|
6028 | .to.have.nested.property(prop);
|
6029 | };
|
6030 |
|
6031 | |
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 | assert.notNestedProperty = function (obj, prop, msg) {
|
6049 | new Assertion(obj, msg, assert.notNestedProperty, true)
|
6050 | .to.not.have.nested.property(prop);
|
6051 | };
|
6052 |
|
6053 | |
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 | assert.nestedPropertyVal = function (obj, prop, val, msg) {
|
6072 | new Assertion(obj, msg, assert.nestedPropertyVal, true)
|
6073 | .to.have.nested.property(prop, val);
|
6074 | };
|
6075 |
|
6076 | |
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 | assert.notNestedPropertyVal = function (obj, prop, val, msg) {
|
6096 | new Assertion(obj, msg, assert.notNestedPropertyVal, true)
|
6097 | .to.not.have.nested.property(prop, val);
|
6098 | };
|
6099 |
|
6100 | |
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 |
|
6111 |
|
6112 |
|
6113 |
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 | assert.deepNestedPropertyVal = function (obj, prop, val, msg) {
|
6119 | new Assertion(obj, msg, assert.deepNestedPropertyVal, true)
|
6120 | .to.have.deep.nested.property(prop, val);
|
6121 | };
|
6122 |
|
6123 | |
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 | assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) {
|
6144 | new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true)
|
6145 | .to.not.have.deep.nested.property(prop, val);
|
6146 | }
|
6147 |
|
6148 | |
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 | assert.lengthOf = function (exp, len, msg) {
|
6167 | new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
|
6168 | };
|
6169 |
|
6170 | |
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 |
|
6189 |
|
6190 | assert.hasAnyKeys = function (obj, keys, msg) {
|
6191 | new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
|
6192 | }
|
6193 |
|
6194 | |
6195 |
|
6196 |
|
6197 |
|
6198 |
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 | assert.hasAllKeys = function (obj, keys, msg) {
|
6215 | new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
|
6216 | }
|
6217 |
|
6218 | |
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 |
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 | assert.containsAllKeys = function (obj, keys, msg) {
|
6243 | new Assertion(obj, msg, assert.containsAllKeys, true)
|
6244 | .to.contain.all.keys(keys);
|
6245 | }
|
6246 |
|
6247 | |
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 | assert.doesNotHaveAnyKeys = function (obj, keys, msg) {
|
6268 | new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true)
|
6269 | .to.not.have.any.keys(keys);
|
6270 | }
|
6271 |
|
6272 | |
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 | assert.doesNotHaveAllKeys = function (obj, keys, msg) {
|
6293 | new Assertion(obj, msg, assert.doesNotHaveAllKeys, true)
|
6294 | .to.not.have.all.keys(keys);
|
6295 | }
|
6296 |
|
6297 | |
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 | assert.hasAnyDeepKeys = function (obj, keys, msg) {
|
6322 | new Assertion(obj, msg, assert.hasAnyDeepKeys, true)
|
6323 | .to.have.any.deep.keys(keys);
|
6324 | }
|
6325 |
|
6326 | |
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 | assert.hasAllDeepKeys = function (obj, keys, msg) {
|
6349 | new Assertion(obj, msg, assert.hasAllDeepKeys, true)
|
6350 | .to.have.all.deep.keys(keys);
|
6351 | }
|
6352 |
|
6353 | |
6354 |
|
6355 |
|
6356 |
|
6357 |
|
6358 |
|
6359 |
|
6360 |
|
6361 |
|
6362 |
|
6363 |
|
6364 |
|
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 | assert.containsAllDeepKeys = function (obj, keys, msg) {
|
6376 | new Assertion(obj, msg, assert.containsAllDeepKeys, true)
|
6377 | .to.contain.all.deep.keys(keys);
|
6378 | }
|
6379 |
|
6380 | |
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 |
|
6396 |
|
6397 |
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 | assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) {
|
6403 | new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true)
|
6404 | .to.not.have.any.deep.keys(keys);
|
6405 | }
|
6406 |
|
6407 | |
6408 |
|
6409 |
|
6410 |
|
6411 |
|
6412 |
|
6413 |
|
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 |
|
6429 | assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) {
|
6430 | new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true)
|
6431 | .to.not.have.all.deep.keys(keys);
|
6432 | }
|
6433 |
|
6434 | |
6435 |
|
6436 |
|
6437 |
|
6438 |
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 |
|
6449 |
|
6450 |
|
6451 |
|
6452 |
|
6453 |
|
6454 |
|
6455 |
|
6456 |
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 |
|
6464 |
|
6465 | assert.throws = function (fn, errorLike, errMsgMatcher, msg) {
|
6466 | if ('string' === typeof errorLike || errorLike instanceof RegExp) {
|
6467 | errMsgMatcher = errorLike;
|
6468 | errorLike = null;
|
6469 | }
|
6470 |
|
6471 | var assertErr = new Assertion(fn, msg, assert.throws, true)
|
6472 | .to.throw(errorLike, errMsgMatcher);
|
6473 | return flag(assertErr, 'object');
|
6474 | };
|
6475 |
|
6476 | |
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 |
|
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 |
|
6489 |
|
6490 |
|
6491 |
|
6492 |
|
6493 |
|
6494 |
|
6495 |
|
6496 |
|
6497 |
|
6498 |
|
6499 |
|
6500 |
|
6501 |
|
6502 |
|
6503 |
|
6504 |
|
6505 | assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) {
|
6506 | if ('string' === typeof errorLike || errorLike instanceof RegExp) {
|
6507 | errMsgMatcher = errorLike;
|
6508 | errorLike = null;
|
6509 | }
|
6510 |
|
6511 | new Assertion(fn, msg, assert.doesNotThrow, true)
|
6512 | .to.not.throw(errorLike, errMsgMatcher);
|
6513 | };
|
6514 |
|
6515 | |
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 | assert.operator = function (val, operator, val2, msg) {
|
6533 | var ok;
|
6534 | switch(operator) {
|
6535 | case '==':
|
6536 | ok = val == val2;
|
6537 | break;
|
6538 | case '===':
|
6539 | ok = val === val2;
|
6540 | break;
|
6541 | case '>':
|
6542 | ok = val > val2;
|
6543 | break;
|
6544 | case '>=':
|
6545 | ok = val >= val2;
|
6546 | break;
|
6547 | case '<':
|
6548 | ok = val < val2;
|
6549 | break;
|
6550 | case '<=':
|
6551 | ok = val <= val2;
|
6552 | break;
|
6553 | case '!=':
|
6554 | ok = val != val2;
|
6555 | break;
|
6556 | case '!==':
|
6557 | ok = val !== val2;
|
6558 | break;
|
6559 | default:
|
6560 | msg = msg ? msg + ': ' : msg;
|
6561 | throw new chai.AssertionError(
|
6562 | msg + 'Invalid operator "' + operator + '"',
|
6563 | undefined,
|
6564 | assert.operator
|
6565 | );
|
6566 | }
|
6567 | var test = new Assertion(ok, msg, assert.operator, true);
|
6568 | test.assert(
|
6569 | true === flag(test, 'object')
|
6570 | , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
|
6571 | , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
|
6572 | };
|
6573 |
|
6574 | |
6575 |
|
6576 |
|
6577 |
|
6578 |
|
6579 |
|
6580 |
|
6581 |
|
6582 |
|
6583 |
|
6584 |
|
6585 |
|
6586 |
|
6587 |
|
6588 |
|
6589 |
|
6590 | assert.closeTo = function (act, exp, delta, msg) {
|
6591 | new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
|
6592 | };
|
6593 |
|
6594 | |
6595 |
|
6596 |
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 |
|
6606 |
|
6607 |
|
6608 |
|
6609 |
|
6610 | assert.approximately = function (act, exp, delta, msg) {
|
6611 | new Assertion(act, msg, assert.approximately, true)
|
6612 | .to.be.approximately(exp, delta);
|
6613 | };
|
6614 |
|
6615 | |
6616 |
|
6617 |
|
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 |
|
6625 |
|
6626 |
|
6627 |
|
6628 |
|
6629 |
|
6630 |
|
6631 | assert.sameMembers = function (set1, set2, msg) {
|
6632 | new Assertion(set1, msg, assert.sameMembers, true)
|
6633 | .to.have.same.members(set2);
|
6634 | }
|
6635 |
|
6636 | |
6637 |
|
6638 |
|
6639 |
|
6640 |
|
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 | assert.notSameMembers = function (set1, set2, msg) {
|
6653 | new Assertion(set1, msg, assert.notSameMembers, true)
|
6654 | .to.not.have.same.members(set2);
|
6655 | }
|
6656 |
|
6657 | |
6658 |
|
6659 |
|
6660 |
|
6661 |
|
6662 |
|
6663 |
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 |
|
6672 |
|
6673 | assert.sameDeepMembers = function (set1, set2, msg) {
|
6674 | new Assertion(set1, msg, assert.sameDeepMembers, true)
|
6675 | .to.have.same.deep.members(set2);
|
6676 | }
|
6677 |
|
6678 | |
6679 |
|
6680 |
|
6681 |
|
6682 |
|
6683 |
|
6684 |
|
6685 |
|
6686 |
|
6687 |
|
6688 |
|
6689 |
|
6690 |
|
6691 |
|
6692 |
|
6693 |
|
6694 | assert.notSameDeepMembers = function (set1, set2, msg) {
|
6695 | new Assertion(set1, msg, assert.notSameDeepMembers, true)
|
6696 | .to.not.have.same.deep.members(set2);
|
6697 | }
|
6698 |
|
6699 | |
6700 |
|
6701 |
|
6702 |
|
6703 |
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 |
|
6711 |
|
6712 |
|
6713 |
|
6714 |
|
6715 | assert.sameOrderedMembers = function (set1, set2, msg) {
|
6716 | new Assertion(set1, msg, assert.sameOrderedMembers, true)
|
6717 | .to.have.same.ordered.members(set2);
|
6718 | }
|
6719 |
|
6720 | |
6721 |
|
6722 |
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 |
|
6729 |
|
6730 |
|
6731 |
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 | assert.notSameOrderedMembers = function (set1, set2, msg) {
|
6737 | new Assertion(set1, msg, assert.notSameOrderedMembers, true)
|
6738 | .to.not.have.same.ordered.members(set2);
|
6739 | }
|
6740 |
|
6741 | |
6742 |
|
6743 |
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 | assert.sameDeepOrderedMembers = function (set1, set2, msg) {
|
6758 | new Assertion(set1, msg, assert.sameDeepOrderedMembers, true)
|
6759 | .to.have.same.deep.ordered.members(set2);
|
6760 | }
|
6761 |
|
6762 | |
6763 |
|
6764 |
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 |
|
6770 |
|
6771 |
|
6772 |
|
6773 |
|
6774 |
|
6775 |
|
6776 |
|
6777 |
|
6778 |
|
6779 | assert.notSameDeepOrderedMembers = function (set1, set2, msg) {
|
6780 | new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true)
|
6781 | .to.not.have.same.deep.ordered.members(set2);
|
6782 | }
|
6783 |
|
6784 | |
6785 |
|
6786 |
|
6787 |
|
6788 |
|
6789 |
|
6790 |
|
6791 |
|
6792 |
|
6793 |
|
6794 |
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 | assert.includeMembers = function (superset, subset, msg) {
|
6801 | new Assertion(superset, msg, assert.includeMembers, true)
|
6802 | .to.include.members(subset);
|
6803 | }
|
6804 |
|
6805 | |
6806 |
|
6807 |
|
6808 |
|
6809 |
|
6810 |
|
6811 |
|
6812 |
|
6813 |
|
6814 |
|
6815 |
|
6816 |
|
6817 |
|
6818 |
|
6819 |
|
6820 |
|
6821 | assert.notIncludeMembers = function (superset, subset, msg) {
|
6822 | new Assertion(superset, msg, assert.notIncludeMembers, true)
|
6823 | .to.not.include.members(subset);
|
6824 | }
|
6825 |
|
6826 | |
6827 |
|
6828 |
|
6829 |
|
6830 |
|
6831 |
|
6832 |
|
6833 |
|
6834 |
|
6835 |
|
6836 |
|
6837 |
|
6838 |
|
6839 |
|
6840 |
|
6841 |
|
6842 | assert.includeDeepMembers = function (superset, subset, msg) {
|
6843 | new Assertion(superset, msg, assert.includeDeepMembers, true)
|
6844 | .to.include.deep.members(subset);
|
6845 | }
|
6846 |
|
6847 | |
6848 |
|
6849 |
|
6850 |
|
6851 |
|
6852 |
|
6853 |
|
6854 |
|
6855 |
|
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 |
|
6861 |
|
6862 |
|
6863 | assert.notIncludeDeepMembers = function (superset, subset, msg) {
|
6864 | new Assertion(superset, msg, assert.notIncludeDeepMembers, true)
|
6865 | .to.not.include.deep.members(subset);
|
6866 | }
|
6867 |
|
6868 | |
6869 |
|
6870 |
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 |
|
6881 |
|
6882 |
|
6883 |
|
6884 |
|
6885 | assert.includeOrderedMembers = function (superset, subset, msg) {
|
6886 | new Assertion(superset, msg, assert.includeOrderedMembers, true)
|
6887 | .to.include.ordered.members(subset);
|
6888 | }
|
6889 |
|
6890 | |
6891 |
|
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 |
|
6897 |
|
6898 |
|
6899 |
|
6900 |
|
6901 |
|
6902 |
|
6903 |
|
6904 |
|
6905 |
|
6906 |
|
6907 |
|
6908 | assert.notIncludeOrderedMembers = function (superset, subset, msg) {
|
6909 | new Assertion(superset, msg, assert.notIncludeOrderedMembers, true)
|
6910 | .to.not.include.ordered.members(subset);
|
6911 | }
|
6912 |
|
6913 | |
6914 |
|
6915 |
|
6916 |
|
6917 |
|
6918 |
|
6919 |
|
6920 |
|
6921 |
|
6922 |
|
6923 |
|
6924 |
|
6925 |
|
6926 |
|
6927 |
|
6928 |
|
6929 |
|
6930 | assert.includeDeepOrderedMembers = function (superset, subset, msg) {
|
6931 | new Assertion(superset, msg, assert.includeDeepOrderedMembers, true)
|
6932 | .to.include.deep.ordered.members(subset);
|
6933 | }
|
6934 |
|
6935 | |
6936 |
|
6937 |
|
6938 |
|
6939 |
|
6940 |
|
6941 |
|
6942 |
|
6943 |
|
6944 |
|
6945 |
|
6946 |
|
6947 |
|
6948 |
|
6949 |
|
6950 |
|
6951 |
|
6952 |
|
6953 |
|
6954 | assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) {
|
6955 | new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true)
|
6956 | .to.not.include.deep.ordered.members(subset);
|
6957 | }
|
6958 |
|
6959 | |
6960 |
|
6961 |
|
6962 |
|
6963 |
|
6964 |
|
6965 |
|
6966 |
|
6967 |
|
6968 |
|
6969 |
|
6970 |
|
6971 |
|
6972 |
|
6973 |
|
6974 | assert.oneOf = function (inList, list, msg) {
|
6975 | new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
|
6976 | }
|
6977 |
|
6978 | |
6979 |
|
6980 |
|
6981 |
|
6982 |
|
6983 |
|
6984 |
|
6985 |
|
6986 |
|
6987 |
|
6988 |
|
6989 |
|
6990 |
|
6991 |
|
6992 |
|
6993 |
|
6994 |
|
6995 |
|
6996 | assert.changes = function (fn, obj, prop, msg) {
|
6997 | if (arguments.length === 3 && typeof obj === 'function') {
|
6998 | msg = prop;
|
6999 | prop = null;
|
7000 | }
|
7001 |
|
7002 | new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
|
7003 | }
|
7004 |
|
7005 | |
7006 |
|
7007 |
|
7008 |
|
7009 |
|
7010 |
|
7011 |
|
7012 |
|
7013 |
|
7014 |
|
7015 |
|
7016 |
|
7017 |
|
7018 |
|
7019 |
|
7020 |
|
7021 |
|
7022 |
|
7023 |
|
7024 | assert.changesBy = function (fn, obj, prop, delta, msg) {
|
7025 | if (arguments.length === 4 && typeof obj === 'function') {
|
7026 | var tmpMsg = delta;
|
7027 | delta = prop;
|
7028 | msg = tmpMsg;
|
7029 | } else if (arguments.length === 3) {
|
7030 | delta = prop;
|
7031 | prop = null;
|
7032 | }
|
7033 |
|
7034 | new Assertion(fn, msg, assert.changesBy, true)
|
7035 | .to.change(obj, prop).by(delta);
|
7036 | }
|
7037 |
|
7038 | |
7039 |
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 |
|
7047 |
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 |
|
7054 |
|
7055 |
|
7056 | assert.doesNotChange = function (fn, obj, prop, msg) {
|
7057 | if (arguments.length === 3 && typeof obj === 'function') {
|
7058 | msg = prop;
|
7059 | prop = null;
|
7060 | }
|
7061 |
|
7062 | return new Assertion(fn, msg, assert.doesNotChange, true)
|
7063 | .to.not.change(obj, prop);
|
7064 | }
|
7065 |
|
7066 | |
7067 |
|
7068 |
|
7069 |
|
7070 |
|
7071 |
|
7072 |
|
7073 |
|
7074 |
|
7075 |
|
7076 |
|
7077 |
|
7078 |
|
7079 |
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 |
|
7085 | assert.changesButNotBy = function (fn, obj, prop, delta, msg) {
|
7086 | if (arguments.length === 4 && typeof obj === 'function') {
|
7087 | var tmpMsg = delta;
|
7088 | delta = prop;
|
7089 | msg = tmpMsg;
|
7090 | } else if (arguments.length === 3) {
|
7091 | delta = prop;
|
7092 | prop = null;
|
7093 | }
|
7094 |
|
7095 | new Assertion(fn, msg, assert.changesButNotBy, true)
|
7096 | .to.change(obj, prop).but.not.by(delta);
|
7097 | }
|
7098 |
|
7099 | |
7100 |
|
7101 |
|
7102 |
|
7103 |
|
7104 |
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 |
|
7110 |
|
7111 |
|
7112 |
|
7113 |
|
7114 |
|
7115 |
|
7116 |
|
7117 | assert.increases = function (fn, obj, prop, msg) {
|
7118 | if (arguments.length === 3 && typeof obj === 'function') {
|
7119 | msg = prop;
|
7120 | prop = null;
|
7121 | }
|
7122 |
|
7123 | return new Assertion(fn, msg, assert.increases, true)
|
7124 | .to.increase(obj, prop);
|
7125 | }
|
7126 |
|
7127 | |
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 |
|
7141 |
|
7142 |
|
7143 |
|
7144 |
|
7145 |
|
7146 | assert.increasesBy = function (fn, obj, prop, delta, msg) {
|
7147 | if (arguments.length === 4 && typeof obj === 'function') {
|
7148 | var tmpMsg = delta;
|
7149 | delta = prop;
|
7150 | msg = tmpMsg;
|
7151 | } else if (arguments.length === 3) {
|
7152 | delta = prop;
|
7153 | prop = null;
|
7154 | }
|
7155 |
|
7156 | new Assertion(fn, msg, assert.increasesBy, true)
|
7157 | .to.increase(obj, prop).by(delta);
|
7158 | }
|
7159 |
|
7160 | |
7161 |
|
7162 |
|
7163 |
|
7164 |
|
7165 |
|
7166 |
|
7167 |
|
7168 |
|
7169 |
|
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 |
|
7178 | assert.doesNotIncrease = function (fn, obj, prop, msg) {
|
7179 | if (arguments.length === 3 && typeof obj === 'function') {
|
7180 | msg = prop;
|
7181 | prop = null;
|
7182 | }
|
7183 |
|
7184 | return new Assertion(fn, msg, assert.doesNotIncrease, true)
|
7185 | .to.not.increase(obj, prop);
|
7186 | }
|
7187 |
|
7188 | |
7189 |
|
7190 |
|
7191 |
|
7192 |
|
7193 |
|
7194 |
|
7195 |
|
7196 |
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 |
|
7204 |
|
7205 |
|
7206 |
|
7207 | assert.increasesButNotBy = function (fn, obj, prop, delta, msg) {
|
7208 | if (arguments.length === 4 && typeof obj === 'function') {
|
7209 | var tmpMsg = delta;
|
7210 | delta = prop;
|
7211 | msg = tmpMsg;
|
7212 | } else if (arguments.length === 3) {
|
7213 | delta = prop;
|
7214 | prop = null;
|
7215 | }
|
7216 |
|
7217 | new Assertion(fn, msg, assert.increasesButNotBy, true)
|
7218 | .to.increase(obj, prop).but.not.by(delta);
|
7219 | }
|
7220 |
|
7221 | |
7222 |
|
7223 |
|
7224 |
|
7225 |
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 |
|
7238 |
|
7239 | assert.decreases = function (fn, obj, prop, msg) {
|
7240 | if (arguments.length === 3 && typeof obj === 'function') {
|
7241 | msg = prop;
|
7242 | prop = null;
|
7243 | }
|
7244 |
|
7245 | return new Assertion(fn, msg, assert.decreases, true)
|
7246 | .to.decrease(obj, prop);
|
7247 | }
|
7248 |
|
7249 | |
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 |
|
7259 |
|
7260 |
|
7261 |
|
7262 |
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 |
|
7268 | assert.decreasesBy = function (fn, obj, prop, delta, msg) {
|
7269 | if (arguments.length === 4 && typeof obj === 'function') {
|
7270 | var tmpMsg = delta;
|
7271 | delta = prop;
|
7272 | msg = tmpMsg;
|
7273 | } else if (arguments.length === 3) {
|
7274 | delta = prop;
|
7275 | prop = null;
|
7276 | }
|
7277 |
|
7278 | new Assertion(fn, msg, assert.decreasesBy, true)
|
7279 | .to.decrease(obj, prop).by(delta);
|
7280 | }
|
7281 |
|
7282 | |
7283 |
|
7284 |
|
7285 |
|
7286 |
|
7287 |
|
7288 |
|
7289 |
|
7290 |
|
7291 |
|
7292 |
|
7293 |
|
7294 |
|
7295 |
|
7296 |
|
7297 |
|
7298 |
|
7299 |
|
7300 | assert.doesNotDecrease = function (fn, obj, prop, msg) {
|
7301 | if (arguments.length === 3 && typeof obj === 'function') {
|
7302 | msg = prop;
|
7303 | prop = null;
|
7304 | }
|
7305 |
|
7306 | return new Assertion(fn, msg, assert.doesNotDecrease, true)
|
7307 | .to.not.decrease(obj, prop);
|
7308 | }
|
7309 |
|
7310 | |
7311 |
|
7312 |
|
7313 |
|
7314 |
|
7315 |
|
7316 |
|
7317 |
|
7318 |
|
7319 |
|
7320 |
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 |
|
7326 |
|
7327 |
|
7328 |
|
7329 | assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) {
|
7330 | if (arguments.length === 4 && typeof obj === 'function') {
|
7331 | var tmpMsg = delta;
|
7332 | delta = prop;
|
7333 | msg = tmpMsg;
|
7334 | } else if (arguments.length === 3) {
|
7335 | delta = prop;
|
7336 | prop = null;
|
7337 | }
|
7338 |
|
7339 | return new Assertion(fn, msg, assert.doesNotDecreaseBy, true)
|
7340 | .to.not.decrease(obj, prop).by(delta);
|
7341 | }
|
7342 |
|
7343 | |
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 |
|
7349 |
|
7350 |
|
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 |
|
7362 | assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) {
|
7363 | if (arguments.length === 4 && typeof obj === 'function') {
|
7364 | var tmpMsg = delta;
|
7365 | delta = prop;
|
7366 | msg = tmpMsg;
|
7367 | } else if (arguments.length === 3) {
|
7368 | delta = prop;
|
7369 | prop = null;
|
7370 | }
|
7371 |
|
7372 | new Assertion(fn, msg, assert.decreasesButNotBy, true)
|
7373 | .to.decrease(obj, prop).but.not.by(delta);
|
7374 | }
|
7375 |
|
7376 | |
7377 |
|
7378 |
|
7379 |
|
7380 |
|
7381 |
|
7382 |
|
7383 |
|
7384 |
|
7385 |
|
7386 |
|
7387 |
|
7388 |
|
7389 |
|
7390 |
|
7391 |
|
7392 | assert.ifError = function (val) {
|
7393 | if (val) {
|
7394 | throw(val);
|
7395 | }
|
7396 | };
|
7397 |
|
7398 | |
7399 |
|
7400 |
|
7401 |
|
7402 |
|
7403 |
|
7404 |
|
7405 |
|
7406 |
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 |
|
7413 | assert.isExtensible = function (obj, msg) {
|
7414 | new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
|
7415 | };
|
7416 |
|
7417 | |
7418 |
|
7419 |
|
7420 |
|
7421 |
|
7422 |
|
7423 |
|
7424 |
|
7425 |
|
7426 |
|
7427 |
|
7428 |
|
7429 |
|
7430 |
|
7431 |
|
7432 |
|
7433 |
|
7434 |
|
7435 |
|
7436 |
|
7437 |
|
7438 | assert.isNotExtensible = function (obj, msg) {
|
7439 | new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
|
7440 | };
|
7441 |
|
7442 | |
7443 |
|
7444 |
|
7445 |
|
7446 |
|
7447 |
|
7448 |
|
7449 |
|
7450 |
|
7451 |
|
7452 |
|
7453 |
|
7454 |
|
7455 |
|
7456 |
|
7457 |
|
7458 |
|
7459 |
|
7460 |
|
7461 |
|
7462 | assert.isSealed = function (obj, msg) {
|
7463 | new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
|
7464 | };
|
7465 |
|
7466 | |
7467 |
|
7468 |
|
7469 |
|
7470 |
|
7471 |
|
7472 |
|
7473 |
|
7474 |
|
7475 |
|
7476 |
|
7477 |
|
7478 |
|
7479 |
|
7480 |
|
7481 | assert.isNotSealed = function (obj, msg) {
|
7482 | new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
|
7483 | };
|
7484 |
|
7485 | |
7486 |
|
7487 |
|
7488 |
|
7489 |
|
7490 |
|
7491 |
|
7492 |
|
7493 |
|
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 | assert.isFrozen = function (obj, msg) {
|
7503 | new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
|
7504 | };
|
7505 |
|
7506 | |
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 |
|
7518 |
|
7519 |
|
7520 |
|
7521 | assert.isNotFrozen = function (obj, msg) {
|
7522 | new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
|
7523 | };
|
7524 |
|
7525 | |
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 |
|
7533 |
|
7534 |
|
7535 |
|
7536 |
|
7537 |
|
7538 |
|
7539 |
|
7540 |
|
7541 |
|
7542 |
|
7543 |
|
7544 |
|
7545 |
|
7546 |
|
7547 | assert.isEmpty = function(val, msg) {
|
7548 | new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
|
7549 | };
|
7550 |
|
7551 | |
7552 |
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 |
|
7562 |
|
7563 |
|
7564 |
|
7565 |
|
7566 |
|
7567 |
|
7568 |
|
7569 |
|
7570 |
|
7571 |
|
7572 |
|
7573 | assert.isNotEmpty = function(val, msg) {
|
7574 | new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
|
7575 | };
|
7576 |
|
7577 | |
7578 |
|
7579 |
|
7580 |
|
7581 | (function alias(name, as){
|
7582 | assert[as] = assert[name];
|
7583 | return alias;
|
7584 | })
|
7585 | ('isOk', 'ok')
|
7586 | ('isNotOk', 'notOk')
|
7587 | ('throws', 'throw')
|
7588 | ('throws', 'Throw')
|
7589 | ('isExtensible', 'extensible')
|
7590 | ('isNotExtensible', 'notExtensible')
|
7591 | ('isSealed', 'sealed')
|
7592 | ('isNotSealed', 'notSealed')
|
7593 | ('isFrozen', 'frozen')
|
7594 | ('isNotFrozen', 'notFrozen')
|
7595 | ('isEmpty', 'empty')
|
7596 | ('isNotEmpty', 'notEmpty');
|
7597 | };
|
7598 |
|
7599 |
|
7600 | }),
|
7601 |
|
7602 | "./node_modules/chai/lib/chai/interface/expect.js":
|
7603 |
|
7604 |
|
7605 |
|
7606 | ((module) => {
|
7607 |
|
7608 |
|
7609 |
|
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 | module.exports = function (chai, util) {
|
7615 | chai.expect = function (val, message) {
|
7616 | return new chai.Assertion(val, message);
|
7617 | };
|
7618 |
|
7619 | |
7620 |
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 |
|
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 | chai.expect.fail = function (actual, expected, message, operator) {
|
7642 | if (arguments.length < 2) {
|
7643 | message = actual;
|
7644 | actual = undefined;
|
7645 | }
|
7646 |
|
7647 | message = message || 'expect.fail()';
|
7648 | throw new chai.AssertionError(message, {
|
7649 | actual: actual
|
7650 | , expected: expected
|
7651 | , operator: operator
|
7652 | }, chai.expect.fail);
|
7653 | };
|
7654 | };
|
7655 |
|
7656 |
|
7657 | }),
|
7658 |
|
7659 | "./node_modules/chai/lib/chai/interface/should.js":
|
7660 |
|
7661 |
|
7662 |
|
7663 | ((module) => {
|
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 |
|
7669 |
|
7670 |
|
7671 | module.exports = function (chai, util) {
|
7672 | var Assertion = chai.Assertion;
|
7673 |
|
7674 | function loadShould () {
|
7675 |
|
7676 | function shouldGetter() {
|
7677 | if (this instanceof String
|
7678 | || this instanceof Number
|
7679 | || this instanceof Boolean
|
7680 | || typeof Symbol === 'function' && this instanceof Symbol
|
7681 | || typeof BigInt === 'function' && this instanceof BigInt) {
|
7682 | return new Assertion(this.valueOf(), null, shouldGetter);
|
7683 | }
|
7684 | return new Assertion(this, null, shouldGetter);
|
7685 | }
|
7686 | function shouldSetter(value) {
|
7687 |
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 | Object.defineProperty(this, 'should', {
|
7694 | value: value,
|
7695 | enumerable: true,
|
7696 | configurable: true,
|
7697 | writable: true
|
7698 | });
|
7699 | }
|
7700 |
|
7701 | Object.defineProperty(Object.prototype, 'should', {
|
7702 | set: shouldSetter
|
7703 | , get: shouldGetter
|
7704 | , configurable: true
|
7705 | });
|
7706 |
|
7707 | var should = {};
|
7708 |
|
7709 | |
7710 |
|
7711 |
|
7712 |
|
7713 |
|
7714 |
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 |
|
7724 |
|
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 |
|
7730 |
|
7731 |
|
7732 | should.fail = function (actual, expected, message, operator) {
|
7733 | if (arguments.length < 2) {
|
7734 | message = actual;
|
7735 | actual = undefined;
|
7736 | }
|
7737 |
|
7738 | message = message || 'should.fail()';
|
7739 | throw new chai.AssertionError(message, {
|
7740 | actual: actual
|
7741 | , expected: expected
|
7742 | , operator: operator
|
7743 | }, should.fail);
|
7744 | };
|
7745 |
|
7746 | |
7747 |
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 |
|
7759 |
|
7760 |
|
7761 | should.equal = function (val1, val2, msg) {
|
7762 | new Assertion(val1, msg).to.equal(val2);
|
7763 | };
|
7764 |
|
7765 | |
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 |
|
7785 |
|
7786 |
|
7787 |
|
7788 |
|
7789 | should.Throw = function (fn, errt, errs, msg) {
|
7790 | new Assertion(fn, msg).to.Throw(errt, errs);
|
7791 | };
|
7792 |
|
7793 | |
7794 |
|
7795 |
|
7796 |
|
7797 |
|
7798 |
|
7799 |
|
7800 |
|
7801 |
|
7802 |
|
7803 |
|
7804 |
|
7805 |
|
7806 |
|
7807 | should.exist = function (val, msg) {
|
7808 | new Assertion(val, msg).to.exist;
|
7809 | }
|
7810 |
|
7811 |
|
7812 | should.not = {}
|
7813 |
|
7814 | |
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 |
|
7821 |
|
7822 |
|
7823 |
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 |
|
7829 | should.not.equal = function (val1, val2, msg) {
|
7830 | new Assertion(val1, msg).to.not.equal(val2);
|
7831 | };
|
7832 |
|
7833 | |
7834 |
|
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 |
|
7840 |
|
7841 |
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 |
|
7850 |
|
7851 |
|
7852 |
|
7853 | should.not.Throw = function (fn, errt, errs, msg) {
|
7854 | new Assertion(fn, msg).to.not.Throw(errt, errs);
|
7855 | };
|
7856 |
|
7857 | |
7858 |
|
7859 |
|
7860 |
|
7861 |
|
7862 |
|
7863 |
|
7864 |
|
7865 |
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 | should.not.exist = function (val, msg) {
|
7872 | new Assertion(val, msg).to.not.exist;
|
7873 | }
|
7874 |
|
7875 | should['throw'] = should['Throw'];
|
7876 | should.not['throw'] = should.not['Throw'];
|
7877 |
|
7878 | return should;
|
7879 | };
|
7880 |
|
7881 | chai.should = loadShould;
|
7882 | chai.Should = loadShould;
|
7883 | };
|
7884 |
|
7885 |
|
7886 | }),
|
7887 |
|
7888 | "./node_modules/chai/lib/chai/utils/addChainableMethod.js":
|
7889 |
|
7890 |
|
7891 |
|
7892 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 | var addLengthGuard = __webpack_require__( "./node_modules/chai/lib/chai/utils/addLengthGuard.js");
|
7905 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
7906 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
7907 | var proxify = __webpack_require__( "./node_modules/chai/lib/chai/utils/proxify.js");
|
7908 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
7909 |
|
7910 |
|
7911 |
|
7912 |
|
7913 |
|
7914 |
|
7915 | var canSetPrototype = typeof Object.setPrototypeOf === 'function';
|
7916 |
|
7917 |
|
7918 |
|
7919 | var testFn = function() {};
|
7920 | var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
7921 | var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 | if (typeof propDesc !== 'object')
|
7928 | return true;
|
7929 |
|
7930 | return !propDesc.configurable;
|
7931 | });
|
7932 |
|
7933 |
|
7934 | var call = Function.prototype.call,
|
7935 | apply = Function.prototype.apply;
|
7936 |
|
7937 |
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 |
|
7950 |
|
7951 |
|
7952 |
|
7953 |
|
7954 |
|
7955 |
|
7956 |
|
7957 |
|
7958 |
|
7959 |
|
7960 |
|
7961 |
|
7962 |
|
7963 |
|
7964 |
|
7965 |
|
7966 | module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) {
|
7967 | if (typeof chainingBehavior !== 'function') {
|
7968 | chainingBehavior = function () { };
|
7969 | }
|
7970 |
|
7971 | var chainableBehavior = {
|
7972 | method: method
|
7973 | , chainingBehavior: chainingBehavior
|
7974 | };
|
7975 |
|
7976 |
|
7977 | if (!ctx.__methods) {
|
7978 | ctx.__methods = {};
|
7979 | }
|
7980 | ctx.__methods[name] = chainableBehavior;
|
7981 |
|
7982 | Object.defineProperty(ctx, name,
|
7983 | { get: function chainableMethodGetter() {
|
7984 | chainableBehavior.chainingBehavior.call(this);
|
7985 |
|
7986 | var chainableMethodWrapper = function () {
|
7987 |
|
7988 |
|
7989 |
|
7990 |
|
7991 |
|
7992 |
|
7993 |
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 |
|
7999 |
|
8000 |
|
8001 |
|
8002 | if (!flag(this, 'lockSsfi')) {
|
8003 | flag(this, 'ssfi', chainableMethodWrapper);
|
8004 | }
|
8005 |
|
8006 | var result = chainableBehavior.method.apply(this, arguments);
|
8007 | if (result !== undefined) {
|
8008 | return result;
|
8009 | }
|
8010 |
|
8011 | var newAssertion = new chai.Assertion();
|
8012 | transferFlags(this, newAssertion);
|
8013 | return newAssertion;
|
8014 | };
|
8015 |
|
8016 | addLengthGuard(chainableMethodWrapper, name, true);
|
8017 |
|
8018 |
|
8019 | if (canSetPrototype) {
|
8020 |
|
8021 | var prototype = Object.create(this);
|
8022 |
|
8023 | prototype.call = call;
|
8024 | prototype.apply = apply;
|
8025 | Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
8026 | }
|
8027 |
|
8028 | else {
|
8029 | var asserterNames = Object.getOwnPropertyNames(ctx);
|
8030 | asserterNames.forEach(function (asserterName) {
|
8031 | if (excludeNames.indexOf(asserterName) !== -1) {
|
8032 | return;
|
8033 | }
|
8034 |
|
8035 | var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
8036 | Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
8037 | });
|
8038 | }
|
8039 |
|
8040 | transferFlags(this, chainableMethodWrapper);
|
8041 | return proxify(chainableMethodWrapper);
|
8042 | }
|
8043 | , configurable: true
|
8044 | });
|
8045 | };
|
8046 |
|
8047 |
|
8048 | }),
|
8049 |
|
8050 | "./node_modules/chai/lib/chai/utils/addLengthGuard.js":
|
8051 |
|
8052 |
|
8053 |
|
8054 | ((module) => {
|
8055 |
|
8056 | var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
|
8057 |
|
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 |
|
8069 |
|
8070 |
|
8071 |
|
8072 |
|
8073 |
|
8074 |
|
8075 |
|
8076 |
|
8077 |
|
8078 |
|
8079 |
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 |
|
8095 |
|
8096 |
|
8097 |
|
8098 | module.exports = function addLengthGuard (fn, assertionName, isChainable) {
|
8099 | if (!fnLengthDesc.configurable) return fn;
|
8100 |
|
8101 | Object.defineProperty(fn, 'length', {
|
8102 | get: function () {
|
8103 | if (isChainable) {
|
8104 | throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +
|
8105 | ' to a compatibility issue, "length" cannot directly follow "' +
|
8106 | assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
|
8107 | }
|
8108 |
|
8109 | throw Error('Invalid Chai property: ' + assertionName + '.length. See' +
|
8110 | ' docs for proper usage of "' + assertionName + '".');
|
8111 | }
|
8112 | });
|
8113 |
|
8114 | return fn;
|
8115 | };
|
8116 |
|
8117 |
|
8118 | }),
|
8119 |
|
8120 | "./node_modules/chai/lib/chai/utils/addMethod.js":
|
8121 |
|
8122 |
|
8123 |
|
8124 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 | var addLengthGuard = __webpack_require__( "./node_modules/chai/lib/chai/utils/addLengthGuard.js");
|
8133 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
8134 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
8135 | var proxify = __webpack_require__( "./node_modules/chai/lib/chai/utils/proxify.js");
|
8136 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
8137 |
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 |
|
8144 |
|
8145 |
|
8146 |
|
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 |
|
8154 |
|
8155 |
|
8156 |
|
8157 |
|
8158 |
|
8159 |
|
8160 |
|
8161 |
|
8162 |
|
8163 |
|
8164 | module.exports = function addMethod(ctx, name, method) {
|
8165 | var methodWrapper = function () {
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 |
|
8171 |
|
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 | if (!flag(this, 'lockSsfi')) {
|
8179 | flag(this, 'ssfi', methodWrapper);
|
8180 | }
|
8181 |
|
8182 | var result = method.apply(this, arguments);
|
8183 | if (result !== undefined)
|
8184 | return result;
|
8185 |
|
8186 | var newAssertion = new chai.Assertion();
|
8187 | transferFlags(this, newAssertion);
|
8188 | return newAssertion;
|
8189 | };
|
8190 |
|
8191 | addLengthGuard(methodWrapper, name, false);
|
8192 | ctx[name] = proxify(methodWrapper, name);
|
8193 | };
|
8194 |
|
8195 |
|
8196 | }),
|
8197 |
|
8198 | "./node_modules/chai/lib/chai/utils/addProperty.js":
|
8199 |
|
8200 |
|
8201 |
|
8202 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 |
|
8208 |
|
8209 |
|
8210 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
8211 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
8212 | var isProxyEnabled = __webpack_require__( "./node_modules/chai/lib/chai/utils/isProxyEnabled.js");
|
8213 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
8214 |
|
8215 |
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 |
|
8230 |
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 |
|
8238 |
|
8239 |
|
8240 |
|
8241 | module.exports = function addProperty(ctx, name, getter) {
|
8242 | getter = getter === undefined ? function () {} : getter;
|
8243 |
|
8244 | Object.defineProperty(ctx, name,
|
8245 | { get: function propertyGetter() {
|
8246 |
|
8247 |
|
8248 |
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 | if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
8262 | flag(this, 'ssfi', propertyGetter);
|
8263 | }
|
8264 |
|
8265 | var result = getter.call(this);
|
8266 | if (result !== undefined)
|
8267 | return result;
|
8268 |
|
8269 | var newAssertion = new chai.Assertion();
|
8270 | transferFlags(this, newAssertion);
|
8271 | return newAssertion;
|
8272 | }
|
8273 | , configurable: true
|
8274 | });
|
8275 | };
|
8276 |
|
8277 |
|
8278 | }),
|
8279 |
|
8280 | "./node_modules/chai/lib/chai/utils/compareByInspect.js":
|
8281 |
|
8282 |
|
8283 |
|
8284 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 |
|
8296 | var inspect = __webpack_require__( "./node_modules/chai/lib/chai/utils/inspect.js");
|
8297 |
|
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 |
|
8303 |
|
8304 |
|
8305 |
|
8306 |
|
8307 |
|
8308 |
|
8309 |
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 | module.exports = function compareByInspect(a, b) {
|
8315 | return inspect(a) < inspect(b) ? -1 : 1;
|
8316 | };
|
8317 |
|
8318 |
|
8319 | }),
|
8320 |
|
8321 | "./node_modules/chai/lib/chai/utils/expectTypes.js":
|
8322 |
|
8323 |
|
8324 |
|
8325 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8326 |
|
8327 |
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 |
|
8346 |
|
8347 | var AssertionError = __webpack_require__( "./node_modules/assertion-error/index.js");
|
8348 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
8349 | var type = __webpack_require__( "./node_modules/type-detect/type-detect.js");
|
8350 |
|
8351 | module.exports = function expectTypes(obj, types) {
|
8352 | var flagMsg = flag(obj, 'message');
|
8353 | var ssfi = flag(obj, 'ssfi');
|
8354 |
|
8355 | flagMsg = flagMsg ? flagMsg + ': ' : '';
|
8356 |
|
8357 | obj = flag(obj, 'object');
|
8358 | types = types.map(function (t) { return t.toLowerCase(); });
|
8359 | types.sort();
|
8360 |
|
8361 |
|
8362 | var str = types.map(function (t, index) {
|
8363 | var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
|
8364 | var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
|
8365 | return or + art + ' ' + t;
|
8366 | }).join(', ');
|
8367 |
|
8368 | var objType = type(obj).toLowerCase();
|
8369 |
|
8370 | if (!types.some(function (expected) { return objType === expected; })) {
|
8371 | throw new AssertionError(
|
8372 | flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
|
8373 | undefined,
|
8374 | ssfi
|
8375 | );
|
8376 | }
|
8377 | };
|
8378 |
|
8379 |
|
8380 | }),
|
8381 |
|
8382 | "./node_modules/chai/lib/chai/utils/flag.js":
|
8383 |
|
8384 |
|
8385 |
|
8386 | ((module) => {
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 | module.exports = function flag(obj, key, value) {
|
8414 | var flags = obj.__flags || (obj.__flags = Object.create(null));
|
8415 | if (arguments.length === 3) {
|
8416 | flags[key] = value;
|
8417 | } else {
|
8418 | return flags[key];
|
8419 | }
|
8420 | };
|
8421 |
|
8422 |
|
8423 | }),
|
8424 |
|
8425 | "./node_modules/chai/lib/chai/utils/getActual.js":
|
8426 |
|
8427 |
|
8428 |
|
8429 | ((module) => {
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 | module.exports = function getActual(obj, args) {
|
8449 | return args.length > 4 ? args[4] : obj._obj;
|
8450 | };
|
8451 |
|
8452 |
|
8453 | }),
|
8454 |
|
8455 | "./node_modules/chai/lib/chai/utils/getMessage.js":
|
8456 |
|
8457 |
|
8458 |
|
8459 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 |
|
8470 |
|
8471 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js")
|
8472 | , getActual = __webpack_require__( "./node_modules/chai/lib/chai/utils/getActual.js")
|
8473 | , objDisplay = __webpack_require__( "./node_modules/chai/lib/chai/utils/objDisplay.js");
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 |
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 | module.exports = function getMessage(obj, args) {
|
8495 | var negate = flag(obj, 'negate')
|
8496 | , val = flag(obj, 'object')
|
8497 | , expected = args[3]
|
8498 | , actual = getActual(obj, args)
|
8499 | , msg = negate ? args[2] : args[1]
|
8500 | , flagMsg = flag(obj, 'message');
|
8501 |
|
8502 | if(typeof msg === "function") msg = msg();
|
8503 | msg = msg || '';
|
8504 | msg = msg
|
8505 | .replace(/#\{this\}/g, function () { return objDisplay(val); })
|
8506 | .replace(/#\{act\}/g, function () { return objDisplay(actual); })
|
8507 | .replace(/#\{exp\}/g, function () { return objDisplay(expected); });
|
8508 |
|
8509 | return flagMsg ? flagMsg + ': ' + msg : msg;
|
8510 | };
|
8511 |
|
8512 |
|
8513 | }),
|
8514 |
|
8515 | "./node_modules/chai/lib/chai/utils/getOperator.js":
|
8516 |
|
8517 |
|
8518 |
|
8519 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8520 |
|
8521 | var type = __webpack_require__( "./node_modules/type-detect/type-detect.js");
|
8522 |
|
8523 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
8524 |
|
8525 | function isObjectType(obj) {
|
8526 | var objectType = type(obj);
|
8527 | var objectTypes = ['Array', 'Object', 'function'];
|
8528 |
|
8529 | return objectTypes.indexOf(objectType) !== -1;
|
8530 | }
|
8531 |
|
8532 |
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 | module.exports = function getOperator(obj, args) {
|
8549 | var operator = flag(obj, 'operator');
|
8550 | var negate = flag(obj, 'negate');
|
8551 | var expected = args[3];
|
8552 | var msg = negate ? args[2] : args[1];
|
8553 |
|
8554 | if (operator) {
|
8555 | return operator;
|
8556 | }
|
8557 |
|
8558 | if (typeof msg === 'function') msg = msg();
|
8559 |
|
8560 | msg = msg || '';
|
8561 | if (!msg) {
|
8562 | return undefined;
|
8563 | }
|
8564 |
|
8565 | if (/\shave\s/.test(msg)) {
|
8566 | return undefined;
|
8567 | }
|
8568 |
|
8569 | var isObject = isObjectType(expected);
|
8570 | if (/\snot\s/.test(msg)) {
|
8571 | return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
|
8572 | }
|
8573 |
|
8574 | return isObject ? 'deepStrictEqual' : 'strictEqual';
|
8575 | };
|
8576 |
|
8577 |
|
8578 | }),
|
8579 |
|
8580 | "./node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js":
|
8581 |
|
8582 |
|
8583 |
|
8584 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 |
|
8596 | var getOwnEnumerablePropertySymbols = __webpack_require__( "./node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js");
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 |
|
8604 |
|
8605 |
|
8606 |
|
8607 |
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 | module.exports = function getOwnEnumerableProperties(obj) {
|
8613 | return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
8614 | };
|
8615 |
|
8616 |
|
8617 | }),
|
8618 |
|
8619 | "./node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js":
|
8620 |
|
8621 |
|
8622 |
|
8623 | ((module) => {
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 | module.exports = function getOwnEnumerablePropertySymbols(obj) {
|
8646 | if (typeof Object.getOwnPropertySymbols !== 'function') return [];
|
8647 |
|
8648 | return Object.getOwnPropertySymbols(obj).filter(function (sym) {
|
8649 | return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
8650 | });
|
8651 | };
|
8652 |
|
8653 |
|
8654 | }),
|
8655 |
|
8656 | "./node_modules/chai/lib/chai/utils/getProperties.js":
|
8657 |
|
8658 |
|
8659 |
|
8660 | ((module) => {
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 | module.exports = function getProperties(object) {
|
8682 | var result = Object.getOwnPropertyNames(object);
|
8683 |
|
8684 | function addProperty(property) {
|
8685 | if (result.indexOf(property) === -1) {
|
8686 | result.push(property);
|
8687 | }
|
8688 | }
|
8689 |
|
8690 | var proto = Object.getPrototypeOf(object);
|
8691 | while (proto !== null) {
|
8692 | Object.getOwnPropertyNames(proto).forEach(addProperty);
|
8693 | proto = Object.getPrototypeOf(proto);
|
8694 | }
|
8695 |
|
8696 | return result;
|
8697 | };
|
8698 |
|
8699 |
|
8700 | }),
|
8701 |
|
8702 | "./node_modules/chai/lib/chai/utils/index.js":
|
8703 |
|
8704 |
|
8705 |
|
8706 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
8707 |
|
8708 |
|
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 |
|
8718 | var pathval = __webpack_require__( "./node_modules/pathval/index.js");
|
8719 |
|
8720 |
|
8721 |
|
8722 |
|
8723 |
|
8724 | exports.test = __webpack_require__( "./node_modules/chai/lib/chai/utils/test.js");
|
8725 |
|
8726 |
|
8727 |
|
8728 |
|
8729 |
|
8730 | exports.type = __webpack_require__( "./node_modules/type-detect/type-detect.js");
|
8731 |
|
8732 |
|
8733 |
|
8734 |
|
8735 | exports.expectTypes = __webpack_require__( "./node_modules/chai/lib/chai/utils/expectTypes.js");
|
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 |
|
8741 | exports.getMessage = __webpack_require__( "./node_modules/chai/lib/chai/utils/getMessage.js");
|
8742 |
|
8743 |
|
8744 |
|
8745 |
|
8746 |
|
8747 | exports.getActual = __webpack_require__( "./node_modules/chai/lib/chai/utils/getActual.js");
|
8748 |
|
8749 |
|
8750 |
|
8751 |
|
8752 |
|
8753 | exports.inspect = __webpack_require__( "./node_modules/chai/lib/chai/utils/inspect.js");
|
8754 |
|
8755 |
|
8756 |
|
8757 |
|
8758 |
|
8759 | exports.objDisplay = __webpack_require__( "./node_modules/chai/lib/chai/utils/objDisplay.js");
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 |
|
8765 | exports.flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
8766 |
|
8767 |
|
8768 |
|
8769 |
|
8770 |
|
8771 | exports.transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
8772 |
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 | exports.eql = __webpack_require__( "./node_modules/deep-eql/index.js");
|
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 | exports.getPathInfo = pathval.getPathInfo;
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 |
|
8789 | exports.hasProperty = pathval.hasProperty;
|
8790 |
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 | exports.getName = __webpack_require__( "./node_modules/get-func-name/index.js");
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 |
|
8801 | exports.addProperty = __webpack_require__( "./node_modules/chai/lib/chai/utils/addProperty.js");
|
8802 |
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 | exports.addMethod = __webpack_require__( "./node_modules/chai/lib/chai/utils/addMethod.js");
|
8808 |
|
8809 |
|
8810 |
|
8811 |
|
8812 |
|
8813 | exports.overwriteProperty = __webpack_require__( "./node_modules/chai/lib/chai/utils/overwriteProperty.js");
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 | exports.overwriteMethod = __webpack_require__( "./node_modules/chai/lib/chai/utils/overwriteMethod.js");
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 |
|
8825 | exports.addChainableMethod = __webpack_require__( "./node_modules/chai/lib/chai/utils/addChainableMethod.js");
|
8826 |
|
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 | exports.overwriteChainableMethod = __webpack_require__( "./node_modules/chai/lib/chai/utils/overwriteChainableMethod.js");
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 | exports.compareByInspect = __webpack_require__( "./node_modules/chai/lib/chai/utils/compareByInspect.js");
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 | exports.getOwnEnumerablePropertySymbols = __webpack_require__( "./node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js");
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 |
|
8849 | exports.getOwnEnumerableProperties = __webpack_require__( "./node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js");
|
8850 |
|
8851 |
|
8852 |
|
8853 |
|
8854 |
|
8855 | exports.checkError = __webpack_require__( "./node_modules/check-error/index.js");
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 | exports.proxify = __webpack_require__( "./node_modules/chai/lib/chai/utils/proxify.js");
|
8862 |
|
8863 |
|
8864 |
|
8865 |
|
8866 |
|
8867 | exports.addLengthGuard = __webpack_require__( "./node_modules/chai/lib/chai/utils/addLengthGuard.js");
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 | exports.isProxyEnabled = __webpack_require__( "./node_modules/chai/lib/chai/utils/isProxyEnabled.js");
|
8874 |
|
8875 |
|
8876 |
|
8877 |
|
8878 |
|
8879 | exports.isNaN = __webpack_require__( "./node_modules/chai/lib/chai/utils/isNaN.js");
|
8880 |
|
8881 |
|
8882 |
|
8883 |
|
8884 |
|
8885 | exports.getOperator = __webpack_require__( "./node_modules/chai/lib/chai/utils/getOperator.js");
|
8886 |
|
8887 | }),
|
8888 |
|
8889 | "./node_modules/chai/lib/chai/utils/inspect.js":
|
8890 |
|
8891 |
|
8892 |
|
8893 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 | var getName = __webpack_require__( "./node_modules/get-func-name/index.js");
|
8899 | var loupe = __webpack_require__( "./node_modules/loupe/loupe.js");
|
8900 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
8901 |
|
8902 | module.exports = inspect;
|
8903 |
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 |
|
8918 |
|
8919 | function inspect(obj, showHidden, depth, colors) {
|
8920 | var options = {
|
8921 | colors: colors,
|
8922 | depth: (typeof depth === 'undefined' ? 2 : depth),
|
8923 | showHidden: showHidden,
|
8924 | truncate: config.truncateThreshold ? config.truncateThreshold : Infinity,
|
8925 | };
|
8926 | return loupe.inspect(obj, options);
|
8927 | }
|
8928 |
|
8929 |
|
8930 | }),
|
8931 |
|
8932 | "./node_modules/chai/lib/chai/utils/isNaN.js":
|
8933 |
|
8934 |
|
8935 |
|
8936 | ((module) => {
|
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 |
|
8945 |
|
8946 |
|
8947 |
|
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 |
|
8956 | function isNaN(value) {
|
8957 |
|
8958 |
|
8959 | return value !== value;
|
8960 | }
|
8961 |
|
8962 |
|
8963 | module.exports = Number.isNaN || isNaN;
|
8964 |
|
8965 |
|
8966 | }),
|
8967 |
|
8968 | "./node_modules/chai/lib/chai/utils/isProxyEnabled.js":
|
8969 |
|
8970 |
|
8971 |
|
8972 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
8973 |
|
8974 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 |
|
8984 |
|
8985 |
|
8986 |
|
8987 |
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 |
|
8993 | module.exports = function isProxyEnabled() {
|
8994 | return config.useProxy &&
|
8995 | typeof Proxy !== 'undefined' &&
|
8996 | typeof Reflect !== 'undefined';
|
8997 | };
|
8998 |
|
8999 |
|
9000 | }),
|
9001 |
|
9002 | "./node_modules/chai/lib/chai/utils/objDisplay.js":
|
9003 |
|
9004 |
|
9005 |
|
9006 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9007 |
|
9008 |
|
9009 |
|
9010 |
|
9011 |
|
9012 |
|
9013 |
|
9014 |
|
9015 |
|
9016 |
|
9017 |
|
9018 | var inspect = __webpack_require__( "./node_modules/chai/lib/chai/utils/inspect.js");
|
9019 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 |
|
9033 |
|
9034 | module.exports = function objDisplay(obj) {
|
9035 | var str = inspect(obj)
|
9036 | , type = Object.prototype.toString.call(obj);
|
9037 |
|
9038 | if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
9039 | if (type === '[object Function]') {
|
9040 | return !obj.name || obj.name === ''
|
9041 | ? '[Function]'
|
9042 | : '[Function: ' + obj.name + ']';
|
9043 | } else if (type === '[object Array]') {
|
9044 | return '[ Array(' + obj.length + ') ]';
|
9045 | } else if (type === '[object Object]') {
|
9046 | var keys = Object.keys(obj)
|
9047 | , kstr = keys.length > 2
|
9048 | ? keys.splice(0, 2).join(', ') + ', ...'
|
9049 | : keys.join(', ');
|
9050 | return '{ Object (' + kstr + ') }';
|
9051 | } else {
|
9052 | return str;
|
9053 | }
|
9054 | } else {
|
9055 | return str;
|
9056 | }
|
9057 | };
|
9058 |
|
9059 |
|
9060 | }),
|
9061 |
|
9062 | "./node_modules/chai/lib/chai/utils/overwriteChainableMethod.js":
|
9063 |
|
9064 |
|
9065 |
|
9066 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
9075 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 |
|
9093 |
|
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 | module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
9111 | var chainableBehavior = ctx.__methods[name];
|
9112 |
|
9113 | var _chainingBehavior = chainableBehavior.chainingBehavior;
|
9114 | chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {
|
9115 | var result = chainingBehavior(_chainingBehavior).call(this);
|
9116 | if (result !== undefined) {
|
9117 | return result;
|
9118 | }
|
9119 |
|
9120 | var newAssertion = new chai.Assertion();
|
9121 | transferFlags(this, newAssertion);
|
9122 | return newAssertion;
|
9123 | };
|
9124 |
|
9125 | var _method = chainableBehavior.method;
|
9126 | chainableBehavior.method = function overwritingChainableMethodWrapper() {
|
9127 | var result = method(_method).apply(this, arguments);
|
9128 | if (result !== undefined) {
|
9129 | return result;
|
9130 | }
|
9131 |
|
9132 | var newAssertion = new chai.Assertion();
|
9133 | transferFlags(this, newAssertion);
|
9134 | return newAssertion;
|
9135 | };
|
9136 | };
|
9137 |
|
9138 |
|
9139 | }),
|
9140 |
|
9141 | "./node_modules/chai/lib/chai/utils/overwriteMethod.js":
|
9142 |
|
9143 |
|
9144 |
|
9145 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 | var addLengthGuard = __webpack_require__( "./node_modules/chai/lib/chai/utils/addLengthGuard.js");
|
9154 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
9155 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
9156 | var proxify = __webpack_require__( "./node_modules/chai/lib/chai/utils/proxify.js");
|
9157 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
9158 |
|
9159 |
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 |
|
9180 |
|
9181 |
|
9182 |
|
9183 |
|
9184 |
|
9185 |
|
9186 |
|
9187 |
|
9188 |
|
9189 |
|
9190 |
|
9191 |
|
9192 |
|
9193 | module.exports = function overwriteMethod(ctx, name, method) {
|
9194 | var _method = ctx[name]
|
9195 | , _super = function () {
|
9196 | throw new Error(name + ' is not a function');
|
9197 | };
|
9198 |
|
9199 | if (_method && 'function' === typeof _method)
|
9200 | _super = _method;
|
9201 |
|
9202 | var overwritingMethodWrapper = function () {
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 |
|
9213 |
|
9214 |
|
9215 | if (!flag(this, 'lockSsfi')) {
|
9216 | flag(this, 'ssfi', overwritingMethodWrapper);
|
9217 | }
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 | var origLockSsfi = flag(this, 'lockSsfi');
|
9223 | flag(this, 'lockSsfi', true);
|
9224 | var result = method(_super).apply(this, arguments);
|
9225 | flag(this, 'lockSsfi', origLockSsfi);
|
9226 |
|
9227 | if (result !== undefined) {
|
9228 | return result;
|
9229 | }
|
9230 |
|
9231 | var newAssertion = new chai.Assertion();
|
9232 | transferFlags(this, newAssertion);
|
9233 | return newAssertion;
|
9234 | }
|
9235 |
|
9236 | addLengthGuard(overwritingMethodWrapper, name, false);
|
9237 | ctx[name] = proxify(overwritingMethodWrapper, name);
|
9238 | };
|
9239 |
|
9240 |
|
9241 | }),
|
9242 |
|
9243 | "./node_modules/chai/lib/chai/utils/overwriteProperty.js":
|
9244 |
|
9245 |
|
9246 |
|
9247 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9248 |
|
9249 |
|
9250 |
|
9251 |
|
9252 |
|
9253 |
|
9254 |
|
9255 | var chai = __webpack_require__( "./node_modules/chai/lib/chai.js");
|
9256 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
9257 | var isProxyEnabled = __webpack_require__( "./node_modules/chai/lib/chai/utils/isProxyEnabled.js");
|
9258 | var transferFlags = __webpack_require__( "./node_modules/chai/lib/chai/utils/transferFlags.js");
|
9259 |
|
9260 |
|
9261 |
|
9262 |
|
9263 |
|
9264 |
|
9265 |
|
9266 |
|
9267 |
|
9268 |
|
9269 |
|
9270 |
|
9271 |
|
9272 |
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 |
|
9278 |
|
9279 |
|
9280 |
|
9281 |
|
9282 |
|
9283 |
|
9284 |
|
9285 |
|
9286 |
|
9287 |
|
9288 |
|
9289 |
|
9290 |
|
9291 |
|
9292 |
|
9293 |
|
9294 | module.exports = function overwriteProperty(ctx, name, getter) {
|
9295 | var _get = Object.getOwnPropertyDescriptor(ctx, name)
|
9296 | , _super = function () {};
|
9297 |
|
9298 | if (_get && 'function' === typeof _get.get)
|
9299 | _super = _get.get
|
9300 |
|
9301 | Object.defineProperty(ctx, name,
|
9302 | { get: function overwritingPropertyGetter() {
|
9303 |
|
9304 |
|
9305 |
|
9306 |
|
9307 |
|
9308 |
|
9309 |
|
9310 |
|
9311 |
|
9312 |
|
9313 |
|
9314 |
|
9315 |
|
9316 |
|
9317 |
|
9318 | if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
9319 | flag(this, 'ssfi', overwritingPropertyGetter);
|
9320 | }
|
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 | var origLockSsfi = flag(this, 'lockSsfi');
|
9326 | flag(this, 'lockSsfi', true);
|
9327 | var result = getter(_super).call(this);
|
9328 | flag(this, 'lockSsfi', origLockSsfi);
|
9329 |
|
9330 | if (result !== undefined) {
|
9331 | return result;
|
9332 | }
|
9333 |
|
9334 | var newAssertion = new chai.Assertion();
|
9335 | transferFlags(this, newAssertion);
|
9336 | return newAssertion;
|
9337 | }
|
9338 | , configurable: true
|
9339 | });
|
9340 | };
|
9341 |
|
9342 |
|
9343 | }),
|
9344 |
|
9345 | "./node_modules/chai/lib/chai/utils/proxify.js":
|
9346 |
|
9347 |
|
9348 |
|
9349 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9350 |
|
9351 | var config = __webpack_require__( "./node_modules/chai/lib/chai/config.js");
|
9352 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
9353 | var getProperties = __webpack_require__( "./node_modules/chai/lib/chai/utils/getProperties.js");
|
9354 | var isProxyEnabled = __webpack_require__( "./node_modules/chai/lib/chai/utils/isProxyEnabled.js");
|
9355 |
|
9356 |
|
9357 |
|
9358 |
|
9359 |
|
9360 |
|
9361 |
|
9362 |
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 |
|
9373 |
|
9374 |
|
9375 |
|
9376 |
|
9377 |
|
9378 |
|
9379 |
|
9380 |
|
9381 | var builtins = ['__flags', '__methods', '_obj', 'assert'];
|
9382 |
|
9383 | module.exports = function proxify(obj, nonChainableMethodName) {
|
9384 | if (!isProxyEnabled()) return obj;
|
9385 |
|
9386 | return new Proxy(obj, {
|
9387 | get: function proxyGetter(target, property) {
|
9388 |
|
9389 |
|
9390 |
|
9391 |
|
9392 | if (typeof property === 'string' &&
|
9393 | config.proxyExcludedKeys.indexOf(property) === -1 &&
|
9394 | !Reflect.has(target, property)) {
|
9395 |
|
9396 | if (nonChainableMethodName) {
|
9397 | throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' +
|
9398 | property + '. See docs for proper usage of "' +
|
9399 | nonChainableMethodName + '".');
|
9400 | }
|
9401 |
|
9402 |
|
9403 |
|
9404 |
|
9405 | var suggestion = null;
|
9406 | var suggestionDistance = 4;
|
9407 | getProperties(target).forEach(function(prop) {
|
9408 | if (
|
9409 | !Object.prototype.hasOwnProperty(prop) &&
|
9410 | builtins.indexOf(prop) === -1
|
9411 | ) {
|
9412 | var dist = stringDistanceCapped(
|
9413 | property,
|
9414 | prop,
|
9415 | suggestionDistance
|
9416 | );
|
9417 | if (dist < suggestionDistance) {
|
9418 | suggestion = prop;
|
9419 | suggestionDistance = dist;
|
9420 | }
|
9421 | }
|
9422 | });
|
9423 |
|
9424 | if (suggestion !== null) {
|
9425 | throw Error('Invalid Chai property: ' + property +
|
9426 | '. Did you mean "' + suggestion + '"?');
|
9427 | } else {
|
9428 | throw Error('Invalid Chai property: ' + property);
|
9429 | }
|
9430 | }
|
9431 |
|
9432 |
|
9433 |
|
9434 |
|
9435 |
|
9436 |
|
9437 |
|
9438 |
|
9439 |
|
9440 |
|
9441 |
|
9442 |
|
9443 |
|
9444 | if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {
|
9445 | flag(target, 'ssfi', proxyGetter);
|
9446 | }
|
9447 |
|
9448 | return Reflect.get(target, property);
|
9449 | }
|
9450 | });
|
9451 | };
|
9452 |
|
9453 |
|
9454 |
|
9455 |
|
9456 |
|
9457 |
|
9458 |
|
9459 |
|
9460 |
|
9461 |
|
9462 |
|
9463 | function stringDistanceCapped(strA, strB, cap) {
|
9464 | if (Math.abs(strA.length - strB.length) >= cap) {
|
9465 | return cap;
|
9466 | }
|
9467 |
|
9468 | var memo = [];
|
9469 |
|
9470 |
|
9471 |
|
9472 | for (var i = 0; i <= strA.length; i++) {
|
9473 | memo[i] = Array(strB.length + 1).fill(0);
|
9474 | memo[i][0] = i;
|
9475 | }
|
9476 | for (var j = 0; j < strB.length; j++) {
|
9477 | memo[0][j] = j;
|
9478 | }
|
9479 |
|
9480 | for (var i = 1; i <= strA.length; i++) {
|
9481 | var ch = strA.charCodeAt(i - 1);
|
9482 | for (var j = 1; j <= strB.length; j++) {
|
9483 | if (Math.abs(i - j) >= cap) {
|
9484 | memo[i][j] = cap;
|
9485 | continue;
|
9486 | }
|
9487 | memo[i][j] = Math.min(
|
9488 | memo[i - 1][j] + 1,
|
9489 | memo[i][j - 1] + 1,
|
9490 | memo[i - 1][j - 1] +
|
9491 | (ch === strB.charCodeAt(j - 1) ? 0 : 1)
|
9492 | );
|
9493 | }
|
9494 | }
|
9495 |
|
9496 | return memo[strA.length][strB.length];
|
9497 | }
|
9498 |
|
9499 |
|
9500 | }),
|
9501 |
|
9502 | "./node_modules/chai/lib/chai/utils/test.js":
|
9503 |
|
9504 |
|
9505 |
|
9506 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 |
|
9516 |
|
9517 |
|
9518 | var flag = __webpack_require__( "./node_modules/chai/lib/chai/utils/flag.js");
|
9519 |
|
9520 |
|
9521 |
|
9522 |
|
9523 |
|
9524 |
|
9525 |
|
9526 |
|
9527 |
|
9528 |
|
9529 |
|
9530 |
|
9531 | module.exports = function test(obj, args) {
|
9532 | var negate = flag(obj, 'negate')
|
9533 | , expr = args[0];
|
9534 | return negate ? !expr : expr;
|
9535 | };
|
9536 |
|
9537 |
|
9538 | }),
|
9539 |
|
9540 | "./node_modules/chai/lib/chai/utils/transferFlags.js":
|
9541 |
|
9542 |
|
9543 |
|
9544 | ((module) => {
|
9545 |
|
9546 |
|
9547 |
|
9548 |
|
9549 |
|
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 |
|
9567 |
|
9568 |
|
9569 |
|
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 | module.exports = function transferFlags(assertion, object, includeAll) {
|
9576 | var flags = assertion.__flags || (assertion.__flags = Object.create(null));
|
9577 |
|
9578 | if (!object.__flags) {
|
9579 | object.__flags = Object.create(null);
|
9580 | }
|
9581 |
|
9582 | includeAll = arguments.length === 3 ? includeAll : true;
|
9583 |
|
9584 | for (var flag in flags) {
|
9585 | if (includeAll ||
|
9586 | (flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) {
|
9587 | object.__flags[flag] = flags[flag];
|
9588 | }
|
9589 | }
|
9590 | };
|
9591 |
|
9592 |
|
9593 | }),
|
9594 |
|
9595 | "./node_modules/check-error/index.js":
|
9596 |
|
9597 |
|
9598 |
|
9599 | ((module) => {
|
9600 |
|
9601 | "use strict";
|
9602 |
|
9603 |
|
9604 |
|
9605 |
|
9606 |
|
9607 |
|
9608 |
|
9609 |
|
9610 |
|
9611 |
|
9612 |
|
9613 |
|
9614 |
|
9615 |
|
9616 |
|
9617 |
|
9618 |
|
9619 |
|
9620 |
|
9621 |
|
9622 |
|
9623 |
|
9624 |
|
9625 |
|
9626 |
|
9627 |
|
9628 |
|
9629 |
|
9630 |
|
9631 |
|
9632 | function compatibleInstance(thrown, errorLike) {
|
9633 | return errorLike instanceof Error && thrown === errorLike;
|
9634 | }
|
9635 |
|
9636 |
|
9637 |
|
9638 |
|
9639 |
|
9640 |
|
9641 |
|
9642 |
|
9643 |
|
9644 |
|
9645 |
|
9646 |
|
9647 |
|
9648 |
|
9649 |
|
9650 |
|
9651 |
|
9652 | function compatibleConstructor(thrown, errorLike) {
|
9653 | if (errorLike instanceof Error) {
|
9654 |
|
9655 | return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
|
9656 | } else if (errorLike.prototype instanceof Error || errorLike === Error) {
|
9657 |
|
9658 | return thrown.constructor === errorLike || thrown instanceof errorLike;
|
9659 | }
|
9660 |
|
9661 | return false;
|
9662 | }
|
9663 |
|
9664 |
|
9665 |
|
9666 |
|
9667 |
|
9668 |
|
9669 |
|
9670 |
|
9671 |
|
9672 |
|
9673 |
|
9674 |
|
9675 |
|
9676 |
|
9677 |
|
9678 | function compatibleMessage(thrown, errMatcher) {
|
9679 | var comparisonString = typeof thrown === 'string' ? thrown : thrown.message;
|
9680 | if (errMatcher instanceof RegExp) {
|
9681 | return errMatcher.test(comparisonString);
|
9682 | } else if (typeof errMatcher === 'string') {
|
9683 | return comparisonString.indexOf(errMatcher) !== -1;
|
9684 | }
|
9685 |
|
9686 | return false;
|
9687 | }
|
9688 |
|
9689 |
|
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 |
|
9695 |
|
9696 |
|
9697 |
|
9698 |
|
9699 |
|
9700 |
|
9701 | var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/;
|
9702 | function getFunctionName(constructorFn) {
|
9703 | var name = '';
|
9704 | if (typeof constructorFn.name === 'undefined') {
|
9705 |
|
9706 | var match = String(constructorFn).match(functionNameMatch);
|
9707 | if (match) {
|
9708 | name = match[1];
|
9709 | }
|
9710 | } else {
|
9711 | name = constructorFn.name;
|
9712 | }
|
9713 |
|
9714 | return name;
|
9715 | }
|
9716 |
|
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 |
|
9722 |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 |
|
9728 | function getConstructorName(errorLike) {
|
9729 | var constructorName = errorLike;
|
9730 | if (errorLike instanceof Error) {
|
9731 | constructorName = getFunctionName(errorLike.constructor);
|
9732 | } else if (typeof errorLike === 'function') {
|
9733 |
|
9734 |
|
9735 |
|
9736 | constructorName = getFunctionName(errorLike).trim() ||
|
9737 | getFunctionName(new errorLike());
|
9738 | }
|
9739 |
|
9740 | return constructorName;
|
9741 | }
|
9742 |
|
9743 |
|
9744 |
|
9745 |
|
9746 |
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 |
|
9754 |
|
9755 |
|
9756 | function getMessage(errorLike) {
|
9757 | var msg = '';
|
9758 | if (errorLike && errorLike.message) {
|
9759 | msg = errorLike.message;
|
9760 | } else if (typeof errorLike === 'string') {
|
9761 | msg = errorLike;
|
9762 | }
|
9763 |
|
9764 | return msg;
|
9765 | }
|
9766 |
|
9767 | module.exports = {
|
9768 | compatibleInstance: compatibleInstance,
|
9769 | compatibleConstructor: compatibleConstructor,
|
9770 | compatibleMessage: compatibleMessage,
|
9771 | getMessage: getMessage,
|
9772 | getConstructorName: getConstructorName,
|
9773 | };
|
9774 |
|
9775 |
|
9776 | }),
|
9777 |
|
9778 | "./node_modules/deep-eql/index.js":
|
9779 |
|
9780 |
|
9781 |
|
9782 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
9783 |
|
9784 | "use strict";
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 |
|
9791 |
|
9792 |
|
9793 | var type = __webpack_require__( "./node_modules/type-detect/type-detect.js");
|
9794 | function FakeMap() {
|
9795 | this._key = 'chai/deep-eql__' + Math.random() + Date.now();
|
9796 | }
|
9797 |
|
9798 | FakeMap.prototype = {
|
9799 | get: function getMap(key) {
|
9800 | return key[this._key];
|
9801 | },
|
9802 | set: function setMap(key, value) {
|
9803 | if (Object.isExtensible(key)) {
|
9804 | Object.defineProperty(key, this._key, {
|
9805 | value: value,
|
9806 | configurable: true,
|
9807 | });
|
9808 | }
|
9809 | },
|
9810 | };
|
9811 |
|
9812 | var MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap;
|
9813 |
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 |
|
9819 |
|
9820 |
|
9821 | function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
|
9822 |
|
9823 | if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
9824 | return null;
|
9825 | }
|
9826 | var leftHandMap = memoizeMap.get(leftHandOperand);
|
9827 | if (leftHandMap) {
|
9828 | var result = leftHandMap.get(rightHandOperand);
|
9829 | if (typeof result === 'boolean') {
|
9830 | return result;
|
9831 | }
|
9832 | }
|
9833 | return null;
|
9834 | }
|
9835 |
|
9836 |
|
9837 |
|
9838 |
|
9839 |
|
9840 |
|
9841 |
|
9842 |
|
9843 |
|
9844 | function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
|
9845 |
|
9846 | if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
9847 | return;
|
9848 | }
|
9849 | var leftHandMap = memoizeMap.get(leftHandOperand);
|
9850 | if (leftHandMap) {
|
9851 | leftHandMap.set(rightHandOperand, result);
|
9852 | } else {
|
9853 | leftHandMap = new MemoizeMap();
|
9854 | leftHandMap.set(rightHandOperand, result);
|
9855 | memoizeMap.set(leftHandOperand, leftHandMap);
|
9856 | }
|
9857 | }
|
9858 |
|
9859 |
|
9860 |
|
9861 |
|
9862 |
|
9863 | module.exports = deepEqual;
|
9864 | module.exports.MemoizeMap = MemoizeMap;
|
9865 |
|
9866 |
|
9867 |
|
9868 |
|
9869 |
|
9870 |
|
9871 |
|
9872 |
|
9873 |
|
9874 |
|
9875 |
|
9876 |
|
9877 |
|
9878 | function deepEqual(leftHandOperand, rightHandOperand, options) {
|
9879 |
|
9880 | if (options && options.comparator) {
|
9881 | return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
|
9882 | }
|
9883 |
|
9884 | var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
|
9885 | if (simpleResult !== null) {
|
9886 | return simpleResult;
|
9887 | }
|
9888 |
|
9889 |
|
9890 | return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
|
9891 | }
|
9892 |
|
9893 |
|
9894 |
|
9895 |
|
9896 |
|
9897 |
|
9898 |
|
9899 | function simpleEqual(leftHandOperand, rightHandOperand) {
|
9900 |
|
9901 | if (leftHandOperand === rightHandOperand) {
|
9902 |
|
9903 | return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
|
9904 | }
|
9905 |
|
9906 |
|
9907 | if (
|
9908 | leftHandOperand !== leftHandOperand &&
|
9909 | rightHandOperand !== rightHandOperand
|
9910 | ) {
|
9911 | return true;
|
9912 | }
|
9913 |
|
9914 |
|
9915 |
|
9916 | if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
|
9917 |
|
9918 | return false;
|
9919 | }
|
9920 | return null;
|
9921 | }
|
9922 |
|
9923 |
|
9924 |
|
9925 |
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 | function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
|
9936 | options = options || {};
|
9937 | options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();
|
9938 | var comparator = options && options.comparator;
|
9939 |
|
9940 |
|
9941 | var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
|
9942 | if (memoizeResultLeft !== null) {
|
9943 | return memoizeResultLeft;
|
9944 | }
|
9945 | var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
|
9946 | if (memoizeResultRight !== null) {
|
9947 | return memoizeResultRight;
|
9948 | }
|
9949 |
|
9950 |
|
9951 | if (comparator) {
|
9952 | var comparatorResult = comparator(leftHandOperand, rightHandOperand);
|
9953 |
|
9954 | if (comparatorResult === false || comparatorResult === true) {
|
9955 | memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
|
9956 | return comparatorResult;
|
9957 | }
|
9958 |
|
9959 |
|
9960 | var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
|
9961 | if (simpleResult !== null) {
|
9962 |
|
9963 | return simpleResult;
|
9964 | }
|
9965 | }
|
9966 |
|
9967 | var leftHandType = type(leftHandOperand);
|
9968 | if (leftHandType !== type(rightHandOperand)) {
|
9969 | memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
|
9970 | return false;
|
9971 | }
|
9972 |
|
9973 |
|
9974 | memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
|
9975 |
|
9976 | var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
|
9977 | memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
|
9978 | return result;
|
9979 | }
|
9980 |
|
9981 | function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
|
9982 | switch (leftHandType) {
|
9983 | case 'String':
|
9984 | case 'Number':
|
9985 | case 'Boolean':
|
9986 | case 'Date':
|
9987 |
|
9988 | return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
|
9989 | case 'Promise':
|
9990 | case 'Symbol':
|
9991 | case 'function':
|
9992 | case 'WeakMap':
|
9993 | case 'WeakSet':
|
9994 | case 'Error':
|
9995 | return leftHandOperand === rightHandOperand;
|
9996 | case 'Arguments':
|
9997 | case 'Int8Array':
|
9998 | case 'Uint8Array':
|
9999 | case 'Uint8ClampedArray':
|
10000 | case 'Int16Array':
|
10001 | case 'Uint16Array':
|
10002 | case 'Int32Array':
|
10003 | case 'Uint32Array':
|
10004 | case 'Float32Array':
|
10005 | case 'Float64Array':
|
10006 | case 'Array':
|
10007 | return iterableEqual(leftHandOperand, rightHandOperand, options);
|
10008 | case 'RegExp':
|
10009 | return regexpEqual(leftHandOperand, rightHandOperand);
|
10010 | case 'Generator':
|
10011 | return generatorEqual(leftHandOperand, rightHandOperand, options);
|
10012 | case 'DataView':
|
10013 | return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
|
10014 | case 'ArrayBuffer':
|
10015 | return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
|
10016 | case 'Set':
|
10017 | return entriesEqual(leftHandOperand, rightHandOperand, options);
|
10018 | case 'Map':
|
10019 | return entriesEqual(leftHandOperand, rightHandOperand, options);
|
10020 | default:
|
10021 | return objectEqual(leftHandOperand, rightHandOperand, options);
|
10022 | }
|
10023 | }
|
10024 |
|
10025 |
|
10026 |
|
10027 |
|
10028 |
|
10029 |
|
10030 |
|
10031 |
|
10032 |
|
10033 | function regexpEqual(leftHandOperand, rightHandOperand) {
|
10034 | return leftHandOperand.toString() === rightHandOperand.toString();
|
10035 | }
|
10036 |
|
10037 |
|
10038 |
|
10039 |
|
10040 |
|
10041 |
|
10042 |
|
10043 |
|
10044 |
|
10045 |
|
10046 | function entriesEqual(leftHandOperand, rightHandOperand, options) {
|
10047 |
|
10048 | if (leftHandOperand.size !== rightHandOperand.size) {
|
10049 | return false;
|
10050 | }
|
10051 | if (leftHandOperand.size === 0) {
|
10052 | return true;
|
10053 | }
|
10054 | var leftHandItems = [];
|
10055 | var rightHandItems = [];
|
10056 | leftHandOperand.forEach(function gatherEntries(key, value) {
|
10057 | leftHandItems.push([ key, value ]);
|
10058 | });
|
10059 | rightHandOperand.forEach(function gatherEntries(key, value) {
|
10060 | rightHandItems.push([ key, value ]);
|
10061 | });
|
10062 | return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
|
10063 | }
|
10064 |
|
10065 |
|
10066 |
|
10067 |
|
10068 |
|
10069 |
|
10070 |
|
10071 |
|
10072 |
|
10073 |
|
10074 | function iterableEqual(leftHandOperand, rightHandOperand, options) {
|
10075 | var length = leftHandOperand.length;
|
10076 | if (length !== rightHandOperand.length) {
|
10077 | return false;
|
10078 | }
|
10079 | if (length === 0) {
|
10080 | return true;
|
10081 | }
|
10082 | var index = -1;
|
10083 | while (++index < length) {
|
10084 | if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
|
10085 | return false;
|
10086 | }
|
10087 | }
|
10088 | return true;
|
10089 | }
|
10090 |
|
10091 |
|
10092 |
|
10093 |
|
10094 |
|
10095 |
|
10096 |
|
10097 |
|
10098 |
|
10099 |
|
10100 | function generatorEqual(leftHandOperand, rightHandOperand, options) {
|
10101 | return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
|
10102 | }
|
10103 |
|
10104 |
|
10105 |
|
10106 |
|
10107 |
|
10108 |
|
10109 |
|
10110 | function hasIteratorFunction(target) {
|
10111 | return typeof Symbol !== 'undefined' &&
|
10112 | typeof target === 'object' &&
|
10113 | typeof Symbol.iterator !== 'undefined' &&
|
10114 | typeof target[Symbol.iterator] === 'function';
|
10115 | }
|
10116 |
|
10117 |
|
10118 |
|
10119 |
|
10120 |
|
10121 |
|
10122 |
|
10123 |
|
10124 | function getIteratorEntries(target) {
|
10125 | if (hasIteratorFunction(target)) {
|
10126 | try {
|
10127 | return getGeneratorEntries(target[Symbol.iterator]());
|
10128 | } catch (iteratorError) {
|
10129 | return [];
|
10130 | }
|
10131 | }
|
10132 | return [];
|
10133 | }
|
10134 |
|
10135 |
|
10136 |
|
10137 |
|
10138 |
|
10139 |
|
10140 |
|
10141 | function getGeneratorEntries(generator) {
|
10142 | var generatorResult = generator.next();
|
10143 | var accumulator = [ generatorResult.value ];
|
10144 | while (generatorResult.done === false) {
|
10145 | generatorResult = generator.next();
|
10146 | accumulator.push(generatorResult.value);
|
10147 | }
|
10148 | return accumulator;
|
10149 | }
|
10150 |
|
10151 |
|
10152 |
|
10153 |
|
10154 |
|
10155 |
|
10156 |
|
10157 | function getEnumerableKeys(target) {
|
10158 | var keys = [];
|
10159 | for (var key in target) {
|
10160 | keys.push(key);
|
10161 | }
|
10162 | return keys;
|
10163 | }
|
10164 |
|
10165 |
|
10166 |
|
10167 |
|
10168 |
|
10169 |
|
10170 |
|
10171 |
|
10172 |
|
10173 |
|
10174 |
|
10175 | function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
|
10176 | var length = keys.length;
|
10177 | if (length === 0) {
|
10178 | return true;
|
10179 | }
|
10180 | for (var i = 0; i < length; i += 1) {
|
10181 | if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
|
10182 | return false;
|
10183 | }
|
10184 | }
|
10185 | return true;
|
10186 | }
|
10187 |
|
10188 |
|
10189 |
|
10190 |
|
10191 |
|
10192 |
|
10193 |
|
10194 |
|
10195 |
|
10196 |
|
10197 |
|
10198 | function objectEqual(leftHandOperand, rightHandOperand, options) {
|
10199 | var leftHandKeys = getEnumerableKeys(leftHandOperand);
|
10200 | var rightHandKeys = getEnumerableKeys(rightHandOperand);
|
10201 | if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
|
10202 | leftHandKeys.sort();
|
10203 | rightHandKeys.sort();
|
10204 | if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
|
10205 | return false;
|
10206 | }
|
10207 | return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
|
10208 | }
|
10209 |
|
10210 | var leftHandEntries = getIteratorEntries(leftHandOperand);
|
10211 | var rightHandEntries = getIteratorEntries(rightHandOperand);
|
10212 | if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
|
10213 | leftHandEntries.sort();
|
10214 | rightHandEntries.sort();
|
10215 | return iterableEqual(leftHandEntries, rightHandEntries, options);
|
10216 | }
|
10217 |
|
10218 | if (leftHandKeys.length === 0 &&
|
10219 | leftHandEntries.length === 0 &&
|
10220 | rightHandKeys.length === 0 &&
|
10221 | rightHandEntries.length === 0) {
|
10222 | return true;
|
10223 | }
|
10224 |
|
10225 | return false;
|
10226 | }
|
10227 |
|
10228 |
|
10229 |
|
10230 |
|
10231 |
|
10232 |
|
10233 |
|
10234 |
|
10235 |
|
10236 |
|
10237 | function isPrimitive(value) {
|
10238 | return value === null || typeof value !== 'object';
|
10239 | }
|
10240 |
|
10241 |
|
10242 | }),
|
10243 |
|
10244 | "./node_modules/foreach/index.js":
|
10245 |
|
10246 |
|
10247 |
|
10248 | ((module) => {
|
10249 |
|
10250 |
|
10251 | var hasOwn = Object.prototype.hasOwnProperty;
|
10252 | var toString = Object.prototype.toString;
|
10253 |
|
10254 | module.exports = function forEach (obj, fn, ctx) {
|
10255 | if (toString.call(fn) !== '[object Function]') {
|
10256 | throw new TypeError('iterator must be a function');
|
10257 | }
|
10258 | var l = obj.length;
|
10259 | if (l === +l) {
|
10260 | for (var i = 0; i < l; i++) {
|
10261 | fn.call(ctx, obj[i], i, obj);
|
10262 | }
|
10263 | } else {
|
10264 | for (var k in obj) {
|
10265 | if (hasOwn.call(obj, k)) {
|
10266 | fn.call(ctx, obj[k], k, obj);
|
10267 | }
|
10268 | }
|
10269 | }
|
10270 | };
|
10271 |
|
10272 |
|
10273 |
|
10274 | }),
|
10275 |
|
10276 | "./node_modules/function-bind/implementation.js":
|
10277 |
|
10278 |
|
10279 |
|
10280 | ((module) => {
|
10281 |
|
10282 | "use strict";
|
10283 |
|
10284 |
|
10285 |
|
10286 |
|
10287 | var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
10288 | var slice = Array.prototype.slice;
|
10289 | var toStr = Object.prototype.toString;
|
10290 | var funcType = '[object Function]';
|
10291 |
|
10292 | module.exports = function bind(that) {
|
10293 | var target = this;
|
10294 | if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
10295 | throw new TypeError(ERROR_MESSAGE + target);
|
10296 | }
|
10297 | var args = slice.call(arguments, 1);
|
10298 |
|
10299 | var bound;
|
10300 | var binder = function () {
|
10301 | if (this instanceof bound) {
|
10302 | var result = target.apply(
|
10303 | this,
|
10304 | args.concat(slice.call(arguments))
|
10305 | );
|
10306 | if (Object(result) === result) {
|
10307 | return result;
|
10308 | }
|
10309 | return this;
|
10310 | } else {
|
10311 | return target.apply(
|
10312 | that,
|
10313 | args.concat(slice.call(arguments))
|
10314 | );
|
10315 | }
|
10316 | };
|
10317 |
|
10318 | var boundLength = Math.max(0, target.length - args.length);
|
10319 | var boundArgs = [];
|
10320 | for (var i = 0; i < boundLength; i++) {
|
10321 | boundArgs.push('$' + i);
|
10322 | }
|
10323 |
|
10324 | bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
10325 |
|
10326 | if (target.prototype) {
|
10327 | var Empty = function Empty() {};
|
10328 | Empty.prototype = target.prototype;
|
10329 | bound.prototype = new Empty();
|
10330 | Empty.prototype = null;
|
10331 | }
|
10332 |
|
10333 | return bound;
|
10334 | };
|
10335 |
|
10336 |
|
10337 | }),
|
10338 |
|
10339 | "./node_modules/function-bind/index.js":
|
10340 |
|
10341 |
|
10342 |
|
10343 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10344 |
|
10345 | "use strict";
|
10346 |
|
10347 |
|
10348 | var implementation = __webpack_require__( "./node_modules/function-bind/implementation.js");
|
10349 |
|
10350 | module.exports = Function.prototype.bind || implementation;
|
10351 |
|
10352 |
|
10353 | }),
|
10354 |
|
10355 | "./node_modules/get-func-name/index.js":
|
10356 |
|
10357 |
|
10358 |
|
10359 | ((module) => {
|
10360 |
|
10361 | "use strict";
|
10362 |
|
10363 |
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 |
|
10372 |
|
10373 |
|
10374 |
|
10375 |
|
10376 |
|
10377 |
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 | var toString = Function.prototype.toString;
|
10384 | var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
|
10385 | function getFuncName(aFunc) {
|
10386 | if (typeof aFunc !== 'function') {
|
10387 | return null;
|
10388 | }
|
10389 |
|
10390 | var name = '';
|
10391 | if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
|
10392 |
|
10393 | var match = toString.call(aFunc).match(functionNameMatch);
|
10394 | if (match) {
|
10395 | name = match[1];
|
10396 | }
|
10397 | } else {
|
10398 |
|
10399 | name = aFunc.name;
|
10400 | }
|
10401 |
|
10402 | return name;
|
10403 | }
|
10404 |
|
10405 | module.exports = getFuncName;
|
10406 |
|
10407 |
|
10408 | }),
|
10409 |
|
10410 | "./node_modules/get-intrinsic/index.js":
|
10411 |
|
10412 |
|
10413 |
|
10414 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10415 |
|
10416 | "use strict";
|
10417 |
|
10418 |
|
10419 | var undefined;
|
10420 |
|
10421 | var $SyntaxError = SyntaxError;
|
10422 | var $Function = Function;
|
10423 | var $TypeError = TypeError;
|
10424 |
|
10425 |
|
10426 | var getEvalledConstructor = function (expressionSyntax) {
|
10427 | try {
|
10428 | return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
10429 | } catch (e) {}
|
10430 | };
|
10431 |
|
10432 | var $gOPD = Object.getOwnPropertyDescriptor;
|
10433 | if ($gOPD) {
|
10434 | try {
|
10435 | $gOPD({}, '');
|
10436 | } catch (e) {
|
10437 | $gOPD = null;
|
10438 | }
|
10439 | }
|
10440 |
|
10441 | var throwTypeError = function () {
|
10442 | throw new $TypeError();
|
10443 | };
|
10444 | var ThrowTypeError = $gOPD
|
10445 | ? (function () {
|
10446 | try {
|
10447 |
|
10448 | arguments.callee;
|
10449 | return throwTypeError;
|
10450 | } catch (calleeThrows) {
|
10451 | try {
|
10452 |
|
10453 | return $gOPD(arguments, 'callee').get;
|
10454 | } catch (gOPDthrows) {
|
10455 | return throwTypeError;
|
10456 | }
|
10457 | }
|
10458 | }())
|
10459 | : throwTypeError;
|
10460 |
|
10461 | var hasSymbols = __webpack_require__( "./node_modules/has-symbols/index.js")();
|
10462 |
|
10463 | var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; };
|
10464 |
|
10465 | var needsEval = {};
|
10466 |
|
10467 | var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
10468 |
|
10469 | var INTRINSICS = {
|
10470 | '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
10471 | '%Array%': Array,
|
10472 | '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
10473 | '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
10474 | '%AsyncFromSyncIteratorPrototype%': undefined,
|
10475 | '%AsyncFunction%': needsEval,
|
10476 | '%AsyncGenerator%': needsEval,
|
10477 | '%AsyncGeneratorFunction%': needsEval,
|
10478 | '%AsyncIteratorPrototype%': needsEval,
|
10479 | '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
10480 | '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
10481 | '%Boolean%': Boolean,
|
10482 | '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
10483 | '%Date%': Date,
|
10484 | '%decodeURI%': decodeURI,
|
10485 | '%decodeURIComponent%': decodeURIComponent,
|
10486 | '%encodeURI%': encodeURI,
|
10487 | '%encodeURIComponent%': encodeURIComponent,
|
10488 | '%Error%': Error,
|
10489 | '%eval%': eval,
|
10490 | '%EvalError%': EvalError,
|
10491 | '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
10492 | '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
10493 | '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
10494 | '%Function%': $Function,
|
10495 | '%GeneratorFunction%': needsEval,
|
10496 | '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
10497 | '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
10498 | '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
10499 | '%isFinite%': isFinite,
|
10500 | '%isNaN%': isNaN,
|
10501 | '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
10502 | '%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
10503 | '%Map%': typeof Map === 'undefined' ? undefined : Map,
|
10504 | '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
10505 | '%Math%': Math,
|
10506 | '%Number%': Number,
|
10507 | '%Object%': Object,
|
10508 | '%parseFloat%': parseFloat,
|
10509 | '%parseInt%': parseInt,
|
10510 | '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
10511 | '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
10512 | '%RangeError%': RangeError,
|
10513 | '%ReferenceError%': ReferenceError,
|
10514 | '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
10515 | '%RegExp%': RegExp,
|
10516 | '%Set%': typeof Set === 'undefined' ? undefined : Set,
|
10517 | '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
10518 | '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
10519 | '%String%': String,
|
10520 | '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
10521 | '%Symbol%': hasSymbols ? Symbol : undefined,
|
10522 | '%SyntaxError%': $SyntaxError,
|
10523 | '%ThrowTypeError%': ThrowTypeError,
|
10524 | '%TypedArray%': TypedArray,
|
10525 | '%TypeError%': $TypeError,
|
10526 | '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
10527 | '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
10528 | '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
10529 | '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
10530 | '%URIError%': URIError,
|
10531 | '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
10532 | '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
10533 | '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
10534 | };
|
10535 |
|
10536 | var doEval = function doEval(name) {
|
10537 | var value;
|
10538 | if (name === '%AsyncFunction%') {
|
10539 | value = getEvalledConstructor('async function () {}');
|
10540 | } else if (name === '%GeneratorFunction%') {
|
10541 | value = getEvalledConstructor('function* () {}');
|
10542 | } else if (name === '%AsyncGeneratorFunction%') {
|
10543 | value = getEvalledConstructor('async function* () {}');
|
10544 | } else if (name === '%AsyncGenerator%') {
|
10545 | var fn = doEval('%AsyncGeneratorFunction%');
|
10546 | if (fn) {
|
10547 | value = fn.prototype;
|
10548 | }
|
10549 | } else if (name === '%AsyncIteratorPrototype%') {
|
10550 | var gen = doEval('%AsyncGenerator%');
|
10551 | if (gen) {
|
10552 | value = getProto(gen.prototype);
|
10553 | }
|
10554 | }
|
10555 |
|
10556 | INTRINSICS[name] = value;
|
10557 |
|
10558 | return value;
|
10559 | };
|
10560 |
|
10561 | var LEGACY_ALIASES = {
|
10562 | '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
10563 | '%ArrayPrototype%': ['Array', 'prototype'],
|
10564 | '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
10565 | '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
10566 | '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
10567 | '%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
10568 | '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
10569 | '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
10570 | '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
10571 | '%BooleanPrototype%': ['Boolean', 'prototype'],
|
10572 | '%DataViewPrototype%': ['DataView', 'prototype'],
|
10573 | '%DatePrototype%': ['Date', 'prototype'],
|
10574 | '%ErrorPrototype%': ['Error', 'prototype'],
|
10575 | '%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
10576 | '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
10577 | '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
10578 | '%FunctionPrototype%': ['Function', 'prototype'],
|
10579 | '%Generator%': ['GeneratorFunction', 'prototype'],
|
10580 | '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
10581 | '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
10582 | '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
10583 | '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
10584 | '%JSONParse%': ['JSON', 'parse'],
|
10585 | '%JSONStringify%': ['JSON', 'stringify'],
|
10586 | '%MapPrototype%': ['Map', 'prototype'],
|
10587 | '%NumberPrototype%': ['Number', 'prototype'],
|
10588 | '%ObjectPrototype%': ['Object', 'prototype'],
|
10589 | '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
10590 | '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
10591 | '%PromisePrototype%': ['Promise', 'prototype'],
|
10592 | '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
10593 | '%Promise_all%': ['Promise', 'all'],
|
10594 | '%Promise_reject%': ['Promise', 'reject'],
|
10595 | '%Promise_resolve%': ['Promise', 'resolve'],
|
10596 | '%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
10597 | '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
10598 | '%RegExpPrototype%': ['RegExp', 'prototype'],
|
10599 | '%SetPrototype%': ['Set', 'prototype'],
|
10600 | '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
10601 | '%StringPrototype%': ['String', 'prototype'],
|
10602 | '%SymbolPrototype%': ['Symbol', 'prototype'],
|
10603 | '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
10604 | '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
10605 | '%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
10606 | '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
10607 | '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
10608 | '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
10609 | '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
10610 | '%URIErrorPrototype%': ['URIError', 'prototype'],
|
10611 | '%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
10612 | '%WeakSetPrototype%': ['WeakSet', 'prototype']
|
10613 | };
|
10614 |
|
10615 | var bind = __webpack_require__( "./node_modules/function-bind/index.js");
|
10616 | var hasOwn = __webpack_require__( "./node_modules/has/src/index.js");
|
10617 | var $concat = bind.call(Function.call, Array.prototype.concat);
|
10618 | var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
10619 | var $replace = bind.call(Function.call, String.prototype.replace);
|
10620 | var $strSlice = bind.call(Function.call, String.prototype.slice);
|
10621 |
|
10622 |
|
10623 | var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
10624 | var reEscapeChar = /\\(\\)?/g;
|
10625 | var stringToPath = function stringToPath(string) {
|
10626 | var first = $strSlice(string, 0, 1);
|
10627 | var last = $strSlice(string, -1);
|
10628 | if (first === '%' && last !== '%') {
|
10629 | throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
10630 | } else if (last === '%' && first !== '%') {
|
10631 | throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
10632 | }
|
10633 | var result = [];
|
10634 | $replace(string, rePropName, function (match, number, quote, subString) {
|
10635 | result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
10636 | });
|
10637 | return result;
|
10638 | };
|
10639 |
|
10640 |
|
10641 | var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
10642 | var intrinsicName = name;
|
10643 | var alias;
|
10644 | if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
10645 | alias = LEGACY_ALIASES[intrinsicName];
|
10646 | intrinsicName = '%' + alias[0] + '%';
|
10647 | }
|
10648 |
|
10649 | if (hasOwn(INTRINSICS, intrinsicName)) {
|
10650 | var value = INTRINSICS[intrinsicName];
|
10651 | if (value === needsEval) {
|
10652 | value = doEval(intrinsicName);
|
10653 | }
|
10654 | if (typeof value === 'undefined' && !allowMissing) {
|
10655 | throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
10656 | }
|
10657 |
|
10658 | return {
|
10659 | alias: alias,
|
10660 | name: intrinsicName,
|
10661 | value: value
|
10662 | };
|
10663 | }
|
10664 |
|
10665 | throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
10666 | };
|
10667 |
|
10668 | module.exports = function GetIntrinsic(name, allowMissing) {
|
10669 | if (typeof name !== 'string' || name.length === 0) {
|
10670 | throw new $TypeError('intrinsic name must be a non-empty string');
|
10671 | }
|
10672 | if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
10673 | throw new $TypeError('"allowMissing" argument must be a boolean');
|
10674 | }
|
10675 |
|
10676 | var parts = stringToPath(name);
|
10677 | var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
10678 |
|
10679 | var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
10680 | var intrinsicRealName = intrinsic.name;
|
10681 | var value = intrinsic.value;
|
10682 | var skipFurtherCaching = false;
|
10683 |
|
10684 | var alias = intrinsic.alias;
|
10685 | if (alias) {
|
10686 | intrinsicBaseName = alias[0];
|
10687 | $spliceApply(parts, $concat([0, 1], alias));
|
10688 | }
|
10689 |
|
10690 | for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
10691 | var part = parts[i];
|
10692 | var first = $strSlice(part, 0, 1);
|
10693 | var last = $strSlice(part, -1);
|
10694 | if (
|
10695 | (
|
10696 | (first === '"' || first === "'" || first === '`')
|
10697 | || (last === '"' || last === "'" || last === '`')
|
10698 | )
|
10699 | && first !== last
|
10700 | ) {
|
10701 | throw new $SyntaxError('property names with quotes must have matching quotes');
|
10702 | }
|
10703 | if (part === 'constructor' || !isOwn) {
|
10704 | skipFurtherCaching = true;
|
10705 | }
|
10706 |
|
10707 | intrinsicBaseName += '.' + part;
|
10708 | intrinsicRealName = '%' + intrinsicBaseName + '%';
|
10709 |
|
10710 | if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
10711 | value = INTRINSICS[intrinsicRealName];
|
10712 | } else if (value != null) {
|
10713 | if (!(part in value)) {
|
10714 | if (!allowMissing) {
|
10715 | throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
10716 | }
|
10717 | return void undefined;
|
10718 | }
|
10719 | if ($gOPD && (i + 1) >= parts.length) {
|
10720 | var desc = $gOPD(value, part);
|
10721 | isOwn = !!desc;
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 |
|
10729 |
|
10730 | if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
10731 | value = desc.get;
|
10732 | } else {
|
10733 | value = value[part];
|
10734 | }
|
10735 | } else {
|
10736 | isOwn = hasOwn(value, part);
|
10737 | value = value[part];
|
10738 | }
|
10739 |
|
10740 | if (isOwn && !skipFurtherCaching) {
|
10741 | INTRINSICS[intrinsicRealName] = value;
|
10742 | }
|
10743 | }
|
10744 | }
|
10745 | return value;
|
10746 | };
|
10747 |
|
10748 |
|
10749 | }),
|
10750 |
|
10751 | "./node_modules/has-symbols/index.js":
|
10752 |
|
10753 |
|
10754 |
|
10755 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10756 |
|
10757 | "use strict";
|
10758 |
|
10759 |
|
10760 | var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
10761 | var hasSymbolSham = __webpack_require__( "./node_modules/has-symbols/shams.js");
|
10762 |
|
10763 | module.exports = function hasNativeSymbols() {
|
10764 | if (typeof origSymbol !== 'function') { return false; }
|
10765 | if (typeof Symbol !== 'function') { return false; }
|
10766 | if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
10767 | if (typeof Symbol('bar') !== 'symbol') { return false; }
|
10768 |
|
10769 | return hasSymbolSham();
|
10770 | };
|
10771 |
|
10772 |
|
10773 | }),
|
10774 |
|
10775 | "./node_modules/has-symbols/shams.js":
|
10776 |
|
10777 |
|
10778 |
|
10779 | ((module) => {
|
10780 |
|
10781 | "use strict";
|
10782 |
|
10783 |
|
10784 |
|
10785 | module.exports = function hasSymbols() {
|
10786 | if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
10787 | if (typeof Symbol.iterator === 'symbol') { return true; }
|
10788 |
|
10789 | var obj = {};
|
10790 | var sym = Symbol('test');
|
10791 | var symObj = Object(sym);
|
10792 | if (typeof sym === 'string') { return false; }
|
10793 |
|
10794 | if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
10795 | if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 |
|
10802 |
|
10803 |
|
10804 |
|
10805 | var symVal = 42;
|
10806 | obj[sym] = symVal;
|
10807 | for (sym in obj) { return false; }
|
10808 | if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
10809 |
|
10810 | if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
10811 |
|
10812 | var syms = Object.getOwnPropertySymbols(obj);
|
10813 | if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
10814 |
|
10815 | if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
10816 |
|
10817 | if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
10818 | var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
10819 | if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
10820 | }
|
10821 |
|
10822 | return true;
|
10823 | };
|
10824 |
|
10825 |
|
10826 | }),
|
10827 |
|
10828 | "./node_modules/has-tostringtag/shams.js":
|
10829 |
|
10830 |
|
10831 |
|
10832 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10833 |
|
10834 | "use strict";
|
10835 |
|
10836 |
|
10837 | var hasSymbols = __webpack_require__( "./node_modules/has-symbols/shams.js");
|
10838 |
|
10839 | module.exports = function hasToStringTagShams() {
|
10840 | return hasSymbols() && !!Symbol.toStringTag;
|
10841 | };
|
10842 |
|
10843 |
|
10844 | }),
|
10845 |
|
10846 | "./node_modules/has/src/index.js":
|
10847 |
|
10848 |
|
10849 |
|
10850 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10851 |
|
10852 | "use strict";
|
10853 |
|
10854 |
|
10855 | var bind = __webpack_require__( "./node_modules/function-bind/index.js");
|
10856 |
|
10857 | module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
10858 |
|
10859 |
|
10860 | }),
|
10861 |
|
10862 | "./node_modules/inherits/inherits_browser.js":
|
10863 |
|
10864 |
|
10865 |
|
10866 | ((module) => {
|
10867 |
|
10868 | if (typeof Object.create === 'function') {
|
10869 |
|
10870 | module.exports = function inherits(ctor, superCtor) {
|
10871 | if (superCtor) {
|
10872 | ctor.super_ = superCtor
|
10873 | ctor.prototype = Object.create(superCtor.prototype, {
|
10874 | constructor: {
|
10875 | value: ctor,
|
10876 | enumerable: false,
|
10877 | writable: true,
|
10878 | configurable: true
|
10879 | }
|
10880 | })
|
10881 | }
|
10882 | };
|
10883 | } else {
|
10884 |
|
10885 | module.exports = function inherits(ctor, superCtor) {
|
10886 | if (superCtor) {
|
10887 | ctor.super_ = superCtor
|
10888 | var TempCtor = function () {}
|
10889 | TempCtor.prototype = superCtor.prototype
|
10890 | ctor.prototype = new TempCtor()
|
10891 | ctor.prototype.constructor = ctor
|
10892 | }
|
10893 | }
|
10894 | }
|
10895 |
|
10896 |
|
10897 | }),
|
10898 |
|
10899 | "./node_modules/is-arguments/index.js":
|
10900 |
|
10901 |
|
10902 |
|
10903 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10904 |
|
10905 | "use strict";
|
10906 |
|
10907 |
|
10908 | var hasToStringTag = __webpack_require__( "./node_modules/has-tostringtag/shams.js")();
|
10909 | var callBound = __webpack_require__( "./node_modules/call-bind/callBound.js");
|
10910 |
|
10911 | var $toString = callBound('Object.prototype.toString');
|
10912 |
|
10913 | var isStandardArguments = function isArguments(value) {
|
10914 | if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
|
10915 | return false;
|
10916 | }
|
10917 | return $toString(value) === '[object Arguments]';
|
10918 | };
|
10919 |
|
10920 | var isLegacyArguments = function isArguments(value) {
|
10921 | if (isStandardArguments(value)) {
|
10922 | return true;
|
10923 | }
|
10924 | return value !== null &&
|
10925 | typeof value === 'object' &&
|
10926 | typeof value.length === 'number' &&
|
10927 | value.length >= 0 &&
|
10928 | $toString(value) !== '[object Array]' &&
|
10929 | $toString(value.callee) === '[object Function]';
|
10930 | };
|
10931 |
|
10932 | var supportsStandardArguments = (function () {
|
10933 | return isStandardArguments(arguments);
|
10934 | }());
|
10935 |
|
10936 | isStandardArguments.isLegacyArguments = isLegacyArguments;
|
10937 |
|
10938 | module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
|
10939 |
|
10940 |
|
10941 | }),
|
10942 |
|
10943 | "./node_modules/is-generator-function/index.js":
|
10944 |
|
10945 |
|
10946 |
|
10947 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10948 |
|
10949 | "use strict";
|
10950 |
|
10951 |
|
10952 | var toStr = Object.prototype.toString;
|
10953 | var fnToStr = Function.prototype.toString;
|
10954 | var isFnRegex = /^\s*(?:function)?\*/;
|
10955 | var hasToStringTag = __webpack_require__( "./node_modules/has-tostringtag/shams.js")();
|
10956 | var getProto = Object.getPrototypeOf;
|
10957 | var getGeneratorFunc = function () {
|
10958 | if (!hasToStringTag) {
|
10959 | return false;
|
10960 | }
|
10961 | try {
|
10962 | return Function('return function*() {}')();
|
10963 | } catch (e) {
|
10964 | }
|
10965 | };
|
10966 | var GeneratorFunction;
|
10967 |
|
10968 | module.exports = function isGeneratorFunction(fn) {
|
10969 | if (typeof fn !== 'function') {
|
10970 | return false;
|
10971 | }
|
10972 | if (isFnRegex.test(fnToStr.call(fn))) {
|
10973 | return true;
|
10974 | }
|
10975 | if (!hasToStringTag) {
|
10976 | var str = toStr.call(fn);
|
10977 | return str === '[object GeneratorFunction]';
|
10978 | }
|
10979 | if (!getProto) {
|
10980 | return false;
|
10981 | }
|
10982 | if (typeof GeneratorFunction === 'undefined') {
|
10983 | var generatorFunc = getGeneratorFunc();
|
10984 | GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
|
10985 | }
|
10986 | return getProto(fn) === GeneratorFunction;
|
10987 | };
|
10988 |
|
10989 |
|
10990 | }),
|
10991 |
|
10992 | "./node_modules/is-typed-array/index.js":
|
10993 |
|
10994 |
|
10995 |
|
10996 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
10997 |
|
10998 | "use strict";
|
10999 |
|
11000 |
|
11001 | var forEach = __webpack_require__( "./node_modules/foreach/index.js");
|
11002 | var availableTypedArrays = __webpack_require__( "./node_modules/available-typed-arrays/index.js");
|
11003 | var callBound = __webpack_require__( "./node_modules/call-bind/callBound.js");
|
11004 |
|
11005 | var $toString = callBound('Object.prototype.toString');
|
11006 | var hasToStringTag = __webpack_require__( "./node_modules/has-tostringtag/shams.js")();
|
11007 |
|
11008 | var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
|
11009 | var typedArrays = availableTypedArrays();
|
11010 |
|
11011 | var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
|
11012 | for (var i = 0; i < array.length; i += 1) {
|
11013 | if (array[i] === value) {
|
11014 | return i;
|
11015 | }
|
11016 | }
|
11017 | return -1;
|
11018 | };
|
11019 | var $slice = callBound('String.prototype.slice');
|
11020 | var toStrTags = {};
|
11021 | var gOPD = __webpack_require__( "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
|
11022 | var getPrototypeOf = Object.getPrototypeOf;
|
11023 | if (hasToStringTag && gOPD && getPrototypeOf) {
|
11024 | forEach(typedArrays, function (typedArray) {
|
11025 | var arr = new g[typedArray]();
|
11026 | if (Symbol.toStringTag in arr) {
|
11027 | var proto = getPrototypeOf(arr);
|
11028 | var descriptor = gOPD(proto, Symbol.toStringTag);
|
11029 | if (!descriptor) {
|
11030 | var superProto = getPrototypeOf(proto);
|
11031 | descriptor = gOPD(superProto, Symbol.toStringTag);
|
11032 | }
|
11033 | toStrTags[typedArray] = descriptor.get;
|
11034 | }
|
11035 | });
|
11036 | }
|
11037 |
|
11038 | var tryTypedArrays = function tryAllTypedArrays(value) {
|
11039 | var anyTrue = false;
|
11040 | forEach(toStrTags, function (getter, typedArray) {
|
11041 | if (!anyTrue) {
|
11042 | try {
|
11043 | anyTrue = getter.call(value) === typedArray;
|
11044 | } catch (e) { }
|
11045 | }
|
11046 | });
|
11047 | return anyTrue;
|
11048 | };
|
11049 |
|
11050 | module.exports = function isTypedArray(value) {
|
11051 | if (!value || typeof value !== 'object') { return false; }
|
11052 | if (!hasToStringTag || !(Symbol.toStringTag in value)) {
|
11053 | var tag = $slice($toString(value), 8, -1);
|
11054 | return $indexOf(typedArrays, tag) > -1;
|
11055 | }
|
11056 | if (!gOPD) { return false; }
|
11057 | return tryTypedArrays(value);
|
11058 | };
|
11059 |
|
11060 |
|
11061 | }),
|
11062 |
|
11063 | "./node_modules/loupe/loupe.js":
|
11064 |
|
11065 |
|
11066 |
|
11067 | (function(__unused_webpack_module, exports, __webpack_require__) {
|
11068 |
|
11069 | (function (global, factory) {
|
11070 | true ? factory(exports) :
|
11071 | 0;
|
11072 | }(this, (function (exports) { 'use strict';
|
11073 |
|
11074 | function _typeof(obj) {
|
11075 | "@babel/helpers - typeof";
|
11076 |
|
11077 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
11078 | _typeof = function (obj) {
|
11079 | return typeof obj;
|
11080 | };
|
11081 | } else {
|
11082 | _typeof = function (obj) {
|
11083 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
11084 | };
|
11085 | }
|
11086 |
|
11087 | return _typeof(obj);
|
11088 | }
|
11089 |
|
11090 | function _slicedToArray(arr, i) {
|
11091 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
11092 | }
|
11093 |
|
11094 | function _arrayWithHoles(arr) {
|
11095 | if (Array.isArray(arr)) return arr;
|
11096 | }
|
11097 |
|
11098 | function _iterableToArrayLimit(arr, i) {
|
11099 | if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
11100 | var _arr = [];
|
11101 | var _n = true;
|
11102 | var _d = false;
|
11103 | var _e = undefined;
|
11104 |
|
11105 | try {
|
11106 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
11107 | _arr.push(_s.value);
|
11108 |
|
11109 | if (i && _arr.length === i) break;
|
11110 | }
|
11111 | } catch (err) {
|
11112 | _d = true;
|
11113 | _e = err;
|
11114 | } finally {
|
11115 | try {
|
11116 | if (!_n && _i["return"] != null) _i["return"]();
|
11117 | } finally {
|
11118 | if (_d) throw _e;
|
11119 | }
|
11120 | }
|
11121 |
|
11122 | return _arr;
|
11123 | }
|
11124 |
|
11125 | function _unsupportedIterableToArray(o, minLen) {
|
11126 | if (!o) return;
|
11127 | if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
11128 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
11129 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
11130 | if (n === "Map" || n === "Set") return Array.from(o);
|
11131 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
11132 | }
|
11133 |
|
11134 | function _arrayLikeToArray(arr, len) {
|
11135 | if (len == null || len > arr.length) len = arr.length;
|
11136 |
|
11137 | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
11138 |
|
11139 | return arr2;
|
11140 | }
|
11141 |
|
11142 | function _nonIterableRest() {
|
11143 | throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
11144 | }
|
11145 |
|
11146 | var ansiColors = {
|
11147 | bold: ['1', '22'],
|
11148 | dim: ['2', '22'],
|
11149 | italic: ['3', '23'],
|
11150 | underline: ['4', '24'],
|
11151 |
|
11152 | inverse: ['7', '27'],
|
11153 | hidden: ['8', '28'],
|
11154 | strike: ['9', '29'],
|
11155 |
|
11156 |
|
11157 | black: ['30', '39'],
|
11158 | red: ['31', '39'],
|
11159 | green: ['32', '39'],
|
11160 | yellow: ['33', '39'],
|
11161 | blue: ['34', '39'],
|
11162 | magenta: ['35', '39'],
|
11163 | cyan: ['36', '39'],
|
11164 | white: ['37', '39'],
|
11165 | brightblack: ['30;1', '39'],
|
11166 | brightred: ['31;1', '39'],
|
11167 | brightgreen: ['32;1', '39'],
|
11168 | brightyellow: ['33;1', '39'],
|
11169 | brightblue: ['34;1', '39'],
|
11170 | brightmagenta: ['35;1', '39'],
|
11171 | brightcyan: ['36;1', '39'],
|
11172 | brightwhite: ['37;1', '39'],
|
11173 | grey: ['90', '39']
|
11174 | };
|
11175 | var styles = {
|
11176 | special: 'cyan',
|
11177 | number: 'yellow',
|
11178 | bigint: 'yellow',
|
11179 | boolean: 'yellow',
|
11180 | undefined: 'grey',
|
11181 | null: 'bold',
|
11182 | string: 'green',
|
11183 | symbol: 'green',
|
11184 | date: 'magenta',
|
11185 | regexp: 'red'
|
11186 | };
|
11187 | var truncator = '…';
|
11188 |
|
11189 | function colorise(value, styleType) {
|
11190 | var color = ansiColors[styles[styleType]] || ansiColors[styleType];
|
11191 |
|
11192 | if (!color) {
|
11193 | return String(value);
|
11194 | }
|
11195 |
|
11196 | return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m");
|
11197 | }
|
11198 |
|
11199 | function normaliseOptions() {
|
11200 | var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
11201 | _ref$showHidden = _ref.showHidden,
|
11202 | showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden,
|
11203 | _ref$depth = _ref.depth,
|
11204 | depth = _ref$depth === void 0 ? 2 : _ref$depth,
|
11205 | _ref$colors = _ref.colors,
|
11206 | colors = _ref$colors === void 0 ? false : _ref$colors,
|
11207 | _ref$customInspect = _ref.customInspect,
|
11208 | customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect,
|
11209 | _ref$showProxy = _ref.showProxy,
|
11210 | showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy,
|
11211 | _ref$maxArrayLength = _ref.maxArrayLength,
|
11212 | maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength,
|
11213 | _ref$breakLength = _ref.breakLength,
|
11214 | breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength,
|
11215 | _ref$seen = _ref.seen,
|
11216 | seen = _ref$seen === void 0 ? [] : _ref$seen,
|
11217 | _ref$truncate = _ref.truncate,
|
11218 | truncate = _ref$truncate === void 0 ? Infinity : _ref$truncate,
|
11219 | _ref$stylize = _ref.stylize,
|
11220 | stylize = _ref$stylize === void 0 ? String : _ref$stylize;
|
11221 |
|
11222 | var options = {
|
11223 | showHidden: Boolean(showHidden),
|
11224 | depth: Number(depth),
|
11225 | colors: Boolean(colors),
|
11226 | customInspect: Boolean(customInspect),
|
11227 | showProxy: Boolean(showProxy),
|
11228 | maxArrayLength: Number(maxArrayLength),
|
11229 | breakLength: Number(breakLength),
|
11230 | truncate: Number(truncate),
|
11231 | seen: seen,
|
11232 | stylize: stylize
|
11233 | };
|
11234 |
|
11235 | if (options.colors) {
|
11236 | options.stylize = colorise;
|
11237 | }
|
11238 |
|
11239 | return options;
|
11240 | }
|
11241 | function truncate(string, length) {
|
11242 | var tail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : truncator;
|
11243 | string = String(string);
|
11244 | var tailLength = tail.length;
|
11245 | var stringLength = string.length;
|
11246 |
|
11247 | if (tailLength > length && stringLength > tailLength) {
|
11248 | return tail;
|
11249 | }
|
11250 |
|
11251 | if (stringLength > length && stringLength > tailLength) {
|
11252 | return "".concat(string.slice(0, length - tailLength)).concat(tail);
|
11253 | }
|
11254 |
|
11255 | return string;
|
11256 | }
|
11257 |
|
11258 | function inspectList(list, options, inspectItem) {
|
11259 | var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', ';
|
11260 | inspectItem = inspectItem || options.inspect;
|
11261 | var size = list.length;
|
11262 | if (size === 0) return '';
|
11263 | var originalLength = options.truncate;
|
11264 | var output = '';
|
11265 | var peek = '';
|
11266 | var truncated = '';
|
11267 |
|
11268 | for (var i = 0; i < size; i += 1) {
|
11269 | var last = i + 1 === list.length;
|
11270 | var secondToLast = i + 2 === list.length;
|
11271 | truncated = "".concat(truncator, "(").concat(list.length - i, ")");
|
11272 | var value = list[i];
|
11273 |
|
11274 | options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
11275 | var string = peek || inspectItem(value, options) + (last ? '' : separator);
|
11276 | var nextLength = output.length + string.length;
|
11277 | var truncatedLength = nextLength + truncated.length;
|
11278 |
|
11279 |
|
11280 | if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
11281 | break;
|
11282 | }
|
11283 |
|
11284 |
|
11285 |
|
11286 | if (!last && !secondToLast && truncatedLength > originalLength) {
|
11287 | break;
|
11288 | }
|
11289 |
|
11290 |
|
11291 |
|
11292 | peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator);
|
11293 |
|
11294 |
|
11295 | if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
11296 | break;
|
11297 | }
|
11298 |
|
11299 | output += string;
|
11300 |
|
11301 |
|
11302 | if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
11303 | truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")");
|
11304 | break;
|
11305 | }
|
11306 |
|
11307 | truncated = '';
|
11308 | }
|
11309 |
|
11310 | return "".concat(output).concat(truncated);
|
11311 | }
|
11312 |
|
11313 | function quoteComplexKey(key) {
|
11314 | if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
11315 | return key;
|
11316 | }
|
11317 |
|
11318 | return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
11319 | }
|
11320 |
|
11321 | function inspectProperty(_ref2, options) {
|
11322 | var _ref3 = _slicedToArray(_ref2, 2),
|
11323 | key = _ref3[0],
|
11324 | value = _ref3[1];
|
11325 |
|
11326 | options.truncate -= 2;
|
11327 |
|
11328 | if (typeof key === 'string') {
|
11329 | key = quoteComplexKey(key);
|
11330 | } else if (typeof key !== 'number') {
|
11331 | key = "[".concat(options.inspect(key, options), "]");
|
11332 | }
|
11333 |
|
11334 | options.truncate -= key.length;
|
11335 | value = options.inspect(value, options);
|
11336 | return "".concat(key, ": ").concat(value);
|
11337 | }
|
11338 |
|
11339 | function inspectArray(array, options) {
|
11340 |
|
11341 |
|
11342 | var nonIndexProperties = Object.keys(array).slice(array.length);
|
11343 | if (!array.length && !nonIndexProperties.length) return '[]';
|
11344 | options.truncate -= 4;
|
11345 | var listContents = inspectList(array, options);
|
11346 | options.truncate -= listContents.length;
|
11347 | var propertyContents = '';
|
11348 |
|
11349 | if (nonIndexProperties.length) {
|
11350 | propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
11351 | return [key, array[key]];
|
11352 | }), options, inspectProperty);
|
11353 | }
|
11354 |
|
11355 | return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
11356 | }
|
11357 |
|
11358 | |
11359 |
|
11360 |
|
11361 |
|
11362 |
|
11363 |
|
11364 | |
11365 |
|
11366 |
|
11367 |
|
11368 |
|
11369 |
|
11370 |
|
11371 |
|
11372 |
|
11373 |
|
11374 |
|
11375 |
|
11376 |
|
11377 | var toString = Function.prototype.toString;
|
11378 | var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
|
11379 | function getFuncName(aFunc) {
|
11380 | if (typeof aFunc !== 'function') {
|
11381 | return null;
|
11382 | }
|
11383 |
|
11384 | var name = '';
|
11385 | if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
|
11386 |
|
11387 | var match = toString.call(aFunc).match(functionNameMatch);
|
11388 | if (match) {
|
11389 | name = match[1];
|
11390 | }
|
11391 | } else {
|
11392 |
|
11393 | name = aFunc.name;
|
11394 | }
|
11395 |
|
11396 | return name;
|
11397 | }
|
11398 |
|
11399 | var getFuncName_1 = getFuncName;
|
11400 |
|
11401 | var getArrayName = function getArrayName(array) {
|
11402 |
|
11403 | if (typeof Buffer === 'function' && array instanceof Buffer) {
|
11404 | return 'Buffer';
|
11405 | }
|
11406 |
|
11407 | if (array[Symbol.toStringTag]) {
|
11408 | return array[Symbol.toStringTag];
|
11409 | }
|
11410 |
|
11411 | return getFuncName_1(array.constructor);
|
11412 | };
|
11413 |
|
11414 | function inspectTypedArray(array, options) {
|
11415 | var name = getArrayName(array);
|
11416 | options.truncate -= name.length + 4;
|
11417 |
|
11418 |
|
11419 | var nonIndexProperties = Object.keys(array).slice(array.length);
|
11420 | if (!array.length && !nonIndexProperties.length) return "".concat(name, "[]");
|
11421 |
|
11422 |
|
11423 | var output = '';
|
11424 |
|
11425 | for (var i = 0; i < array.length; i++) {
|
11426 | var string = "".concat(options.stylize(truncate(array[i], options.truncate), 'number')).concat(i === array.length - 1 ? '' : ', ');
|
11427 | options.truncate -= string.length;
|
11428 |
|
11429 | if (array[i] !== array.length && options.truncate <= 3) {
|
11430 | output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")");
|
11431 | break;
|
11432 | }
|
11433 |
|
11434 | output += string;
|
11435 | }
|
11436 |
|
11437 | var propertyContents = '';
|
11438 |
|
11439 | if (nonIndexProperties.length) {
|
11440 | propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
11441 | return [key, array[key]];
|
11442 | }), options, inspectProperty);
|
11443 | }
|
11444 |
|
11445 | return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
11446 | }
|
11447 |
|
11448 | function inspectDate(dateObject, options) {
|
11449 |
|
11450 | var split = dateObject.toJSON().split('T');
|
11451 | var date = split[0];
|
11452 | return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), 'date');
|
11453 | }
|
11454 |
|
11455 | function inspectFunction(func, options) {
|
11456 | var name = getFuncName_1(func);
|
11457 |
|
11458 | if (!name) {
|
11459 | return options.stylize('[Function]', 'special');
|
11460 | }
|
11461 |
|
11462 | return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), 'special');
|
11463 | }
|
11464 |
|
11465 | function inspectMapEntry(_ref, options) {
|
11466 | var _ref2 = _slicedToArray(_ref, 2),
|
11467 | key = _ref2[0],
|
11468 | value = _ref2[1];
|
11469 |
|
11470 | options.truncate -= 4;
|
11471 | key = options.inspect(key, options);
|
11472 | options.truncate -= key.length;
|
11473 | value = options.inspect(value, options);
|
11474 | return "".concat(key, " => ").concat(value);
|
11475 | }
|
11476 |
|
11477 |
|
11478 | function mapToEntries(map) {
|
11479 | var entries = [];
|
11480 | map.forEach(function (value, key) {
|
11481 | entries.push([key, value]);
|
11482 | });
|
11483 | return entries;
|
11484 | }
|
11485 |
|
11486 | function inspectMap(map, options) {
|
11487 | var size = map.size - 1;
|
11488 |
|
11489 | if (size <= 0) {
|
11490 | return 'Map{}';
|
11491 | }
|
11492 |
|
11493 | options.truncate -= 7;
|
11494 | return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }");
|
11495 | }
|
11496 |
|
11497 | var isNaN = Number.isNaN || function (i) {
|
11498 | return i !== i;
|
11499 | };
|
11500 |
|
11501 |
|
11502 | function inspectNumber(number, options) {
|
11503 | if (isNaN(number)) {
|
11504 | return options.stylize('NaN', 'number');
|
11505 | }
|
11506 |
|
11507 | if (number === Infinity) {
|
11508 | return options.stylize('Infinity', 'number');
|
11509 | }
|
11510 |
|
11511 | if (number === -Infinity) {
|
11512 | return options.stylize('-Infinity', 'number');
|
11513 | }
|
11514 |
|
11515 | if (number === 0) {
|
11516 | return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number');
|
11517 | }
|
11518 |
|
11519 | return options.stylize(truncate(number, options.truncate), 'number');
|
11520 | }
|
11521 |
|
11522 | function inspectBigInt(number, options) {
|
11523 | var nums = truncate(number.toString(), options.truncate - 1);
|
11524 | if (nums !== truncator) nums += 'n';
|
11525 | return options.stylize(nums, 'bigint');
|
11526 | }
|
11527 |
|
11528 | function inspectRegExp(value, options) {
|
11529 | var flags = value.toString().split('/')[2];
|
11530 | var sourceLength = options.truncate - (2 + flags.length);
|
11531 | var source = value.source;
|
11532 | return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), 'regexp');
|
11533 | }
|
11534 |
|
11535 | function arrayFromSet(set) {
|
11536 | var values = [];
|
11537 | set.forEach(function (value) {
|
11538 | values.push(value);
|
11539 | });
|
11540 | return values;
|
11541 | }
|
11542 |
|
11543 | function inspectSet(set, options) {
|
11544 | if (set.size === 0) return 'Set{}';
|
11545 | options.truncate -= 7;
|
11546 | return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }");
|
11547 | }
|
11548 |
|
11549 | var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + "\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", 'g');
|
11550 | var escapeCharacters = {
|
11551 | '\b': '\\b',
|
11552 | '\t': '\\t',
|
11553 | '\n': '\\n',
|
11554 | '\f': '\\f',
|
11555 | '\r': '\\r',
|
11556 | "'": "\\'",
|
11557 | '\\': '\\\\'
|
11558 | };
|
11559 | var hex = 16;
|
11560 | var unicodeLength = 4;
|
11561 |
|
11562 | function escape(char) {
|
11563 | return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength));
|
11564 | }
|
11565 |
|
11566 | function inspectString(string, options) {
|
11567 | if (stringEscapeChars.test(string)) {
|
11568 | string = string.replace(stringEscapeChars, escape);
|
11569 | }
|
11570 |
|
11571 | return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), 'string');
|
11572 | }
|
11573 |
|
11574 | function inspectSymbol(value) {
|
11575 | if ('description' in Symbol.prototype) {
|
11576 | return value.description ? "Symbol(".concat(value.description, ")") : 'Symbol()';
|
11577 | }
|
11578 |
|
11579 | return value.toString();
|
11580 | }
|
11581 |
|
11582 | var getPromiseValue = function getPromiseValue() {
|
11583 | return 'Promise{…}';
|
11584 | };
|
11585 |
|
11586 | try {
|
11587 | var _process$binding = process.binding('util'),
|
11588 | getPromiseDetails = _process$binding.getPromiseDetails,
|
11589 | kPending = _process$binding.kPending,
|
11590 | kRejected = _process$binding.kRejected;
|
11591 |
|
11592 | if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
11593 | getPromiseValue = function getPromiseValue(value, options) {
|
11594 | var _getPromiseDetails = getPromiseDetails(value),
|
11595 | _getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2),
|
11596 | state = _getPromiseDetails2[0],
|
11597 | innerValue = _getPromiseDetails2[1];
|
11598 |
|
11599 | if (state === kPending) {
|
11600 | return 'Promise{<pending>}';
|
11601 | }
|
11602 |
|
11603 | return "Promise".concat(state === kRejected ? '!' : '', "{").concat(options.inspect(innerValue, options), "}");
|
11604 | };
|
11605 | }
|
11606 | } catch (notNode) {
|
11607 |
|
11608 | }
|
11609 |
|
11610 | var inspectPromise = getPromiseValue;
|
11611 |
|
11612 | function inspectObject(object, options) {
|
11613 | var properties = Object.getOwnPropertyNames(object);
|
11614 | var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
11615 |
|
11616 | if (properties.length === 0 && symbols.length === 0) {
|
11617 | return '{}';
|
11618 | }
|
11619 |
|
11620 | options.truncate -= 4;
|
11621 | options.seen = options.seen || [];
|
11622 |
|
11623 | if (options.seen.indexOf(object) >= 0) {
|
11624 | return '[Circular]';
|
11625 | }
|
11626 |
|
11627 | options.seen.push(object);
|
11628 | var propertyContents = inspectList(properties.map(function (key) {
|
11629 | return [key, object[key]];
|
11630 | }), options, inspectProperty);
|
11631 | var symbolContents = inspectList(symbols.map(function (key) {
|
11632 | return [key, object[key]];
|
11633 | }), options, inspectProperty);
|
11634 | options.seen.pop();
|
11635 | var sep = '';
|
11636 |
|
11637 | if (propertyContents && symbolContents) {
|
11638 | sep = ', ';
|
11639 | }
|
11640 |
|
11641 | return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }");
|
11642 | }
|
11643 |
|
11644 | var toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false;
|
11645 | function inspectClass(value, options) {
|
11646 | var name = '';
|
11647 |
|
11648 | if (toStringTag && toStringTag in value) {
|
11649 | name = value[toStringTag];
|
11650 | }
|
11651 |
|
11652 | name = name || getFuncName_1(value.constructor);
|
11653 |
|
11654 | if (!name || name === '_class') {
|
11655 | name = '<Anonymous Class>';
|
11656 | }
|
11657 |
|
11658 | options.truncate -= name.length;
|
11659 | return "".concat(name).concat(inspectObject(value, options));
|
11660 | }
|
11661 |
|
11662 | function inspectArguments(args, options) {
|
11663 | if (args.length === 0) return 'Arguments[]';
|
11664 | options.truncate -= 13;
|
11665 | return "Arguments[ ".concat(inspectList(args, options), " ]");
|
11666 | }
|
11667 |
|
11668 | var errorKeys = ['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber', 'number', 'description'];
|
11669 | function inspectObject$1(error, options) {
|
11670 | var properties = Object.getOwnPropertyNames(error).filter(function (key) {
|
11671 | return errorKeys.indexOf(key) === -1;
|
11672 | });
|
11673 | var name = error.name;
|
11674 | options.truncate -= name.length;
|
11675 | var message = '';
|
11676 |
|
11677 | if (typeof error.message === 'string') {
|
11678 | message = truncate(error.message, options.truncate);
|
11679 | } else {
|
11680 | properties.unshift('message');
|
11681 | }
|
11682 |
|
11683 | message = message ? ": ".concat(message) : '';
|
11684 | options.truncate -= message.length + 5;
|
11685 | var propertyContents = inspectList(properties.map(function (key) {
|
11686 | return [key, error[key]];
|
11687 | }), options, inspectProperty);
|
11688 | return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : '');
|
11689 | }
|
11690 |
|
11691 | function inspectAttribute(_ref, options) {
|
11692 | var _ref2 = _slicedToArray(_ref, 2),
|
11693 | key = _ref2[0],
|
11694 | value = _ref2[1];
|
11695 |
|
11696 | options.truncate -= 3;
|
11697 |
|
11698 | if (!value) {
|
11699 | return "".concat(options.stylize(key, 'yellow'));
|
11700 | }
|
11701 |
|
11702 | return "".concat(options.stylize(key, 'yellow'), "=").concat(options.stylize("\"".concat(value, "\""), 'string'));
|
11703 | }
|
11704 | function inspectHTMLCollection(collection, options) {
|
11705 |
|
11706 | return inspectList(collection, options, inspectHTML, '\n');
|
11707 | }
|
11708 | function inspectHTML(element, options) {
|
11709 | var properties = element.getAttributeNames();
|
11710 | var name = element.tagName.toLowerCase();
|
11711 | var head = options.stylize("<".concat(name), 'special');
|
11712 | var headClose = options.stylize(">", 'special');
|
11713 | var tail = options.stylize("</".concat(name, ">"), 'special');
|
11714 | options.truncate -= name.length * 2 + 5;
|
11715 | var propertyContents = '';
|
11716 |
|
11717 | if (properties.length > 0) {
|
11718 | propertyContents += ' ';
|
11719 | propertyContents += inspectList(properties.map(function (key) {
|
11720 | return [key, element.getAttribute(key)];
|
11721 | }), options, inspectAttribute, ' ');
|
11722 | }
|
11723 |
|
11724 | options.truncate -= propertyContents.length;
|
11725 | var truncate = options.truncate;
|
11726 | var children = inspectHTMLCollection(element.children, options);
|
11727 |
|
11728 | if (children && children.length > truncate) {
|
11729 | children = "".concat(truncator, "(").concat(element.children.length, ")");
|
11730 | }
|
11731 |
|
11732 | return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail);
|
11733 | }
|
11734 |
|
11735 | var symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function';
|
11736 | var chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect';
|
11737 | var nodeInspect = false;
|
11738 |
|
11739 | try {
|
11740 |
|
11741 | var nodeUtil = __webpack_require__( "./node_modules/util/util.js");
|
11742 |
|
11743 | nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
11744 | } catch (noNodeInspect) {
|
11745 | nodeInspect = false;
|
11746 | }
|
11747 |
|
11748 | var constructorMap = new WeakMap();
|
11749 | var stringTagMap = {};
|
11750 | var baseTypesMap = {
|
11751 | undefined: function undefined$1(value, options) {
|
11752 | return options.stylize('undefined', 'undefined');
|
11753 | },
|
11754 | null: function _null(value, options) {
|
11755 | return options.stylize(null, 'null');
|
11756 | },
|
11757 | boolean: function boolean(value, options) {
|
11758 | return options.stylize(value, 'boolean');
|
11759 | },
|
11760 | Boolean: function Boolean(value, options) {
|
11761 | return options.stylize(value, 'boolean');
|
11762 | },
|
11763 | number: inspectNumber,
|
11764 | Number: inspectNumber,
|
11765 | bigint: inspectBigInt,
|
11766 | BigInt: inspectBigInt,
|
11767 | string: inspectString,
|
11768 | String: inspectString,
|
11769 | function: inspectFunction,
|
11770 | Function: inspectFunction,
|
11771 | symbol: inspectSymbol,
|
11772 | // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
|
11773 | Symbol: inspectSymbol,
|
11774 | Array: inspectArray,
|
11775 | Date: inspectDate,
|
11776 | Map: inspectMap,
|
11777 | Set: inspectSet,
|
11778 | RegExp: inspectRegExp,
|
11779 | Promise: inspectPromise,
|
11780 | // WeakSet, WeakMap are totally opaque to us
|
11781 | WeakSet: function WeakSet(value, options) {
|
11782 | return options.stylize('WeakSet{…}', 'special');
|
11783 | },
|
11784 | WeakMap: function WeakMap(value, options) {
|
11785 | return options.stylize('WeakMap{…}', 'special');
|
11786 | },
|
11787 | Arguments: inspectArguments,
|
11788 | Int8Array: inspectTypedArray,
|
11789 | Uint8Array: inspectTypedArray,
|
11790 | Uint8ClampedArray: inspectTypedArray,
|
11791 | Int16Array: inspectTypedArray,
|
11792 | Uint16Array: inspectTypedArray,
|
11793 | Int32Array: inspectTypedArray,
|
11794 | Uint32Array: inspectTypedArray,
|
11795 | Float32Array: inspectTypedArray,
|
11796 | Float64Array: inspectTypedArray,
|
11797 | Generator: function Generator() {
|
11798 | return '';
|
11799 | },
|
11800 | DataView: function DataView() {
|
11801 | return '';
|
11802 | },
|
11803 | ArrayBuffer: function ArrayBuffer() {
|
11804 | return '';
|
11805 | },
|
11806 | Error: inspectObject$1,
|
11807 | HTMLCollection: inspectHTMLCollection,
|
11808 | NodeList: inspectHTMLCollection
|
11809 | };
|
11810 |
|
11811 | var inspectCustom = function inspectCustom(value, options, type) {
|
11812 | if (chaiInspect in value && typeof value[chaiInspect] === 'function') {
|
11813 | return value[chaiInspect](options);
|
11814 | }
|
11815 |
|
11816 | if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === 'function') {
|
11817 | return value[nodeInspect](options.depth, options);
|
11818 | }
|
11819 |
|
11820 | if ('inspect' in value && typeof value.inspect === 'function') {
|
11821 | return value.inspect(options.depth, options);
|
11822 | }
|
11823 |
|
11824 | if ('constructor' in value && constructorMap.has(value.constructor)) {
|
11825 | return constructorMap.get(value.constructor)(value, options);
|
11826 | }
|
11827 |
|
11828 | if (stringTagMap[type]) {
|
11829 | return stringTagMap[type](value, options);
|
11830 | }
|
11831 |
|
11832 | return '';
|
11833 | };
|
11834 |
|
11835 | var toString$1 = Object.prototype.toString;
|
11836 |
|
11837 | function inspect(value, options) {
|
11838 | options = normaliseOptions(options);
|
11839 | options.inspect = inspect;
|
11840 | var _options = options,
|
11841 | customInspect = _options.customInspect;
|
11842 | var type = value === null ? 'null' : _typeof(value);
|
11843 |
|
11844 | if (type === 'object') {
|
11845 | type = toString$1.call(value).slice(8, -1);
|
11846 | }
|
11847 |
|
11848 |
|
11849 | if (baseTypesMap[type]) {
|
11850 | return baseTypesMap[type](value, options);
|
11851 | }
|
11852 |
|
11853 |
|
11854 | if (customInspect && value) {
|
11855 | var output = inspectCustom(value, options, type);
|
11856 |
|
11857 | if (output) {
|
11858 | if (typeof output === 'string') return output;
|
11859 | return inspect(output, options);
|
11860 | }
|
11861 | }
|
11862 |
|
11863 | var proto = value ? Object.getPrototypeOf(value) : false;
|
11864 |
|
11865 | if (proto === Object.prototype || proto === null) {
|
11866 | return inspectObject(value, options);
|
11867 | }
|
11868 |
|
11869 |
|
11870 |
|
11871 | if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) {
|
11872 | return inspectHTML(value, options);
|
11873 | }
|
11874 |
|
11875 | if ('constructor' in value) {
|
11876 |
|
11877 | if (value.constructor !== Object) {
|
11878 | return inspectClass(value, options);
|
11879 | }
|
11880 |
|
11881 |
|
11882 | return inspectObject(value, options);
|
11883 | }
|
11884 |
|
11885 |
|
11886 | return options.stylize(String(value), type);
|
11887 | }
|
11888 | function registerConstructor(constructor, inspector) {
|
11889 | if (constructorMap.has(constructor)) {
|
11890 | return false;
|
11891 | }
|
11892 |
|
11893 | constructorMap.add(constructor, inspector);
|
11894 | return true;
|
11895 | }
|
11896 | function registerStringTag(stringTag, inspector) {
|
11897 | if (stringTag in stringTagMap) {
|
11898 | return false;
|
11899 | }
|
11900 |
|
11901 | stringTagMap[stringTag] = inspector;
|
11902 | return true;
|
11903 | }
|
11904 | var custom = chaiInspect;
|
11905 |
|
11906 | exports.custom = custom;
|
11907 | exports.default = inspect;
|
11908 | exports.inspect = inspect;
|
11909 | exports.registerConstructor = registerConstructor;
|
11910 | exports.registerStringTag = registerStringTag;
|
11911 |
|
11912 | Object.defineProperty(exports, '__esModule', { value: true });
|
11913 |
|
11914 | })));
|
11915 |
|
11916 |
|
11917 | }),
|
11918 |
|
11919 | "./node_modules/pathval/index.js":
|
11920 |
|
11921 |
|
11922 |
|
11923 | ((module) => {
|
11924 |
|
11925 | "use strict";
|
11926 |
|
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 |
|
11967 |
|
11968 |
|
11969 |
|
11970 |
|
11971 |
|
11972 | function hasProperty(obj, name) {
|
11973 | if (typeof obj === 'undefined' || obj === null) {
|
11974 | return false;
|
11975 | }
|
11976 |
|
11977 |
|
11978 | return name in Object(obj);
|
11979 | }
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 |
|
11985 |
|
11986 |
|
11987 |
|
11988 |
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 | function parsePath(path) {
|
12001 | var str = path.replace(/([^\\])\[/g, '$1.[');
|
12002 | var parts = str.match(/(\\\.|[^.]+?)+/g);
|
12003 | return parts.map(function mapMatches(value) {
|
12004 | if (
|
12005 | value === 'constructor' ||
|
12006 | value === '__proto__' ||
|
12007 | value === 'prototype'
|
12008 | ) {
|
12009 | return {};
|
12010 | }
|
12011 | var regexp = /^\[(\d+)\]$/;
|
12012 | var mArr = regexp.exec(value);
|
12013 | var parsed = null;
|
12014 | if (mArr) {
|
12015 | parsed = { i: parseFloat(mArr[1]) };
|
12016 | } else {
|
12017 | parsed = { p: value.replace(/\\([.[\]])/g, '$1') };
|
12018 | }
|
12019 |
|
12020 | return parsed;
|
12021 | });
|
12022 | }
|
12023 |
|
12024 |
|
12025 |
|
12026 |
|
12027 |
|
12028 |
|
12029 |
|
12030 |
|
12031 |
|
12032 |
|
12033 |
|
12034 |
|
12035 |
|
12036 |
|
12037 |
|
12038 |
|
12039 | function internalGetPathValue(obj, parsed, pathDepth) {
|
12040 | var temporaryValue = obj;
|
12041 | var res = null;
|
12042 | pathDepth = typeof pathDepth === 'undefined' ? parsed.length : pathDepth;
|
12043 |
|
12044 | for (var i = 0; i < pathDepth; i++) {
|
12045 | var part = parsed[i];
|
12046 | if (temporaryValue) {
|
12047 | if (typeof part.p === 'undefined') {
|
12048 | temporaryValue = temporaryValue[part.i];
|
12049 | } else {
|
12050 | temporaryValue = temporaryValue[part.p];
|
12051 | }
|
12052 |
|
12053 | if (i === pathDepth - 1) {
|
12054 | res = temporaryValue;
|
12055 | }
|
12056 | }
|
12057 | }
|
12058 |
|
12059 | return res;
|
12060 | }
|
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 |
|
12070 |
|
12071 |
|
12072 |
|
12073 |
|
12074 |
|
12075 |
|
12076 | function internalSetPathValue(obj, val, parsed) {
|
12077 | var tempObj = obj;
|
12078 | var pathDepth = parsed.length;
|
12079 | var part = null;
|
12080 |
|
12081 | for (var i = 0; i < pathDepth; i++) {
|
12082 | var propName = null;
|
12083 | var propVal = null;
|
12084 | part = parsed[i];
|
12085 |
|
12086 |
|
12087 | if (i === pathDepth - 1) {
|
12088 | propName = typeof part.p === 'undefined' ? part.i : part.p;
|
12089 |
|
12090 | tempObj[propName] = val;
|
12091 | } else if (typeof part.p !== 'undefined' && tempObj[part.p]) {
|
12092 | tempObj = tempObj[part.p];
|
12093 | } else if (typeof part.i !== 'undefined' && tempObj[part.i]) {
|
12094 | tempObj = tempObj[part.i];
|
12095 | } else {
|
12096 |
|
12097 | var next = parsed[i + 1];
|
12098 |
|
12099 | propName = typeof part.p === 'undefined' ? part.i : part.p;
|
12100 |
|
12101 | propVal = typeof next.p === 'undefined' ? [] : {};
|
12102 | tempObj[propName] = propVal;
|
12103 | tempObj = tempObj[propName];
|
12104 | }
|
12105 | }
|
12106 | }
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 | function getPathInfo(obj, path) {
|
12131 | var parsed = parsePath(path);
|
12132 | var last = parsed[parsed.length - 1];
|
12133 | var info = {
|
12134 | parent:
|
12135 | parsed.length > 1 ?
|
12136 | internalGetPathValue(obj, parsed, parsed.length - 1) :
|
12137 | obj,
|
12138 | name: last.p || last.i,
|
12139 | value: internalGetPathValue(obj, parsed),
|
12140 | };
|
12141 | info.exists = hasProperty(info.parent, info.name);
|
12142 |
|
12143 | return info;
|
12144 | }
|
12145 |
|
12146 |
|
12147 |
|
12148 |
|
12149 |
|
12150 |
|
12151 |
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 |
|
12161 |
|
12162 |
|
12163 |
|
12164 |
|
12165 |
|
12166 |
|
12167 |
|
12168 |
|
12169 |
|
12170 |
|
12171 |
|
12172 |
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 | function getPathValue(obj, path) {
|
12178 | var info = getPathInfo(obj, path);
|
12179 | return info.value;
|
12180 | }
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 | function setPathValue(obj, path, val) {
|
12216 | var parsed = parsePath(path);
|
12217 | internalSetPathValue(obj, val, parsed);
|
12218 | return obj;
|
12219 | }
|
12220 |
|
12221 | module.exports = {
|
12222 | hasProperty: hasProperty,
|
12223 | getPathInfo: getPathInfo,
|
12224 | getPathValue: getPathValue,
|
12225 | setPathValue: setPathValue,
|
12226 | };
|
12227 |
|
12228 |
|
12229 | }),
|
12230 |
|
12231 | "./src/__tests__/pointer.spec.ts":
|
12232 |
|
12233 |
|
12234 |
|
12235 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12236 |
|
12237 | "use strict";
|
12238 | __webpack_require__.r(__webpack_exports__);
|
12239 | var chai__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./node_modules/chai/index.mjs");
|
12240 | var util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./node_modules/util/util.js");
|
12241 | var util__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_1__);
|
12242 | var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./src/index.ts");
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 | var rand = function (min, max) {
|
12251 | return Math.random() * (max - min) + min;
|
12252 | };
|
12253 | describe('JsonPointer', function () {
|
12254 | var data0 = {
|
12255 | has: 'data',
|
12256 | arr: ['data', { nested: 'object with data' }, null],
|
12257 | nested: { even: { further: 'hello' } },
|
12258 | };
|
12259 |
|
12260 | var tests0 = [
|
12261 | ['', data0],
|
12262 | ['/has', data0.has],
|
12263 | ['/arr', data0.arr],
|
12264 | ['/arr/0', data0.arr[0]],
|
12265 | ['/arr/1', data0.arr[1]],
|
12266 | ['/arr/1/nested', data0.arr[1].nested],
|
12267 | ['/arr/2', data0.arr[2]],
|
12268 | ['/nested', data0.nested],
|
12269 | ['/nested/even', data0.nested.even],
|
12270 | ['/nested/even/further', data0.nested.even.further],
|
12271 | ['/hasnot', undefined],
|
12272 | ];
|
12273 | var data1 = {
|
12274 | foo: 'bar',
|
12275 | baz: [
|
12276 | 'qux',
|
12277 | 'quux',
|
12278 | {
|
12279 | garply: { waldo: ['fred', 'plugh'] },
|
12280 | },
|
12281 | ],
|
12282 | };
|
12283 | var tests1 = [
|
12284 | ['', data1],
|
12285 | ['/foo', data1.foo],
|
12286 | ['/baz', data1.baz],
|
12287 | ['/baz/0', data1.baz[0]],
|
12288 | ['/baz/1', data1.baz[1]],
|
12289 | ['/baz/2', data1.baz[2]],
|
12290 | ['/baz/2/garply', data1.baz[2].garply],
|
12291 | [
|
12292 | '/baz/2/garply/waldo',
|
12293 | data1.baz[2].garply
|
12294 | .waldo,
|
12295 | ],
|
12296 | [
|
12297 | '/baz/2/garply/waldo/0',
|
12298 | data1.baz[2].garply
|
12299 | .waldo[0],
|
12300 | ],
|
12301 | [
|
12302 | '/baz/2/garply/waldo/1',
|
12303 | data1.baz[2].garply
|
12304 | .waldo[1],
|
12305 | ],
|
12306 | ];
|
12307 | var tests1f = [
|
12308 | ['#', data1],
|
12309 | ['#/foo', data1.foo],
|
12310 | ['#/baz', data1.baz],
|
12311 | ['#/baz/0', data1.baz[0]],
|
12312 | ['#/baz/1', data1.baz[1]],
|
12313 | ['#/baz/2', data1.baz[2]],
|
12314 | ['#/baz/2/garply', data1.baz[2].garply],
|
12315 | [
|
12316 | '#/baz/2/garply/waldo',
|
12317 | data1.baz[2].garply
|
12318 | .waldo,
|
12319 | ],
|
12320 | [
|
12321 | '#/baz/2/garply/waldo/0',
|
12322 | data1.baz[2].garply
|
12323 | .waldo[0],
|
12324 | ],
|
12325 | [
|
12326 | '#/baz/2/garply/waldo/1',
|
12327 | data1.baz[2].garply
|
12328 | .waldo[1],
|
12329 | ],
|
12330 | ];
|
12331 | describe('static .create()', function () {
|
12332 | it('throws on undefined', function () {
|
12333 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.create(undefined); }).to.throw('Invalid type: JSON Pointers are represented as strings.');
|
12334 | });
|
12335 | it('succeeds when pointer is string', function () {
|
12336 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.create('')).to.be.a('object');
|
12337 | });
|
12338 | it('succeeds when pointer is PathSegment', function () {
|
12339 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.create([])).to.be.a('object');
|
12340 | });
|
12341 | });
|
12342 | describe('.ctor()', function () {
|
12343 | it('throws on undefined', function () {
|
12344 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(undefined); }).to.throw('Invalid type: JSON Pointers are represented as strings.');
|
12345 | });
|
12346 | it('succeeds when pointer is string', function () {
|
12347 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('')).to.be.a('object');
|
12348 | });
|
12349 | it('succeeds when pointer is PathSegment', function () {
|
12350 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer([])).to.be.a('object');
|
12351 | });
|
12352 | });
|
12353 | describe('static .has()', function () {
|
12354 | var _loop_1 = function (p, expected) {
|
12355 | it("static .has(data, '".concat(p, "') = ").concat(expected !== undefined), function () {
|
12356 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.has(data0, p)).to.be.eql(expected !== undefined);
|
12357 | });
|
12358 | it("static .has(data, '".concat(JSON.stringify(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p)), "') = ").concat(expected !== undefined), function () {
|
12359 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.has(data0, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be.eql(expected !== undefined);
|
12360 | });
|
12361 | it("static .has(data, p'".concat(p, "') = ").concat(expected !== undefined), function () {
|
12362 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.has(data0, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p))).to.be.eql(expected !== undefined);
|
12363 | });
|
12364 | };
|
12365 | for (var _i = 0, tests0_1 = tests0; _i < tests0_1.length; _i++) {
|
12366 | var _a = tests0_1[_i], p = _a[0], expected = _a[1];
|
12367 | _loop_1(p, expected);
|
12368 | }
|
12369 | });
|
12370 | describe('.has()', function () {
|
12371 | var _loop_2 = function (p, expected) {
|
12372 | it(".has('".concat(p, "') = ").concat(expected !== undefined), function () {
|
12373 | var ptr = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p);
|
12374 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ptr.has(data0)).to.be.eql(expected !== undefined);
|
12375 | });
|
12376 | };
|
12377 | for (var _i = 0, tests0_2 = tests0; _i < tests0_2.length; _i++) {
|
12378 | var _a = tests0_2[_i], p = _a[0], expected = _a[1];
|
12379 | _loop_2(p, expected);
|
12380 | }
|
12381 | });
|
12382 | describe('static .get()', function () {
|
12383 | var _loop_3 = function (p, expected) {
|
12384 | it("static .get(data, '".concat(p, "') = ").concat(JSON.stringify(expected)), function () {
|
12385 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(data0, p)).to.be.eql(expected);
|
12386 | });
|
12387 | it("static .get(data, '".concat(JSON.stringify(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p)), "') = ").concat(JSON.stringify(expected)), function () {
|
12388 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(data0, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be.eql(expected);
|
12389 | });
|
12390 | it("static .get(data, p'".concat(p, "') = ").concat(JSON.stringify(expected)), function () {
|
12391 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(data0, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p))).to.be.eql(expected);
|
12392 | });
|
12393 | };
|
12394 | for (var _i = 0, tests0_3 = tests0; _i < tests0_3.length; _i++) {
|
12395 | var _a = tests0_3[_i], p = _a[0], expected = _a[1];
|
12396 | _loop_3(p, expected);
|
12397 | }
|
12398 | });
|
12399 | describe('static .set() unforced', function () {
|
12400 | var dataCopy0 = JSON.parse(JSON.stringify(data0));
|
12401 | var dataCopy1 = JSON.parse(JSON.stringify(data0));
|
12402 | var dataCopy2 = JSON.parse(JSON.stringify(data0));
|
12403 | var _loop_4 = function (p, expected) {
|
12404 | var r = rand(1, 99999);
|
12405 | it("static .set(data, '".concat(p, "', ").concat(r, ")"), function () {
|
12406 | if (p === '') {
|
12407 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy0, p, r); }).to.throw('Cannot set the root object; assign it directly.');
|
12408 | return;
|
12409 | }
|
12410 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy0, p, r);
|
12411 | if (expected === undefined) {
|
12412 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy0, p)).to.be.eql(expected);
|
12413 | }
|
12414 | else {
|
12415 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy0, p)).to.be.eql(r);
|
12416 | }
|
12417 | });
|
12418 | it("static .set(data, ".concat(JSON.stringify(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p)), ", ").concat(r, ")"), function () {
|
12419 | if (p.length === 0) {
|
12420 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
12421 | return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p), r);
|
12422 | }).to.throw('Cannot set the root object; assign it directly.');
|
12423 | return;
|
12424 | }
|
12425 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p), r);
|
12426 | if (expected === undefined) {
|
12427 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be.eql(expected);
|
12428 | }
|
12429 | else {
|
12430 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be.eql(r);
|
12431 | }
|
12432 | });
|
12433 | it("static .set(data, p'".concat(p, "', ").concat(r, ")"), function () {
|
12434 | if (p === '') {
|
12435 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
12436 | return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy2, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p), r);
|
12437 | }).to.throw('Cannot set the root object; assign it directly.');
|
12438 | return;
|
12439 | }
|
12440 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(dataCopy2, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p), r);
|
12441 | if (expected === undefined) {
|
12442 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy2, p)).to.be.eql(expected);
|
12443 | }
|
12444 | else {
|
12445 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy2, p)).to.be.eql(r);
|
12446 | }
|
12447 | });
|
12448 | };
|
12449 | for (var _i = 0, _a = tests0.reverse(); _i < _a.length; _i++) {
|
12450 | var _b = _a[_i], p = _b[0], expected = _b[1];
|
12451 | _loop_4(p, expected);
|
12452 | }
|
12453 | it('throws on attempted prototype pollution', function () {
|
12454 | var subject = { my: 'subject' };
|
12455 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
12456 | return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.set(subject, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/__proto__/polluted'), "Yes! It's polluted");
|
12457 | }).to.throw('Attempted prototype pollution disallowed.');
|
12458 | });
|
12459 | });
|
12460 | describe('static .unset()', function () {
|
12461 | var dataCopy0 = JSON.parse(JSON.stringify(data0));
|
12462 | var dataCopy1 = JSON.parse(JSON.stringify(data0));
|
12463 | var dataCopy2 = JSON.parse(JSON.stringify(data0));
|
12464 | var _loop_5 = function (p) {
|
12465 | it("static .unset(data, '".concat(p, "')"), function () {
|
12466 | if (p === '') {
|
12467 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy0, p); }).to.throw('Cannot unset the root object; assign it directly.');
|
12468 | return;
|
12469 | }
|
12470 |
|
12471 | var updatedExpected = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy0, p);
|
12472 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy0, p)).to.be.eql(updatedExpected);
|
12473 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy0, p)).to.be.undefined;
|
12474 | });
|
12475 | it("static .unset(data, ".concat(JSON.stringify(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p)), ")"), function () {
|
12476 | if (p.length === 0) {
|
12477 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
12478 | return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p));
|
12479 | }).to.throw('Cannot unset the root object; assign it directly.');
|
12480 | return;
|
12481 | }
|
12482 |
|
12483 | var updatedExpected = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy1, p);
|
12484 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be.eql(updatedExpected);
|
12485 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy1, ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p))).to.be
|
12486 | .undefined;
|
12487 | });
|
12488 | it("static .unset(data, p'".concat(p, "')"), function () {
|
12489 | if (p === '') {
|
12490 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
12491 | return ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy2, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p));
|
12492 | }).to.throw('Cannot unset the root object; assign it directly.');
|
12493 | return;
|
12494 | }
|
12495 |
|
12496 | var updatedExpected = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy2, p);
|
12497 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.unset(dataCopy2, new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer(p))).to.be.eql(updatedExpected);
|
12498 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.get(dataCopy2, p)).to.be.undefined;
|
12499 | });
|
12500 | };
|
12501 | for (var _i = 0, _a = tests0.reverse(); _i < _a.length; _i++) {
|
12502 | var p = _a[_i][0];
|
12503 | _loop_5(p);
|
12504 | }
|
12505 | });
|
12506 | describe('static .visit()', function () {
|
12507 | it("static .visit(data)", function () {
|
12508 | var sequence = [];
|
12509 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.visit(data1, function (p, v) {
|
12510 | var path = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p);
|
12511 | if (path.length) {
|
12512 | sequence.push(path[path.length - 1]);
|
12513 | if (typeof v === 'string') {
|
12514 | sequence.push(v);
|
12515 | }
|
12516 | }
|
12517 | });
|
12518 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(sequence).to.eql([
|
12519 | 'foo',
|
12520 | 'bar',
|
12521 | 'baz',
|
12522 | '0',
|
12523 | 'qux',
|
12524 | '1',
|
12525 | 'quux',
|
12526 | '2',
|
12527 | 'garply',
|
12528 | 'waldo',
|
12529 | '0',
|
12530 | 'fred',
|
12531 | '1',
|
12532 | 'plugh',
|
12533 | ]);
|
12534 | });
|
12535 | it("static .visit(data) fragments", function () {
|
12536 | var sequence = [];
|
12537 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.visit(data1, function (p, v) {
|
12538 | var path = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p);
|
12539 | if (path.length) {
|
12540 | sequence.push(path[path.length - 1]);
|
12541 | if (typeof v === 'string') {
|
12542 | sequence.push(v);
|
12543 | }
|
12544 | }
|
12545 | }, true);
|
12546 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(sequence).to.eql([
|
12547 | 'foo',
|
12548 | 'bar',
|
12549 | 'baz',
|
12550 | '0',
|
12551 | 'qux',
|
12552 | '1',
|
12553 | 'quux',
|
12554 | '2',
|
12555 | 'garply',
|
12556 | 'waldo',
|
12557 | '0',
|
12558 | 'fred',
|
12559 | '1',
|
12560 | 'plugh',
|
12561 | ]);
|
12562 | });
|
12563 | var obj = { my: { obj: 'with nested data' } };
|
12564 | var objWithReferences = {
|
12565 | your: { obj: { refers_to: obj } },
|
12566 | my: obj,
|
12567 | };
|
12568 | objWithReferences.self = {
|
12569 | nested: [objWithReferences, obj],
|
12570 | };
|
12571 | it('handles references', function () {
|
12572 | var pointers = {};
|
12573 | ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.visit(objWithReferences, function (p, v) {
|
12574 | pointers[p] = v;
|
12575 | });
|
12576 | console.log((0,util__WEBPACK_IMPORTED_MODULE_1__.inspect)(pointers, false, 9));
|
12577 | });
|
12578 | });
|
12579 | describe('static .flatten()', function () {
|
12580 | var data = {
|
12581 | foo: 'bar',
|
12582 | baz: [
|
12583 | 'qux',
|
12584 | 'quux',
|
12585 | {
|
12586 | garply: { waldo: ['fred', 'plugh'] },
|
12587 | },
|
12588 | ],
|
12589 | };
|
12590 | var obj = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.flatten(data);
|
12591 | var objf = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.flatten(data, true);
|
12592 | it('obj to # of items', function () {
|
12593 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(Object.keys(obj).length).to.eql(tests1.length);
|
12594 | });
|
12595 | var _loop_6 = function (p, expected) {
|
12596 | it("obj['".concat(p, "'] === ").concat(JSON.stringify(expected)), function () {
|
12597 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(obj[p]).to.eql(expected);
|
12598 | });
|
12599 | };
|
12600 | for (var _i = 0, tests1_1 = tests1; _i < tests1_1.length; _i++) {
|
12601 | var _a = tests1_1[_i], p = _a[0], expected = _a[1];
|
12602 | _loop_6(p, expected);
|
12603 | }
|
12604 | var _loop_7 = function (p, expected) {
|
12605 | it("obj['".concat(p, "'] === ").concat(JSON.stringify(expected)), function () {
|
12606 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(objf[p]).to.eql(expected);
|
12607 | });
|
12608 | };
|
12609 | for (var _b = 0, tests1f_1 = tests1f; _b < tests1f_1.length; _b++) {
|
12610 | var _c = tests1f_1[_b], p = _c[0], expected = _c[1];
|
12611 | _loop_7(p, expected);
|
12612 | }
|
12613 | });
|
12614 | describe('static .map()', function () {
|
12615 | var data = {
|
12616 | foo: 'bar',
|
12617 | baz: [
|
12618 | 'qux',
|
12619 | 'quux',
|
12620 | {
|
12621 | garply: { waldo: ['fred', 'plugh'] },
|
12622 | },
|
12623 | ],
|
12624 | };
|
12625 | var map = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.map(data);
|
12626 | var mapf = ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.map(data, true);
|
12627 | it('map to # of items', function () {
|
12628 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(Array.from(map.keys()).length).to.eql(tests1.length);
|
12629 | });
|
12630 | var _loop_8 = function (p, expected) {
|
12631 | it("map.get('".concat(p, "') === ").concat(JSON.stringify(expected)), function () {
|
12632 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(map.get(p)).to.eql(expected);
|
12633 | });
|
12634 | };
|
12635 | for (var _i = 0, tests1_2 = tests1; _i < tests1_2.length; _i++) {
|
12636 | var _a = tests1_2[_i], p = _a[0], expected = _a[1];
|
12637 | _loop_8(p, expected);
|
12638 | }
|
12639 | var _loop_9 = function (p, expected) {
|
12640 | it("map.get('".concat(p, "') === ").concat(JSON.stringify(expected)), function () {
|
12641 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(mapf.get(p)).to.eql(expected);
|
12642 | });
|
12643 | };
|
12644 | for (var _b = 0, tests1f_2 = tests1f; _b < tests1f_2.length; _b++) {
|
12645 | var _c = tests1f_2[_b], p = _c[0], expected = _c[1];
|
12646 | _loop_9(p, expected);
|
12647 | }
|
12648 | });
|
12649 | describe('static .decode()', function () {
|
12650 | var tests = [
|
12651 | ['', []],
|
12652 | ['/foo', ['foo']],
|
12653 | ['/foo/0', ['foo', '0']],
|
12654 | ['/', ['']],
|
12655 | ['/a~1b', ['a/b']],
|
12656 | ['/c%d', ['c%d']],
|
12657 | ['/e^f', ['e^f']],
|
12658 | ['/g|h', ['g|h']],
|
12659 | ['/i\\j', ['i\\j']],
|
12660 | ['/k"l', ['k"l']],
|
12661 | ['/ ', [' ']],
|
12662 | ['/m~0n', ['m~n']],
|
12663 | ['/foo/bar/baz', ['foo', 'bar', 'baz']],
|
12664 | ['#/foo/bar/baz', ['foo', 'bar', 'baz']],
|
12665 | ];
|
12666 | var _loop_10 = function (p, expected) {
|
12667 | it(".decode('".concat(p, "') = ").concat(JSON.stringify(expected)), function () {
|
12668 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_2__.JsonPointer.decode(p)).to.be.eql(expected);
|
12669 | });
|
12670 | };
|
12671 | for (var _i = 0, tests_1 = tests; _i < tests_1.length; _i++) {
|
12672 | var _a = tests_1[_i], p = _a[0], expected = _a[1];
|
12673 | _loop_10(p, expected);
|
12674 | }
|
12675 | });
|
12676 | describe('.pointer property', function () {
|
12677 | it('encodes pointer', function () {
|
12678 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/foo');
|
12679 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.pointer).to.eql('/foo');
|
12680 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.pointer).to.eql(p.pointer);
|
12681 | });
|
12682 | it('encodes fragment', function () {
|
12683 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('#/foo');
|
12684 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.pointer).to.eql('/foo');
|
12685 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.pointer).to.eql(p.pointer);
|
12686 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.uriFragmentIdentifier).to.eql('#/foo');
|
12687 | });
|
12688 | });
|
12689 | describe('.relative method', function () {
|
12690 | var doc = {
|
12691 | foo: ['bar', 'baz'],
|
12692 | highly: {
|
12693 | nested: {
|
12694 | objects: true,
|
12695 | },
|
12696 | },
|
12697 | };
|
12698 | it('throws when relative pointer unspecified', function () {
|
12699 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12700 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.rel(doc, undefined); }).to.throw('Invalid type: Relative JSON Pointers are represented as strings.');
|
12701 | });
|
12702 | it('throws when relative pointer empty', function () {
|
12703 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12704 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.rel(doc, ''); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12705 | });
|
12706 | it('throws when relative pointer invalid [0](NaN)', function () {
|
12707 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12708 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.rel(doc, 'b/z'); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12709 | });
|
12710 | it('throws when relative pointer invalid 1#/z', function () {
|
12711 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12712 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.rel(doc, '1#/z'); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12713 | });
|
12714 | it('Spec examples 1', function () {
|
12715 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/foo/1');
|
12716 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '0')).to.eql('baz');
|
12717 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '1/0')).to.eql('bar');
|
12718 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '2/highly/nested/objects')).to.eql(true);
|
12719 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '0#')).to.eql(1);
|
12720 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '1#')).to.eql('foo');
|
12721 | });
|
12722 | it('Spec examples 2', function () {
|
12723 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested');
|
12724 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '0/objects')).to.eql(true);
|
12725 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '1/nested/objects')).to.eql(true);
|
12726 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '2/foo/0')).to.eql('bar');
|
12727 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '0#')).to.eql('nested');
|
12728 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '1#')).to.eql('highly');
|
12729 | });
|
12730 | it('returns undefined when relative location cannot exist', function () {
|
12731 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12732 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(p.rel(doc, '5/not-here')).to.be.undefined;
|
12733 | });
|
12734 | });
|
12735 | describe('.rel method', function () {
|
12736 | var doc = {
|
12737 | foo: ['bar', 'baz'],
|
12738 | highly: {
|
12739 | nested: {
|
12740 | objects: true,
|
12741 | },
|
12742 | },
|
12743 | };
|
12744 | it('throws when relative pointer unspecified', function () {
|
12745 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12746 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative(undefined); }).to.throw('Invalid type: Relative JSON Pointers are represented as strings.');
|
12747 | });
|
12748 | it('throws when relative pointer empty', function () {
|
12749 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12750 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative(''); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12751 | });
|
12752 | it('throws when relative pointer invalid [0](NaN)', function () {
|
12753 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12754 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative('b/z'); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12755 | });
|
12756 | it('throws when relative pointer invalid 1#/z', function () {
|
12757 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12758 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative('1#/z'); }).to.throw('Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.');
|
12759 | });
|
12760 | it('throws when relative pointer to name (#)', function () {
|
12761 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12762 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative('1#'); }).to.throw("We won't compile a pointer that will always return 'nested'. Use JsonPointer.rel(target, ptr) instead.");
|
12763 | });
|
12764 | it('throws when relative location cannot exist', function () {
|
12765 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested/objects');
|
12766 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return p.relative('5/not-here'); }).to.throw('Relative location does not exist.');
|
12767 | });
|
12768 | it('Spec example from 1', function () {
|
12769 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/foo/1');
|
12770 | var q = p.relative('2/highly/nested/objects');
|
12771 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(q.get(doc)).to.eql(true);
|
12772 | });
|
12773 | it('Spec example from 2', function () {
|
12774 | var p = new ___WEBPACK_IMPORTED_MODULE_2__.JsonPointer('/highly/nested');
|
12775 | var q = p.relative('2/foo/0');
|
12776 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(q.get(doc)).to.eql('bar');
|
12777 | });
|
12778 | });
|
12779 | });
|
12780 |
|
12781 |
|
12782 | }),
|
12783 |
|
12784 | "./src/__tests__/ptr.spec.ts":
|
12785 |
|
12786 |
|
12787 |
|
12788 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12789 |
|
12790 | "use strict";
|
12791 | __webpack_require__.r(__webpack_exports__);
|
12792 | var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/index.ts");
|
12793 | var chai__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./node_modules/chai/index.mjs");
|
12794 |
|
12795 |
|
12796 |
|
12797 |
|
12798 |
|
12799 |
|
12800 | var create = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.create;
|
12801 | describe('JsonPointer', function () {
|
12802 | describe('when working with the example data from the rfc', function () {
|
12803 | var data = {
|
12804 | foo: ['bar', 'baz'],
|
12805 | '': 0,
|
12806 | 'a/b': 1,
|
12807 | 'c%d': 2,
|
12808 | 'e^f': 3,
|
12809 | 'g|h': 4,
|
12810 | 'i\\j': 5,
|
12811 | 'k"l': 6,
|
12812 | ' ': 7,
|
12813 | 'm~n': 8,
|
12814 | };
|
12815 | describe('with a JSON pointer to the root ``', function () {
|
12816 | var p = create('');
|
12817 | it('#get should resolve to the object itself', function () {
|
12818 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data);
|
12819 | });
|
12820 | it('#set should throw', function () {
|
12821 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(function () {
|
12822 | p.set(data, {
|
12823 | this: 'should cause an exception',
|
12824 | });
|
12825 | }).to.throw();
|
12826 | });
|
12827 | it('#unset should throw', function () {
|
12828 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(function () {
|
12829 | p.unset(data);
|
12830 | }).to.throw('Cannot unset the root object; assign it directly.');
|
12831 | });
|
12832 | it('should have an empty path', function () {
|
12833 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.have.length(0);
|
12834 | });
|
12835 | it('should have a pointer that is empty', function () {
|
12836 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('');
|
12837 | });
|
12838 | it('should have a URI fragment identifier that is empty', function () {
|
12839 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#');
|
12840 | });
|
12841 | });
|
12842 | describe('a URI fragment identifier to the root #', function () {
|
12843 | var p = create('#');
|
12844 | it('#get should resolve to the object itself', function () {
|
12845 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data);
|
12846 | });
|
12847 | it('#set should throw', function () {
|
12848 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(function () {
|
12849 | p.set(data, {
|
12850 | this: 'should cause an exception',
|
12851 | });
|
12852 | }).to.throw();
|
12853 | });
|
12854 | it('should have an empty path', function () {
|
12855 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.have.length(0);
|
12856 | });
|
12857 | it('should have a pointer that is empty', function () {
|
12858 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('');
|
12859 | });
|
12860 | it('should have a URI fragment identifier that is empty', function () {
|
12861 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#');
|
12862 | });
|
12863 | });
|
12864 | describe('with a JSON pointer of `/foo`', function () {
|
12865 | var p = create('/foo');
|
12866 | it('#get should resolve to data["foo"]', function () {
|
12867 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data.foo);
|
12868 | });
|
12869 | it('#set should succeed changing the referenced value', function () {
|
12870 | var capture = p.get(data);
|
12871 | var updated = {
|
12872 | this: 'should succeed',
|
12873 | };
|
12874 | p.set(data, updated);
|
12875 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
12876 | p.set(data, capture);
|
12877 | });
|
12878 | it('should have a path of [ "foo" ]', function () {
|
12879 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['foo']);
|
12880 | });
|
12881 | it('should have the pointer `/foo`', function () {
|
12882 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/foo');
|
12883 | });
|
12884 | it('should have the URI fragment identifier `#/foo`', function () {
|
12885 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/foo');
|
12886 | });
|
12887 | });
|
12888 | describe('a URI fragment identifier of `#/foo`', function () {
|
12889 | var p = create('#/foo');
|
12890 | it('#get should resolve to data["foo"]', function () {
|
12891 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data.foo);
|
12892 | });
|
12893 | it('#set should succeed changing the referenced value', function () {
|
12894 | var capture = p.get(data);
|
12895 | var updated = {
|
12896 | this: 'should succeed',
|
12897 | };
|
12898 | p.set(data, updated);
|
12899 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
12900 | p.set(data, capture);
|
12901 | });
|
12902 | it('should have a path of [ "foo" ]', function () {
|
12903 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['foo']);
|
12904 | });
|
12905 | it('should have the pointer `/foo`', function () {
|
12906 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/foo');
|
12907 | });
|
12908 | it('should have the URI fragment identifier `#/foo`', function () {
|
12909 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/foo');
|
12910 | });
|
12911 | });
|
12912 | describe('with a JSON pointer of `/foo/0`', function () {
|
12913 | var p = create('/foo/0');
|
12914 | it('#get should resolve to data.foo[0]', function () {
|
12915 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data.foo[0]);
|
12916 | });
|
12917 | it('#set should succeed changing the referenced value', function () {
|
12918 | var capture = p.get(data);
|
12919 | var updated = {
|
12920 | this: 'should succeed',
|
12921 | };
|
12922 | p.set(data, updated);
|
12923 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
12924 | p.set(data, capture);
|
12925 | });
|
12926 | it('should have a path of [ "foo", "0" ]', function () {
|
12927 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['foo', '0']);
|
12928 | });
|
12929 | it('should have the pointer `/foo/0`', function () {
|
12930 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/foo/0');
|
12931 | });
|
12932 | it('should have the URI fragment identifier `#/foo/0`', function () {
|
12933 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/foo/0');
|
12934 | });
|
12935 | });
|
12936 | describe('a URI fragment identifier of `#/foo/0`', function () {
|
12937 | var p = create('#/foo/0');
|
12938 | it('#get should resolve to data.foo[0]', function () {
|
12939 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data.foo[0]);
|
12940 | });
|
12941 | it('#set should succeed changing the referenced value', function () {
|
12942 | var capture = p.get(data);
|
12943 | var updated = {
|
12944 | this: 'should succeed',
|
12945 | };
|
12946 | p.set(data, updated);
|
12947 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
12948 | p.set(data, capture);
|
12949 | });
|
12950 | it('should have a path of [ "foo", "0" ]', function () {
|
12951 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['foo', '0']);
|
12952 | });
|
12953 | it('should have the pointer `/foo/0`', function () {
|
12954 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/foo/0');
|
12955 | });
|
12956 | it('should have the URI fragment identifier `#/foo/0`', function () {
|
12957 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/foo/0');
|
12958 | });
|
12959 | });
|
12960 | describe('a URI fragment identifier of `#/newArray/0`', function () {
|
12961 | var p = create('#/newArray/0');
|
12962 | it('#get should resolve to undefined', function () {
|
12963 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(undefined);
|
12964 | });
|
12965 | it('#set with force should succeed creating an array and setting the referenced value', function () {
|
12966 | var blank = {};
|
12967 | var capture = p.get(data);
|
12968 | var updated = {
|
12969 | this: 'should succeed',
|
12970 | };
|
12971 | p.set(blank, updated, true);
|
12972 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(Array.isArray(blank.newArray)).to.eql(true);
|
12973 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(blank)).to.eql(updated);
|
12974 | p.set(blank, capture);
|
12975 | });
|
12976 | it('should have a path of [ "newArray", "0" ]', function () {
|
12977 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['newArray', '0']);
|
12978 | });
|
12979 | it('should have the pointer `/newArray/0`', function () {
|
12980 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/newArray/0');
|
12981 | });
|
12982 | it('should have the URI fragment identifier `#/newArray/0`', function () {
|
12983 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/newArray/0');
|
12984 | });
|
12985 | });
|
12986 | describe('with a JSON pointer of `/`', function () {
|
12987 | var p = create('/');
|
12988 | it('#get should resolve to data[""]', function () {
|
12989 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['']);
|
12990 | });
|
12991 | it('#set should succeed changing the referenced value', function () {
|
12992 | var capture = p.get(data);
|
12993 | var updated = {
|
12994 | this: 'should succeed',
|
12995 | };
|
12996 | p.set(data, updated);
|
12997 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
12998 | p.set(data, capture);
|
12999 | });
|
13000 | it('should have a path of [ "" ]', function () {
|
13001 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['']);
|
13002 | });
|
13003 | it('should have the pointer `/`', function () {
|
13004 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/');
|
13005 | });
|
13006 | it('should have the URI fragment identifier `#/`', function () {
|
13007 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/');
|
13008 | });
|
13009 | });
|
13010 | describe('a URI fragment identifier of `#/`', function () {
|
13011 | var p = create('#/');
|
13012 | it('#get should resolve to data[""]', function () {
|
13013 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['']);
|
13014 | });
|
13015 | it('#set should succeed changing the referenced value', function () {
|
13016 | var capture = p.get(data);
|
13017 | var updated = {
|
13018 | this: 'should succeed',
|
13019 | };
|
13020 | p.set(data, updated);
|
13021 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13022 | p.set(data, capture);
|
13023 | });
|
13024 | it('should have a path of [ "" ]', function () {
|
13025 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['']);
|
13026 | });
|
13027 | it('should have the pointer `/`', function () {
|
13028 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/');
|
13029 | });
|
13030 | it('should have the URI fragment identifier `#/`', function () {
|
13031 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/');
|
13032 | });
|
13033 | });
|
13034 | describe('with a JSON pointer of `/a~1b`', function () {
|
13035 | var p = create('/a~1b');
|
13036 | it('#get should resolve to data["a/b"]', function () {
|
13037 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['a/b']);
|
13038 | });
|
13039 | it('#set should succeed changing the referenced value', function () {
|
13040 | var capture = p.get(data);
|
13041 | var updated = {
|
13042 | this: 'should succeed',
|
13043 | };
|
13044 | p.set(data, updated);
|
13045 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13046 | p.set(data, capture);
|
13047 | });
|
13048 | it('should have a path of [ "a/b" ]', function () {
|
13049 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['a/b']);
|
13050 | });
|
13051 | it('should have the pointer `/a~1b`', function () {
|
13052 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/a~1b');
|
13053 | });
|
13054 | it('should have the URI fragment identifier `#/a~1b`', function () {
|
13055 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/a~1b');
|
13056 | });
|
13057 | });
|
13058 | describe('a URI fragment identifier of `#/a~1b`', function () {
|
13059 | var p = create('#/a~1b');
|
13060 | it('#get should resolve to data["a/b"]', function () {
|
13061 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['a/b']);
|
13062 | });
|
13063 | it('#set should succeed changing the referenced value', function () {
|
13064 | var capture = p.get(data);
|
13065 | var updated = {
|
13066 | this: 'should succeed',
|
13067 | };
|
13068 | p.set(data, updated);
|
13069 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13070 | p.set(data, capture);
|
13071 | });
|
13072 | it('should have a path of [ "a/b" ]', function () {
|
13073 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['a/b']);
|
13074 | });
|
13075 | it('should have the pointer `/a~1b`', function () {
|
13076 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/a~1b');
|
13077 | });
|
13078 | it('should have the URI fragment identifier `#/a~1b`', function () {
|
13079 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/a~1b');
|
13080 | });
|
13081 | });
|
13082 | describe('with a JSON pointer of `/c%d`', function () {
|
13083 | var p = create('/c%d');
|
13084 | it('#get should resolve to data["c%d"]', function () {
|
13085 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['c%d']);
|
13086 | });
|
13087 | it('#set should succeed changing the referenced value', function () {
|
13088 | var capture = p.get(data);
|
13089 | var updated = {
|
13090 | this: 'should succeed',
|
13091 | };
|
13092 | p.set(data, updated);
|
13093 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13094 | p.set(data, capture);
|
13095 | });
|
13096 | it('should have a path of [ "c%d" ]', function () {
|
13097 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['c%d']);
|
13098 | });
|
13099 | it('should have the pointer `/c%d`', function () {
|
13100 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/c%d');
|
13101 | });
|
13102 | it('should have the URI fragment identifier `#/c%25d`', function () {
|
13103 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/c%25d');
|
13104 | });
|
13105 | });
|
13106 | describe('a URI fragment identifier of `#/c%25d`', function () {
|
13107 | var p = create('#/c%25d');
|
13108 | it('#get should resolve to data["c%d"]', function () {
|
13109 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['c%d']);
|
13110 | });
|
13111 | it('#set should succeed changing the referenced value', function () {
|
13112 | var capture = p.get(data);
|
13113 | var updated = {
|
13114 | this: 'should succeed',
|
13115 | };
|
13116 | p.set(data, updated);
|
13117 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13118 | p.set(data, capture);
|
13119 | });
|
13120 | it('should have a path of [ "c%d" ]', function () {
|
13121 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['c%d']);
|
13122 | });
|
13123 | it('should have the pointer `/c%d`', function () {
|
13124 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/c%d');
|
13125 | });
|
13126 | it('should have the URI fragment identifier `#/c%25d`', function () {
|
13127 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/c%25d');
|
13128 | });
|
13129 | });
|
13130 | describe('with a JSON pointer of `/e^f`', function () {
|
13131 | var p = create('/e^f');
|
13132 | it('#get should resolve to data["e^f"]', function () {
|
13133 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['e^f']);
|
13134 | });
|
13135 | it('#set should succeed changing the referenced value', function () {
|
13136 | var capture = p.get(data);
|
13137 | var updated = {
|
13138 | this: 'should succeed',
|
13139 | };
|
13140 | p.set(data, updated);
|
13141 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13142 | p.set(data, capture);
|
13143 | });
|
13144 | it('should have a path of [ "e^f" ]', function () {
|
13145 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['e^f']);
|
13146 | });
|
13147 | it('should have the pointer `/e^f`', function () {
|
13148 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/e^f');
|
13149 | });
|
13150 | it('should have the URI fragment identifier `#/e%5Ef`', function () {
|
13151 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/e%5Ef');
|
13152 | });
|
13153 | });
|
13154 | describe('a URI fragment identifier of `#/e%5Ef`', function () {
|
13155 | var p = create('#/e%5Ef');
|
13156 | it('#get should resolve to data["e^f"]', function () {
|
13157 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['e^f']);
|
13158 | });
|
13159 | it('#set should succeed changing the referenced value', function () {
|
13160 | var capture = p.get(data);
|
13161 | var updated = {
|
13162 | this: 'should succeed',
|
13163 | };
|
13164 | p.set(data, updated);
|
13165 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13166 | p.set(data, capture);
|
13167 | });
|
13168 | it('should have a path of [ "e^f" ]', function () {
|
13169 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['e^f']);
|
13170 | });
|
13171 | it('should have the pointer `/e^f`', function () {
|
13172 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/e^f');
|
13173 | });
|
13174 | it('should have the URI fragment identifier `#/e%5Ef`', function () {
|
13175 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/e%5Ef');
|
13176 | });
|
13177 | });
|
13178 | describe('with a JSON pointer of `/g|h`', function () {
|
13179 | var p = create('/g|h');
|
13180 | it('#get should resolve to data["g|h"]', function () {
|
13181 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['g|h']);
|
13182 | });
|
13183 | it('#set should succeed changing the referenced value', function () {
|
13184 | var capture = p.get(data);
|
13185 | var updated = {
|
13186 | this: 'should succeed',
|
13187 | };
|
13188 | p.set(data, updated);
|
13189 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13190 | p.set(data, capture);
|
13191 | });
|
13192 | it('should have a path of [ "g|h" ]', function () {
|
13193 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['g|h']);
|
13194 | });
|
13195 | it('should have the pointer `/g|h`', function () {
|
13196 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/g|h');
|
13197 | });
|
13198 | it('should have the URI fragment identifier `#/g%7Ch`', function () {
|
13199 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/g%7Ch');
|
13200 | });
|
13201 | });
|
13202 | describe('a URI fragment identifier of `#/g%7Ch`', function () {
|
13203 | var p = create('#/g%7Ch');
|
13204 | it('#get should resolve to data["g|h"]', function () {
|
13205 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['g|h']);
|
13206 | });
|
13207 | it('#set should succeed changing the referenced value', function () {
|
13208 | var capture = p.get(data);
|
13209 | var updated = {
|
13210 | this: 'should succeed',
|
13211 | };
|
13212 | p.set(data, updated);
|
13213 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13214 | p.set(data, capture);
|
13215 | });
|
13216 | it('should have a path of [ "g|h" ]', function () {
|
13217 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['g|h']);
|
13218 | });
|
13219 | it('should have the pointer `/g|h`', function () {
|
13220 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/g|h');
|
13221 | });
|
13222 | it('should have the URI fragment identifier `#/g%7Ch`', function () {
|
13223 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/g%7Ch');
|
13224 | });
|
13225 | });
|
13226 | describe('with a JSON pointer of "/i\\j"', function () {
|
13227 | var p = create('/i\\j');
|
13228 | it('#get should resolve to data["i\\j"]', function () {
|
13229 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['i\\j']);
|
13230 | });
|
13231 | it('#set should succeed changing the referenced value', function () {
|
13232 | var capture = p.get(data);
|
13233 | var updated = {
|
13234 | this: 'should succeed',
|
13235 | };
|
13236 | p.set(data, updated);
|
13237 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13238 | p.set(data, capture);
|
13239 | });
|
13240 | it('should have a path of [ "i\\j" ]', function () {
|
13241 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['i\\j']);
|
13242 | });
|
13243 | it('should have the pointer `/i\\j`', function () {
|
13244 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/i\\j');
|
13245 | });
|
13246 | it('should have the URI fragment identifier `#/i%5Cj`', function () {
|
13247 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/i%5Cj');
|
13248 | });
|
13249 | });
|
13250 | describe('a URI fragment identifier of `#/i%5Cj`', function () {
|
13251 | var p = create('#/i%5Cj');
|
13252 | it('#get should resolve to data["i\\j"]', function () {
|
13253 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['i\\j']);
|
13254 | });
|
13255 | it('#set should succeed changing the referenced value', function () {
|
13256 | var capture = p.get(data);
|
13257 | var updated = {
|
13258 | this: 'should succeed',
|
13259 | };
|
13260 | p.set(data, updated);
|
13261 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13262 | p.set(data, capture);
|
13263 | });
|
13264 | it('should have a path of [ "i\\j" ]', function () {
|
13265 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['i\\j']);
|
13266 | });
|
13267 | it('should have the pointer `/i\\j`', function () {
|
13268 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/i\\j');
|
13269 | });
|
13270 | it('should have the URI fragment identifier `#/i%5Cj`', function () {
|
13271 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/i%5Cj');
|
13272 | });
|
13273 | });
|
13274 | describe("with a JSON pointer of '/k\\\"l'", function () {
|
13275 |
|
13276 | var p = create('/k"l');
|
13277 |
|
13278 | it('#get should resolve to data["k"l"]', function () {
|
13279 |
|
13280 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['k"l']);
|
13281 | });
|
13282 | it('#set should succeed changing the referenced value', function () {
|
13283 | var capture = p.get(data);
|
13284 | var updated = {
|
13285 | this: 'should succeed',
|
13286 | };
|
13287 | p.set(data, updated);
|
13288 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13289 | p.set(data, capture);
|
13290 | });
|
13291 |
|
13292 | it('should have a path of [ "k"l" ]', function () {
|
13293 |
|
13294 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['k"l']);
|
13295 | });
|
13296 |
|
13297 | it('should have the pointer `/k"l`', function () {
|
13298 |
|
13299 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/k"l');
|
13300 | });
|
13301 | it('should have the URI fragment identifier `#/k%22l`', function () {
|
13302 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/k%22l');
|
13303 | });
|
13304 | });
|
13305 | describe('a URI fragment identifier of `#/k%22l`', function () {
|
13306 | var p = create('#/k%22l');
|
13307 |
|
13308 | it('#get should resolve to data["k"l"]', function () {
|
13309 |
|
13310 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['k"l']);
|
13311 | });
|
13312 | it('#set should succeed changing the referenced value', function () {
|
13313 | var capture = p.get(data);
|
13314 | var updated = {
|
13315 | this: 'should succeed',
|
13316 | };
|
13317 | p.set(data, updated);
|
13318 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13319 | p.set(data, capture);
|
13320 | });
|
13321 |
|
13322 | it('should have a path of [ "k"l" ]', function () {
|
13323 |
|
13324 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['k"l']);
|
13325 | });
|
13326 |
|
13327 | it('should have the pointer `/k"l`', function () {
|
13328 |
|
13329 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/k"l');
|
13330 | });
|
13331 | it('should have the URI fragment identifier `#/k%22l`', function () {
|
13332 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/k%22l');
|
13333 | });
|
13334 | });
|
13335 | describe('with a JSON pointer of `/ `', function () {
|
13336 | var p = create('/ ');
|
13337 | it('#get should resolve to data[" "]', function () {
|
13338 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data[' ']);
|
13339 | });
|
13340 | it('#set should succeed changing the referenced value', function () {
|
13341 | var capture = p.get(data);
|
13342 | var updated = {
|
13343 | this: 'should succeed',
|
13344 | };
|
13345 | p.set(data, updated);
|
13346 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13347 | p.set(data, capture);
|
13348 | });
|
13349 | it('should have a path of [ " " ]', function () {
|
13350 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql([' ']);
|
13351 | });
|
13352 | it('should have the pointer `/ `', function () {
|
13353 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/ ');
|
13354 | });
|
13355 | it('should have the URI fragment identifier `#/%20`', function () {
|
13356 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/%20');
|
13357 | });
|
13358 | });
|
13359 | describe('a URI fragment identifier of `#/%20`', function () {
|
13360 | var p = create('#/%20');
|
13361 | it('#get should resolve to data[" "]', function () {
|
13362 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data[' ']);
|
13363 | });
|
13364 | it('#set should succeed changing the referenced value', function () {
|
13365 | var capture = p.get(data);
|
13366 | var updated = {
|
13367 | this: 'should succeed',
|
13368 | };
|
13369 | p.set(data, updated);
|
13370 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13371 | p.set(data, capture);
|
13372 | });
|
13373 | it('should have a path of [ " " ]', function () {
|
13374 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql([' ']);
|
13375 | });
|
13376 | it('should have the pointer `/ `', function () {
|
13377 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/ ');
|
13378 | });
|
13379 | it('should have the URI fragment identifier `#/%20`', function () {
|
13380 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/%20');
|
13381 | });
|
13382 | });
|
13383 | describe('with a JSON pointer of `/m~0n`', function () {
|
13384 | var p = create('/m~0n');
|
13385 | it('#get should resolve to data["m~n"]', function () {
|
13386 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['m~n']);
|
13387 | });
|
13388 | it('#set should succeed changing the referenced value', function () {
|
13389 | var capture = p.get(data);
|
13390 | var updated = {
|
13391 | this: 'should succeed',
|
13392 | };
|
13393 | p.set(data, updated);
|
13394 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13395 | p.set(data, capture);
|
13396 | });
|
13397 | it('should have a path of [ "m~n" ]', function () {
|
13398 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['m~n']);
|
13399 | });
|
13400 | it('should have the pointer `/m~0n`', function () {
|
13401 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/m~0n');
|
13402 | });
|
13403 | it('should have the URI fragment identifier `#/m~0n`', function () {
|
13404 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/m~0n');
|
13405 | });
|
13406 | });
|
13407 | describe('a URI fragment identifier of `#/m~0n`', function () {
|
13408 | var p = create('#/m~0n');
|
13409 | it('#get should resolve to data["m~n"]', function () {
|
13410 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(data['m~n']);
|
13411 | });
|
13412 | it('#set should succeed changing the referenced value', function () {
|
13413 | var capture = p.get(data);
|
13414 | var updated = {
|
13415 | this: 'should succeed',
|
13416 | };
|
13417 | p.set(data, updated);
|
13418 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(updated);
|
13419 | p.set(data, capture);
|
13420 | });
|
13421 | it('should have a path of [ "m~n" ]', function () {
|
13422 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.path).to.eql(['m~n']);
|
13423 | });
|
13424 | it('should have the pointer `/m~0n`', function () {
|
13425 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.pointer).to.eql('/m~0n');
|
13426 | });
|
13427 | it('should have the URI fragment identifier `#/m~0n`', function () {
|
13428 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.uriFragmentIdentifier).to.eql('#/m~0n');
|
13429 | });
|
13430 | });
|
13431 | describe('a special array pointer from draft-ietf-appsawg-json-pointer-08 `/foo/-`', function () {
|
13432 | var p = create('/foo/-');
|
13433 | it('should not resolve via #get', function () {
|
13434 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.be.undefined;
|
13435 | });
|
13436 | it('should set the next element of the array, repeatedly...', function () {
|
13437 | p.set(data, 'qux');
|
13438 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(data.foo[2]).to.eql('qux');
|
13439 | });
|
13440 | it('...3', function () {
|
13441 | p.set(data, 'quux');
|
13442 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(data.foo[3]).to.eql('quux');
|
13443 | });
|
13444 | it('...4', function () {
|
13445 | p.set(data, 'corge');
|
13446 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(data.foo[4]).to.eql('corge');
|
13447 | });
|
13448 | it('...5', function () {
|
13449 | p.set(data, 'grault');
|
13450 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(data.foo[5]).to.eql('grault');
|
13451 | });
|
13452 | });
|
13453 | describe('an invalid pointer', function () {
|
13454 | it('should fail to parse', function () {
|
13455 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(function () {
|
13456 | create('a/');
|
13457 | }).to.throw();
|
13458 | });
|
13459 | });
|
13460 | describe('an invalid URI fragment identifier', function () {
|
13461 | it('should fail to parse', function () {
|
13462 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(function () {
|
13463 | create('#a');
|
13464 | }).to.throw();
|
13465 | });
|
13466 | });
|
13467 | });
|
13468 | describe('when working with complex data', function () {
|
13469 | var data = {
|
13470 | a: 1,
|
13471 | b: {
|
13472 | c: 2,
|
13473 | },
|
13474 | d: {
|
13475 | e: [
|
13476 | {
|
13477 | a: 3,
|
13478 | },
|
13479 | {
|
13480 | b: 4,
|
13481 | },
|
13482 | {
|
13483 | c: 5,
|
13484 | },
|
13485 | ],
|
13486 | },
|
13487 | f: null,
|
13488 | 'http://schema.org/name': 'Phillip',
|
13489 | };
|
13490 | it('#get should return `undefined` when the requested element is undefined (#/g/h)', function () {
|
13491 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '#/g/h');
|
13492 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.be.undefined;
|
13493 | });
|
13494 | it('#get should return null when the requested element has a null value (#/f)', function () {
|
13495 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '#/f');
|
13496 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.be.null;
|
13497 | });
|
13498 | it('#get should return the value of a prop named with multiple slahes (#/http:~1~1schema.org~1name)', function () {
|
13499 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '#/http:~1~1schema.org~1name');
|
13500 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.eql('Phillip');
|
13501 | });
|
13502 | it('#get should return the value of a prop named with multiple slahes (/http:~1~1schema.org~1name)', function () {
|
13503 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '/http:~1~1schema.org~1name');
|
13504 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.eql('Phillip');
|
13505 | });
|
13506 | it('#set should set the value of a prop named with multiple slahes (#/http:~1~1schema.org~1name)', function () {
|
13507 | ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.set(data, '#/http:~1~1schema.org~1name', 'Phil');
|
13508 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '/http:~1~1schema.org~1name');
|
13509 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.eql('Phil');
|
13510 | });
|
13511 | it('#set should set the value of a prop named with multiple slahes (/http:~1~1schema.org~1name)', function () {
|
13512 | ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.set(data, '/http:~1~1schema.org~1name', 'Phil');
|
13513 | var unk = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(data, '/http:~1~1schema.org~1name');
|
13514 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(unk).to.eql('Phil');
|
13515 | });
|
13516 | });
|
13517 | describe('given an sequence of property names ["d", "e~f", "2"]', function () {
|
13518 | var path = ['d', 'e~f', '2'];
|
13519 | it('#encodePointer should produce a pointer (/d/e~0f/2)', function () {
|
13520 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)((0,___WEBPACK_IMPORTED_MODULE_0__.encodePointer)(path)).to.eql('/d/e~0f/2');
|
13521 | });
|
13522 | it('#encodeUriFragmentIdentifier should produce a pointer (#/d/e~0f/2)', function () {
|
13523 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)((0,___WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier)(path)).to.eql('#/d/e~0f/2');
|
13524 | });
|
13525 | });
|
13526 | describe('#list...', function () {
|
13527 | var data = {
|
13528 | a: 1,
|
13529 | b: { c: 2 },
|
13530 | d: { e: [{ a: 3 }, { b: 4 }, { c: 5 }] },
|
13531 | f: null,
|
13532 | };
|
13533 | var pointerList = [
|
13534 | ['', data],
|
13535 | ['/a', data.a],
|
13536 | ['/b', data.b],
|
13537 | ['/d', data.d],
|
13538 | ['/f', data.f],
|
13539 | ['/b/c', data.b.c],
|
13540 | ['/d/e', data.d.e],
|
13541 | ['/d/e/0', data.d.e[0]],
|
13542 | ['/d/e/1', data.d.e[1]],
|
13543 | ['/d/e/2', data.d.e[2]],
|
13544 | ['/d/e/0/a', data.d.e[0].a],
|
13545 | ['/d/e/1/b', data.d.e[1].b],
|
13546 | ['/d/e/2/c', data.d.e[2].c],
|
13547 | ];
|
13548 | var fragmentList = [
|
13549 | ['#', data],
|
13550 | ['#/a', data.a],
|
13551 | ['#/b', data.b],
|
13552 | ['#/d', data.d],
|
13553 | ['#/f', data.f],
|
13554 | ['#/b/c', data.b.c],
|
13555 | ['#/d/e', data.d.e],
|
13556 | ['#/d/e/0', data.d.e[0]],
|
13557 | ['#/d/e/1', data.d.e[1]],
|
13558 | ['#/d/e/2', data.d.e[2]],
|
13559 | ['#/d/e/0/a', data.d.e[0].a],
|
13560 | ['#/d/e/1/b', data.d.e[1].b],
|
13561 | ['#/d/e/2/c', data.d.e[2].c],
|
13562 | ];
|
13563 | describe('listPointers(target)', function () {
|
13564 | var items = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.listPointers(data);
|
13565 | pointerList.forEach(function (tt, n) {
|
13566 | it("item ".concat(n, " has pointer ").concat(tt[0]), function () {
|
13567 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(items[n].pointer).to.eql(tt[0]);
|
13568 | });
|
13569 | it("item ".concat(n, " has value ").concat(tt[1]), function () {
|
13570 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(items[n].value).to.eql(tt[1]);
|
13571 | });
|
13572 | });
|
13573 | });
|
13574 | describe('listFragmentIds(target)', function () {
|
13575 | var items = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.listFragmentIds(data);
|
13576 | fragmentList.forEach(function (tt, n) {
|
13577 | it("item ".concat(n, " has fragmentId ").concat(tt[0]), function () {
|
13578 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(items[n].fragmentId).to.eql(tt[0]);
|
13579 | });
|
13580 | it("item ".concat(n, " has value ").concat(tt[1]), function () {
|
13581 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(items[n].value).to.eql(tt[1]);
|
13582 | });
|
13583 | });
|
13584 | });
|
13585 | });
|
13586 | });
|
13587 | describe('when data contains an array early in the path', function () {
|
13588 | var data = {
|
13589 | foo: [],
|
13590 | };
|
13591 | it('#set(o, val, true) should create the path through the array #/foo/0/wilbur/idiocies', function () {
|
13592 | var p = create('#/foo/0/wilbur/idiocies');
|
13593 | p.set(data, 5, true);
|
13594 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(p.get(data)).to.eql(5);
|
13595 | });
|
13596 | });
|
13597 | describe('concat pointers', function () {
|
13598 | var ptr1 = create('/a/b');
|
13599 | var ptr2 = create('/c/d');
|
13600 | var result = '/a/b/c/d';
|
13601 | it('#concat JsonPointer("/a/b") with array ["a", "b"] should produce ' +
|
13602 | result, function () {
|
13603 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(ptr1.concat(Array.from(ptr2.path)).pointer).to.eql(result);
|
13604 | });
|
13605 | it('#concat JsonPointer("/a/b") with JsonPointer("/b/c") should produce ' +
|
13606 | result, function () {
|
13607 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(ptr1.concat(ptr2).pointer).to.eql(result);
|
13608 | });
|
13609 | it('#concat JsonPointer("/a/b") with string "/b/c" should produce ' + result, function () {
|
13610 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(ptr1.concat(ptr2.pointer).pointer).to.eql(result);
|
13611 | });
|
13612 | it('#concat JsonPointer("/a/b") with string "#/b/c" should produce ' + result, function () {
|
13613 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(ptr1.concat(ptr2.uriFragmentIdentifier).toString()).to.eql(result);
|
13614 | });
|
13615 | });
|
13616 | describe('path segments containing single quote', function () {
|
13617 | it('issue 28 proof of fix', function () {
|
13618 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get({}, "/it's bad")).to.eql(undefined);
|
13619 | });
|
13620 | it('issue 30 proof of fix', function () {
|
13621 | ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get({}, "/aaa'])) !== 'undefined') {return it;}; Number.hacked = true; if(((['a");
|
13622 | var result = Number;
|
13623 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(result.hacked).to.eql(undefined);
|
13624 | });
|
13625 | });
|
13626 | describe('unreachable path across a null object in the graph', function () {
|
13627 | it('issue 36 proof of fix', function () {
|
13628 | var o = {
|
13629 | id: 1234,
|
13630 | employee: null,
|
13631 | created_on: '2021-05-11',
|
13632 | };
|
13633 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.get(o, '/employee/st_price')).to.eql(undefined);
|
13634 | });
|
13635 | });
|
13636 | describe('.set() ops, single char segment interpreted as number', function () {
|
13637 | it('issue 48 proof of fix', function () {
|
13638 | var _a;
|
13639 | var obj = {};
|
13640 | var ptr = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.create('/hi/e');
|
13641 | ptr.set(obj, 'hello', true);
|
13642 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)((_a = obj.hi) === null || _a === void 0 ? void 0 : _a.e).to.eql('hello');
|
13643 | });
|
13644 | it('issue 48 does not apply when path is an integer', function () {
|
13645 | var obj = {};
|
13646 | var ptr = ___WEBPACK_IMPORTED_MODULE_0__.JsonPointer.create('/arr/0');
|
13647 | ptr.set(obj, 'hello', true);
|
13648 | if (obj.arr) {
|
13649 | (0,chai__WEBPACK_IMPORTED_MODULE_1__.expect)(obj.arr[0]).to.eql('hello');
|
13650 | }
|
13651 | else {
|
13652 | chai__WEBPACK_IMPORTED_MODULE_1__.expect.fail('well hell, the array should have been created.');
|
13653 | }
|
13654 | });
|
13655 | });
|
13656 |
|
13657 |
|
13658 | }),
|
13659 |
|
13660 | "./src/__tests__/reference.spec.ts":
|
13661 |
|
13662 |
|
13663 |
|
13664 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13665 |
|
13666 | "use strict";
|
13667 | __webpack_require__.r(__webpack_exports__);
|
13668 | var chai__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./node_modules/chai/index.mjs");
|
13669 | var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/index.ts");
|
13670 |
|
13671 |
|
13672 |
|
13673 |
|
13674 |
|
13675 |
|
13676 | describe('JsonReference', function () {
|
13677 | describe('.ctor()', function () {
|
13678 | it('throws when pointer unspecified', function () {
|
13679 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference(undefined); }).to.throw('Invalid type: JSON Pointers are represented as strings.');
|
13680 | });
|
13681 | it('succeeds when pointer specified as string', function () {
|
13682 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference('');
|
13683 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ref.pointer().path).to.eql([]);
|
13684 | });
|
13685 | it('succeeds when pointer specified as PathSegments', function () {
|
13686 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference([]);
|
13687 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ref.pointer().path).to.eql([]);
|
13688 | });
|
13689 | it('succeeds when pointer specified as JsonPointer', function () {
|
13690 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference(new ___WEBPACK_IMPORTED_MODULE_1__.JsonPointer('/foo'));
|
13691 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ref.pointer().path).to.eql(['foo']);
|
13692 | });
|
13693 | });
|
13694 | describe('static .isReference()', function () {
|
13695 | it('returns false when reference unspecified', function () {
|
13696 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_1__.JsonReference.isReference(undefined)).to.be.false;
|
13697 | });
|
13698 | it('returns false when reference specified as null', function () {
|
13699 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_1__.JsonReference.isReference(null)).to.be.false;
|
13700 | });
|
13701 | it('returns false when reference specified is not a reference', function () {
|
13702 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_1__.JsonReference.isReference(new Date())).to.be.false;
|
13703 | });
|
13704 | it('returns true when reference specified', function () {
|
13705 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(___WEBPACK_IMPORTED_MODULE_1__.JsonReference.isReference(new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference(''))).to.be.true;
|
13706 | });
|
13707 | });
|
13708 | describe('.resolve()', function () {
|
13709 | var data = { foo: { bar: 'baz' } };
|
13710 | it('resolves to referenced property', function () {
|
13711 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference('/foo/bar');
|
13712 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ref.resolve(data)).to.eql(data.foo.bar);
|
13713 | });
|
13714 | it('resolves to undefined when no such property', function () {
|
13715 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference('/foo/baz');
|
13716 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(ref.resolve(data)).to.be.undefined;
|
13717 | });
|
13718 | });
|
13719 | describe('.toString()', function () {
|
13720 | it('is interpolated', function () {
|
13721 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference('/foo/bar');
|
13722 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)("".concat(ref)).to.eql('#/foo/bar');
|
13723 | });
|
13724 | it('is coerced', function () {
|
13725 | var ref = new ___WEBPACK_IMPORTED_MODULE_1__.JsonReference('/foo/bar');
|
13726 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)('' + ref).to.eql('#/foo/bar');
|
13727 | });
|
13728 | });
|
13729 | });
|
13730 |
|
13731 |
|
13732 | }),
|
13733 |
|
13734 | "./src/__tests__/utils.spec.ts":
|
13735 |
|
13736 |
|
13737 |
|
13738 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13739 |
|
13740 | "use strict";
|
13741 | __webpack_require__.r(__webpack_exports__);
|
13742 | var chai__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./node_modules/chai/index.mjs");
|
13743 | var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/index.ts");
|
13744 |
|
13745 |
|
13746 |
|
13747 |
|
13748 |
|
13749 |
|
13750 | describe('Utils', function () {
|
13751 | var fragments = [
|
13752 | [[], [], '#'],
|
13753 | [[''], [''], '#/'],
|
13754 | [['foo bar'], ['foo%20bar'], '#/foo%20bar'],
|
13755 | [['foo bar', 0], ['foo%20bar', 0], '#/foo%20bar/0'],
|
13756 | ];
|
13757 | var pointers = [
|
13758 | [[], [], ''],
|
13759 | [[''], [''], '/'],
|
13760 | [['foo bar'], ['foo bar'], '/foo bar'],
|
13761 | [['foo bar', 0], ['foo bar', 0], '/foo bar/0'],
|
13762 | ];
|
13763 | describe('encodeFragmentSegments()', function () {
|
13764 | var _loop_1 = function (decoded, encoded) {
|
13765 | it("".concat(JSON.stringify(decoded), " encodes to ").concat(JSON.stringify(encoded)), function () {
|
13766 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.encodeFragmentSegments)(decoded)).to.eql(encoded);
|
13767 | });
|
13768 | };
|
13769 | for (var _i = 0, fragments_1 = fragments; _i < fragments_1.length; _i++) {
|
13770 | var _a = fragments_1[_i], decoded = _a[0], encoded = _a[1];
|
13771 | _loop_1(decoded, encoded);
|
13772 | }
|
13773 | });
|
13774 | describe('decodeFragmentSegments()', function () {
|
13775 | var _loop_2 = function (decoded, encoded) {
|
13776 | it("".concat(JSON.stringify(encoded), " encodes to ").concat(JSON.stringify(decoded)), function () {
|
13777 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.decodeFragmentSegments)(encoded)).to.eql(decoded);
|
13778 | });
|
13779 | };
|
13780 | for (var _i = 0, fragments_2 = fragments; _i < fragments_2.length; _i++) {
|
13781 | var _a = fragments_2[_i], decoded = _a[0], encoded = _a[1];
|
13782 | _loop_2(decoded, encoded);
|
13783 | }
|
13784 | });
|
13785 | describe('encodePointerSegments()', function () {
|
13786 | var _loop_3 = function (decoded, encoded) {
|
13787 | it("".concat(JSON.stringify(decoded), " encodes to ").concat(JSON.stringify(encoded)), function () {
|
13788 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.encodePointerSegments)(decoded)).to.eql(encoded);
|
13789 | });
|
13790 | };
|
13791 | for (var _i = 0, pointers_1 = pointers; _i < pointers_1.length; _i++) {
|
13792 | var _a = pointers_1[_i], decoded = _a[0], encoded = _a[1];
|
13793 | _loop_3(decoded, encoded);
|
13794 | }
|
13795 | });
|
13796 | describe('decodePointerSegments()', function () {
|
13797 | var _loop_4 = function (decoded, encoded) {
|
13798 | it("".concat(JSON.stringify(encoded), " encodes to ").concat(JSON.stringify(decoded)), function () {
|
13799 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.decodePointerSegments)(encoded)).to.eql(decoded);
|
13800 | });
|
13801 | };
|
13802 | for (var _i = 0, pointers_2 = pointers; _i < pointers_2.length; _i++) {
|
13803 | var _a = pointers_2[_i], decoded = _a[0], encoded = _a[1];
|
13804 | _loop_4(decoded, encoded);
|
13805 | }
|
13806 | });
|
13807 | describe('encodePointer()', function () {
|
13808 | it('throws when segments unspecified', function () {
|
13809 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13810 | return (0,___WEBPACK_IMPORTED_MODULE_1__.encodePointer)(undefined);
|
13811 | }).to.throw('Invalid type: path must be an array of segments.');
|
13812 | });
|
13813 | it('throws when segments specified wrong type', function () {
|
13814 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return (0,___WEBPACK_IMPORTED_MODULE_1__.encodePointer)({}); }).to.throw('Invalid type: path must be an array of segments.');
|
13815 | });
|
13816 | var _loop_5 = function (encoded, p) {
|
13817 | it("".concat(JSON.stringify(encoded), " = '").concat(p, "'"), function () {
|
13818 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.encodePointer)(encoded)).to.eql(p);
|
13819 | });
|
13820 | };
|
13821 | for (var _i = 0, pointers_3 = pointers; _i < pointers_3.length; _i++) {
|
13822 | var _a = pointers_3[_i], encoded = _a[1], p = _a[2];
|
13823 | _loop_5(encoded, p);
|
13824 | }
|
13825 | });
|
13826 | describe('encodeUriFragmentIdentifier()', function () {
|
13827 | it('throws when segments unspecified', function () {
|
13828 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13829 | return (0,___WEBPACK_IMPORTED_MODULE_1__.encodeUriFragmentIdentifier)(undefined);
|
13830 | }).to.throw('Invalid type: path must be an array of segments.');
|
13831 | });
|
13832 | it('throws when segments specified wrong type', function () {
|
13833 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13834 | return (0,___WEBPACK_IMPORTED_MODULE_1__.encodeUriFragmentIdentifier)({});
|
13835 | }).to.throw('Invalid type: path must be an array of segments.');
|
13836 | });
|
13837 | var _loop_6 = function (decoded, p) {
|
13838 | it("".concat(JSON.stringify(decoded), " = '").concat(p, "'"), function () {
|
13839 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.encodeUriFragmentIdentifier)(decoded)).to.eql(p);
|
13840 | });
|
13841 | };
|
13842 | for (var _i = 0, fragments_3 = fragments; _i < fragments_3.length; _i++) {
|
13843 | var _a = fragments_3[_i], decoded = _a[0], p = _a[2];
|
13844 | _loop_6(decoded, p);
|
13845 | }
|
13846 | });
|
13847 | describe('decodeUriFragmentIdentifier()', function () {
|
13848 | it('throws when ptr unspecified', function () {
|
13849 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13850 | return (0,___WEBPACK_IMPORTED_MODULE_1__.decodeUriFragmentIdentifier)(undefined);
|
13851 | }).to.throw('Invalid type: JSON Pointers are represented as strings.');
|
13852 | });
|
13853 | it('throws when ptr specified wrong type', function () {
|
13854 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13855 | return (0,___WEBPACK_IMPORTED_MODULE_1__.decodeUriFragmentIdentifier)({});
|
13856 | }).to.throw('Invalid type: JSON Pointers are represented as strings.');
|
13857 | });
|
13858 | it('throws when invalid ptr specified', function () {
|
13859 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return (0,___WEBPACK_IMPORTED_MODULE_1__.decodeUriFragmentIdentifier)(''); }).to.throw('Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.');
|
13860 | });
|
13861 | var _loop_7 = function (decoded, p) {
|
13862 | var d = decoded.map(function (v) { return v + ''; });
|
13863 | it("'".concat(p, "' === ").concat(JSON.stringify(d)), function () {
|
13864 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.decodeUriFragmentIdentifier)(p)).to.eql(d);
|
13865 | });
|
13866 | };
|
13867 | for (var _i = 0, fragments_4 = fragments; _i < fragments_4.length; _i++) {
|
13868 | var _a = fragments_4[_i], decoded = _a[0], p = _a[2];
|
13869 | _loop_7(decoded, p);
|
13870 | }
|
13871 | });
|
13872 | describe('toArrayIndexReference()', function () {
|
13873 | it('returns idx when specified as number', function () {
|
13874 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)([], 1000)).to.eql(1000);
|
13875 | });
|
13876 | it("returns 0 when array falsy and idx === '-'", function () {
|
13877 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)(undefined, '-')).to.eql(0);
|
13878 | });
|
13879 | it("returns length when idx === '-'", function () {
|
13880 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)(['one'], '-')).to.eql(1);
|
13881 | });
|
13882 | it('returns -1 when idx NAN', function () {
|
13883 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)([], 'NaN')).to.eql(-1);
|
13884 | });
|
13885 | it('returns -1 when idx empty', function () {
|
13886 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)([], '')).to.eql(-1);
|
13887 | });
|
13888 | it('returns -1 when idx large numeric string but NaN', function () {
|
13889 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference)([], '999s9')).to.eql(-1);
|
13890 | });
|
13891 | });
|
13892 | describe('setValueAtPath()', function () {
|
13893 | it('throws when target undefined', function () {
|
13894 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return (0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)(undefined, 0, ['foo']); }).to.throw('Cannot set values on undefined');
|
13895 | });
|
13896 | var data = { one: ['two', { three: 'four' }] };
|
13897 | it('does not set at end of array if not forced', function () {
|
13898 | var expected = data.one.length;
|
13899 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)(data, 'VV', ['one', 2])).to.be.undefined;
|
13900 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(data.one.length).to.eql(expected);
|
13901 | });
|
13902 | it('will set at end of array if forced', function () {
|
13903 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)(data, 'VV', ['one', 2], true)).to.be.undefined;
|
13904 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(data.one[2]).to.eql('VV');
|
13905 | });
|
13906 | it('does not set beyond end of array if not forced', function () {
|
13907 | var expected = data.one.length;
|
13908 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)(data, 'VV', ['one', 5])).to.be.undefined;
|
13909 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(data.one.length).to.eql(expected);
|
13910 | });
|
13911 | it('will set beyond end of array if forced', function () {
|
13912 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)(data, 'VV', ['one', 5], true)).to.be.undefined;
|
13913 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(data.one[5]).to.eql('VV');
|
13914 | });
|
13915 | it('will prevent __proto__ from being polluted', function () {
|
13916 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13917 | (0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)({}, 'yes', ['__proto__', 'polluted'], true);
|
13918 | }).to.throw('Attempted prototype pollution disallowed.');
|
13919 | var prototyped = {};
|
13920 | if (!prototyped.__proto__)
|
13921 | return;
|
13922 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(prototyped.__proto__.polluted).to.not.eql('yes');
|
13923 | });
|
13924 | it('will prevent .constructor from being polluted', function () {
|
13925 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13926 | (0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)({}, 'yes', ['constructor', 'polluted'], true);
|
13927 | }).to.throw('Attempted prototype pollution disallowed.');
|
13928 | var prototyped = {};
|
13929 | if (!prototyped.constructor)
|
13930 | return;
|
13931 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(prototyped.constructor.polluted).to.not.eql('yes');
|
13932 | });
|
13933 | it('will prevent .prototype from being polluted', function () {
|
13934 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13935 | (0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)({}, 'yes', ['prototype', 'polluted'], true);
|
13936 | }).to.throw('Attempted prototype pollution disallowed.');
|
13937 | var prototyped = {};
|
13938 | if (!prototyped.prototype)
|
13939 | return;
|
13940 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(prototyped.prototype.polluted).to.not.eql('yes');
|
13941 | });
|
13942 | it('will prevent __proto__ from being polluted by javascript', function () {
|
13943 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13944 | (0,___WEBPACK_IMPORTED_MODULE_1__.setValueAtPath)({}, 'yes',
|
13945 |
|
13946 | [['__proto__'], 'polluted'], true);
|
13947 | var prototyped = {};
|
13948 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(prototyped.__proto__).to.be.undefined;
|
13949 | }).to.throw('PathSegments must be a string or a number.');
|
13950 | });
|
13951 | });
|
13952 | describe('unsetValueAtPath()', function () {
|
13953 | it('throws when target undefined', function () {
|
13954 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () { return (0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)(undefined, ['foo']); }).to.throw('Cannot unset values on undefined');
|
13955 | });
|
13956 | var data = {
|
13957 | a: ['one', { two: 'three' }, 'four', { five: { six: 'seven' } }],
|
13958 | };
|
13959 | it('can unset array elements', function () {
|
13960 | var expected = data.a[0];
|
13961 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)(data, (0,___WEBPACK_IMPORTED_MODULE_1__.decodePointer)('/a/0'))).to.eql(expected);
|
13962 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(data.a[0]).to.be.undefined;
|
13963 | });
|
13964 | it('returns undefined if reference beyond array length', function () {
|
13965 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)(data, (0,___WEBPACK_IMPORTED_MODULE_1__.decodePointer)('/a/7'))).to.undefined;
|
13966 | });
|
13967 | it('succeeds when path through array', function () {
|
13968 | var expected = data.a[3].six;
|
13969 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)((0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)(data, (0,___WEBPACK_IMPORTED_MODULE_1__.decodePointer)('/a/3/six'))).to.eql(expected);
|
13970 | });
|
13971 | it('will prevent __proto__ from being polluted', function () {
|
13972 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13973 | (0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)({}, ['__proto__', 'polluted']);
|
13974 | }).to.throw('Attempted prototype pollution disallowed.');
|
13975 | });
|
13976 | it('will prevent .constructor from being polluted', function () {
|
13977 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13978 | (0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)({}, ['constructor', 'polluted']);
|
13979 | }).to.throw('Attempted prototype pollution disallowed.');
|
13980 | });
|
13981 | it('will prevent .prototype from being polluted', function () {
|
13982 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13983 | (0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)({}, ['prototype', 'polluted']);
|
13984 | }).to.throw('Attempted prototype pollution disallowed.');
|
13985 | });
|
13986 | it('will prevent __proto__ from being polluted by javascript', function () {
|
13987 | (0,chai__WEBPACK_IMPORTED_MODULE_0__.expect)(function () {
|
13988 | (0,___WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath)({},
|
13989 |
|
13990 | [['__proto__'], 'polluted']);
|
13991 | }).to.throw('PathSegments must be a string or a number.');
|
13992 | });
|
13993 | });
|
13994 | });
|
13995 |
|
13996 |
|
13997 | }),
|
13998 |
|
13999 | "./src/index.ts":
|
14000 |
|
14001 |
|
14002 |
|
14003 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14004 |
|
14005 | "use strict";
|
14006 | __webpack_require__.r(__webpack_exports__);
|
14007 | __webpack_require__.d(__webpack_exports__, {
|
14008 | "compilePointerDereference": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.compilePointerDereference),
|
14009 | "decodeFragmentSegments": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodeFragmentSegments),
|
14010 | "decodePointer": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodePointer),
|
14011 | "decodePointerSegments": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodePointerSegments),
|
14012 | "decodePtrInit": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodePtrInit),
|
14013 | "decodeRelativePointer": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodeRelativePointer),
|
14014 | "decodeUriFragmentIdentifier": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.decodeUriFragmentIdentifier),
|
14015 | "encodeFragmentSegments": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.encodeFragmentSegments),
|
14016 | "encodePointer": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.encodePointer),
|
14017 | "encodePointerSegments": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.encodePointerSegments),
|
14018 | "encodeUriFragmentIdentifier": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.encodeUriFragmentIdentifier),
|
14019 | "looksLikeFragment": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.looksLikeFragment),
|
14020 | "pickDecoder": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.pickDecoder),
|
14021 | "replace": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.replace),
|
14022 | "setValueAtPath": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.setValueAtPath),
|
14023 | "toArrayIndexReference": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.toArrayIndexReference),
|
14024 | "unsetValueAtPath": () => ( _util__WEBPACK_IMPORTED_MODULE_1__.unsetValueAtPath),
|
14025 | "JsonPointer": () => ( _pointer__WEBPACK_IMPORTED_MODULE_2__.JsonPointer),
|
14026 | "JsonReference": () => ( _pointer__WEBPACK_IMPORTED_MODULE_2__.JsonReference)
|
14027 | });
|
14028 | var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/types.ts");
|
14029 | var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/util.ts");
|
14030 | var _pointer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./src/pointer.ts");
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 | }),
|
14040 |
|
14041 | "./src/pointer.ts":
|
14042 |
|
14043 |
|
14044 |
|
14045 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14046 |
|
14047 | "use strict";
|
14048 | __webpack_require__.r(__webpack_exports__);
|
14049 | __webpack_require__.d(__webpack_exports__, {
|
14050 | "JsonPointer": () => ( JsonPointer),
|
14051 | "JsonReference": () => ( JsonReference)
|
14052 | });
|
14053 | var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/util.ts");
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 |
|
14060 |
|
14061 |
|
14062 | function isObject(value) {
|
14063 | return typeof value === 'object' && value !== null;
|
14064 | }
|
14065 |
|
14066 | function shouldDescend(obj) {
|
14067 | return isObject(obj) && !JsonReference.isReference(obj);
|
14068 | }
|
14069 |
|
14070 | function descendingVisit(target, visitor, encoder) {
|
14071 | var distinctObjects = new Map();
|
14072 | var q = [{ obj: target, path: [] }];
|
14073 | while (q.length) {
|
14074 | var _a = q.shift(), obj = _a.obj, path = _a.path;
|
14075 | visitor(encoder(path), obj);
|
14076 | if (shouldDescend(obj)) {
|
14077 | distinctObjects.set(obj, new JsonPointer((0,_util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier)(path)));
|
14078 | if (!Array.isArray(obj)) {
|
14079 | var keys = Object.keys(obj);
|
14080 | var len = keys.length;
|
14081 | var i = -1;
|
14082 | while (++i < len) {
|
14083 | var it_1 = obj[keys[i]];
|
14084 | if (isObject(it_1) && distinctObjects.has(it_1)) {
|
14085 | q.push({
|
14086 | obj: new JsonReference(distinctObjects.get(it_1)),
|
14087 | path: path.concat(keys[i]),
|
14088 | });
|
14089 | }
|
14090 | else {
|
14091 | q.push({
|
14092 | obj: it_1,
|
14093 | path: path.concat(keys[i]),
|
14094 | });
|
14095 | }
|
14096 | }
|
14097 | }
|
14098 | else {
|
14099 |
|
14100 | var j = -1;
|
14101 | var len = obj.length;
|
14102 | while (++j < len) {
|
14103 | var it_2 = obj[j];
|
14104 | if (isObject(it_2) && distinctObjects.has(it_2)) {
|
14105 | q.push({
|
14106 | obj: new JsonReference(distinctObjects.get(it_2)),
|
14107 | path: path.concat([j + '']),
|
14108 | });
|
14109 | }
|
14110 | else {
|
14111 | q.push({
|
14112 | obj: it_2,
|
14113 | path: path.concat([j + '']),
|
14114 | });
|
14115 | }
|
14116 | }
|
14117 | }
|
14118 | }
|
14119 | }
|
14120 | }
|
14121 |
|
14122 | var $ptr = Symbol('pointer');
|
14123 |
|
14124 | var $frg = Symbol('fragmentId');
|
14125 |
|
14126 | var $get = Symbol('getter');
|
14127 | /**
|
14128 | * Represents a JSON Pointer, capable of getting and setting the value on target
|
14129 | * objects at the pointer's location.
|
14130 | *
|
14131 | * While there are static variants for most operations, our recommendation is
|
14132 | * to use the instance level methods, which enables you avoid repeated
|
14133 | * compiling/emitting transient accessors. Take a look at the speed comparisons
|
14134 | * for our justification.
|
14135 | *
|
14136 | * In most cases, you should create and reuse instances of JsonPointer within
|
14137 | * scope that makes sense for your app. We often create constants for frequently
|
14138 | * used pointers, but your use case may vary.
|
14139 | *
|
14140 | * The following is a contrived example showing a function that uses pointers to
|
14141 | * deal with changes in the structure of data (a version independent function):
|
14142 | *
|
14143 | * ```ts
|
14144 | * import { JsonPointer } from 'json-ptr';
|
14145 | *
|
14146 | * export type SupportedVersion = '1.0' | '1.1';
|
14147 | *
|
14148 | * interface PrimaryGuestNamePointers {
|
14149 | * name: JsonPointer;
|
14150 | * surname: JsonPointer;
|
14151 | * honorific: JsonPointer;
|
14152 | * }
|
14153 | * const versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {
|
14154 | * '1.0': {
|
14155 | * name: JsonPointer.create('/guests/0/name'),
|
14156 | * surname: JsonPointer.create('/guests/0/surname'),
|
14157 | * honorific: JsonPointer.create('/guests/0/honorific'),
|
14158 | * },
|
14159 | * '1.1': {
|
14160 | * name: JsonPointer.create('/primary/primaryGuest/name'),
|
14161 | * surname: JsonPointer.create('/primary/primaryGuest/surname'),
|
14162 | * honorific: JsonPointer.create('/primary/primaryGuest/honorific'),
|
14163 | * }
|
14164 | * };
|
14165 | *
|
14166 | * interface Reservation extends Record<string, unknown> {
|
14167 | * version?: SupportedVersion;
|
14168 | * }
|
14169 | *
|
14170 | * function primaryGuestName(reservation: Reservation): string {
|
14171 | * const pointers = versions[reservation.version || '1.0'];
|
14172 | * const name = pointers.name.get(reservation) as string;
|
14173 | * const surname = pointers.surname.get(reservation) as string;
|
14174 | * const honorific = pointers.honorific.get(reservation) as string;
|
14175 | * const names: string[] = [];
|
14176 | * if (honorific) names.push(honorific);
|
14177 | * if (name) names.push(name);
|
14178 | * if (surname) names.push(surname);
|
14179 | * return names.join(' ');
|
14180 | * }
|
14181 | *
|
14182 | *
|
14183 | * const reservationV1: Reservation = {
|
14184 | * guests: [{
|
14185 | * name: 'Wilbur',
|
14186 | * surname: 'Finkle',
|
14187 | * honorific: 'Mr.'
|
14188 | * }, {
|
14189 | * name: 'Wanda',
|
14190 | * surname: 'Finkle',
|
14191 | * honorific: 'Mrs.'
|
14192 | * }, {
|
14193 | * name: 'Wilma',
|
14194 | * surname: 'Finkle',
|
14195 | * honorific: 'Miss',
|
14196 | * child: true,
|
14197 | * age: 12
|
14198 | * }]
|
14199 | *
|
14200 | * };
|
14201 | *
|
14202 | *
|
14203 | * const reservationV1_1: Reservation = {
|
14204 | * version: '1.1',
|
14205 | * primary: {
|
14206 | * primaryGuest: {
|
14207 | * name: 'Wilbur',
|
14208 | * surname: 'Finkle',
|
14209 | * honorific: 'Mr.'
|
14210 | * },
|
14211 | * additionalGuests: [{
|
14212 | * name: 'Wanda',
|
14213 | * surname: 'Finkle',
|
14214 | * honorific: 'Mrs.'
|
14215 | * }, {
|
14216 | * name: 'Wilma',
|
14217 | * surname: 'Finkle',
|
14218 | * honorific: 'Miss',
|
14219 | * child: true,
|
14220 | * age: 12
|
14221 | * }]
|
14222 | *
|
14223 | * }
|
14224 | *
|
14225 | * };
|
14226 | *
|
14227 | * console.log(primaryGuestName(reservationV1));
|
14228 | * console.log(primaryGuestName(reservationV1_1));
|
14229 | *
|
14230 | * ```
|
14231 | *
|
14232 | * There are many uses for pointers.
|
14233 | */
|
14234 | var JsonPointer = /** @class */ (function () {
|
14235 | /**
|
14236 | * Creates a new instance.
|
14237 | * @param ptr a string representation of a JSON Pointer, or a decoded array of path segments.
|
14238 | */
|
14239 | function JsonPointer(ptr) {
|
14240 | this.path = (0,_util__WEBPACK_IMPORTED_MODULE_0__.decodePtrInit)(ptr);
|
14241 | }
|
14242 | /**
|
14243 | * Factory function that creates a JsonPointer instance.
|
14244 | *
|
14245 | * ```ts
|
14246 | * const ptr = JsonPointer.create('/deeply/nested/data/0/here');
|
14247 | * ```
|
14248 | * _or_
|
14249 | * ```ts
|
14250 | * const ptr = JsonPointer.create(['deeply', 'nested', 'data', 0, 'here']);
|
14251 | * ```
|
14252 | * @param pointer the pointer or path.
|
14253 | */
|
14254 | JsonPointer.create = function (pointer) {
|
14255 | return new JsonPointer(pointer);
|
14256 | };
|
14257 | /**
|
14258 | * Determines if the specified `target`'s object graph has a value at the `pointer`'s location.
|
14259 | *
|
14260 | * ```ts
|
14261 | * const target = {
|
14262 | * first: 'second',
|
14263 | * third: ['fourth', 'fifth', { sixth: 'seventh' }],
|
14264 | * eighth: 'ninth'
|
14265 | * };
|
14266 | *
|
14267 | * console.log(JsonPointer.has(target, '/third/0'));
|
14268 | *
|
14269 | * console.log(JsonPointer.has(target, '/tenth'));
|
14270 | *
|
14271 | * ```
|
14272 | *
|
14273 | * @param target the target of the operation
|
14274 | * @param pointer the pointer or path
|
14275 | */
|
14276 | JsonPointer.has = function (target, pointer) {
|
14277 | if (typeof pointer === 'string' || Array.isArray(pointer)) {
|
14278 | pointer = new JsonPointer(pointer);
|
14279 | }
|
14280 | return pointer.has(target);
|
14281 | };
|
14282 | /**
|
14283 | * Gets the `target` object's value at the `pointer`'s location.
|
14284 | *
|
14285 | * ```ts
|
14286 | * const target = {
|
14287 | * first: 'second',
|
14288 | * third: ['fourth', 'fifth', { sixth: 'seventh' }],
|
14289 | * eighth: 'ninth'
|
14290 | * };
|
14291 | *
|
14292 | * console.log(JsonPointer.get(target, '/third/2/sixth'));
|
14293 | *
|
14294 | * console.log(JsonPointer.get(target, '/tenth'));
|
14295 | *
|
14296 | * ```
|
14297 | *
|
14298 | * @param target the target of the operation
|
14299 | * @param pointer the pointer or path.
|
14300 | */
|
14301 | JsonPointer.get = function (target, pointer) {
|
14302 | if (typeof pointer === 'string' || Array.isArray(pointer)) {
|
14303 | pointer = new JsonPointer(pointer);
|
14304 | }
|
14305 | return pointer.get(target);
|
14306 | };
|
14307 | /**
|
14308 | * Sets the `target` object's value, as specified, at the `pointer`'s location.
|
14309 | *
|
14310 | * ```ts
|
14311 | * const target = {
|
14312 | * first: 'second',
|
14313 | * third: ['fourth', 'fifth', { sixth: 'seventh' }],
|
14314 | * eighth: 'ninth'
|
14315 | * };
|
14316 | *
|
14317 | * console.log(JsonPointer.set(target, '/third/2/sixth', 'tenth'));
|
14318 | *
|
14319 | * console.log(JsonPointer.set(target, '/tenth', 'eleventh', true));
|
14320 | *
|
14321 | * console.log(JSON.stringify(target, null, ' '));
|
14322 | *
|
14323 | *
|
14324 | *
|
14325 | *
|
14326 | *
|
14327 | *
|
14328 | *
|
14329 | *
|
14330 | *
|
14331 | *
|
14332 | *
|
14333 | *
|
14334 | * ```
|
14335 | *
|
14336 | * @param target the target of the operation
|
14337 | * @param pointer the pointer or path
|
14338 | * @param val a value to write into the object graph at the specified pointer location
|
14339 | * @param force indications whether the operation should force the pointer's location into existence in the object graph.
|
14340 | *
|
14341 | * @returns the prior value at the pointer's location in the object graph.
|
14342 | */
|
14343 | JsonPointer.set = function (target, pointer, val, force) {
|
14344 | if (force === void 0) { force = false; }
|
14345 | if (typeof pointer === 'string' || Array.isArray(pointer)) {
|
14346 | pointer = new JsonPointer(pointer);
|
14347 | }
|
14348 | return pointer.set(target, val, force);
|
14349 | };
|
14350 | /**
|
14351 | * Removes the `target` object's value at the `pointer`'s location.
|
14352 | *
|
14353 | * ```ts
|
14354 | * const target = {
|
14355 | * first: 'second',
|
14356 | * third: ['fourth', 'fifth', { sixth: 'seventh' }],
|
14357 | * eighth: 'ninth'
|
14358 | * };
|
14359 | *
|
14360 | * console.log(JsonPointer.unset(target, '/third/2/sixth'));
|
14361 | *
|
14362 | * console.log(JsonPointer.unset(target, '/tenth'));
|
14363 | *
|
14364 | * console.log(JSON.stringify(target, null, ' '));
|
14365 | *
|
14366 | *
|
14367 | *
|
14368 | *
|
14369 | *
|
14370 | *
|
14371 | *
|
14372 | *
|
14373 | *
|
14374 | * ```
|
14375 | * @param target the target of the operation
|
14376 | * @param pointer the pointer or path
|
14377 | *
|
14378 | * @returns the value that was removed from the object graph.
|
14379 | */
|
14380 | JsonPointer.unset = function (target, pointer) {
|
14381 | if (typeof pointer === 'string' || Array.isArray(pointer)) {
|
14382 | pointer = new JsonPointer(pointer);
|
14383 | }
|
14384 | return pointer.unset(target);
|
14385 | };
|
14386 | /**
|
14387 | * Decodes the specified pointer into path segments.
|
14388 | * @param pointer a string representation of a JSON Pointer
|
14389 | */
|
14390 | JsonPointer.decode = function (pointer) {
|
14391 | return (0,_util__WEBPACK_IMPORTED_MODULE_0__.pickDecoder)(pointer)(pointer);
|
14392 | };
|
14393 | /**
|
14394 | * Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.
|
14395 | * @param target the target of the operation
|
14396 | * @param visitor a callback function invoked for each unique pointer location in the object graph
|
14397 | * @param fragmentId indicates whether the visitor should receive fragment identifiers or regular pointers
|
14398 | */
|
14399 | JsonPointer.visit = function (target, visitor, fragmentId) {
|
14400 | if (fragmentId === void 0) { fragmentId = false; }
|
14401 | descendingVisit(target, visitor, fragmentId ? _util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier : _util__WEBPACK_IMPORTED_MODULE_0__.encodePointer);
|
14402 | };
|
14403 | /**
|
14404 | * Evaluates the target's object graph, returning a [[JsonStringPointerListItem]] for each location in the graph.
|
14405 | * @param target the target of the operation
|
14406 | */
|
14407 | JsonPointer.listPointers = function (target) {
|
14408 | var res = [];
|
14409 | descendingVisit(target, function (pointer, value) {
|
14410 | res.push({ pointer: pointer, value: value });
|
14411 | }, _util__WEBPACK_IMPORTED_MODULE_0__.encodePointer);
|
14412 | return res;
|
14413 | };
|
14414 | /**
|
14415 | * Evaluates the target's object graph, returning a [[UriFragmentIdentifierPointerListItem]] for each location in the graph.
|
14416 | * @param target the target of the operation
|
14417 | */
|
14418 | JsonPointer.listFragmentIds = function (target) {
|
14419 | var res = [];
|
14420 | descendingVisit(target, function (fragmentId, value) {
|
14421 | res.push({ fragmentId: fragmentId, value: value });
|
14422 | }, _util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier);
|
14423 | return res;
|
14424 | };
|
14425 | /**
|
14426 | * Evaluates the target's object graph, returning a Record<Pointer, unknown> populated with pointers and the corresponding values from the graph.
|
14427 | * @param target the target of the operation
|
14428 | * @param fragmentId indicates whether the results are populated with fragment identifiers rather than regular pointers
|
14429 | */
|
14430 | JsonPointer.flatten = function (target, fragmentId) {
|
14431 | if (fragmentId === void 0) { fragmentId = false; }
|
14432 | var res = {};
|
14433 | descendingVisit(target, function (p, v) {
|
14434 | res[p] = v;
|
14435 | }, fragmentId ? _util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier : _util__WEBPACK_IMPORTED_MODULE_0__.encodePointer);
|
14436 | return res;
|
14437 | };
|
14438 | /**
|
14439 | * Evaluates the target's object graph, returning a Map<Pointer,unknown> populated with pointers and the corresponding values form the graph.
|
14440 | * @param target the target of the operation
|
14441 | * @param fragmentId indicates whether the results are populated with fragment identifiers rather than regular pointers
|
14442 | */
|
14443 | JsonPointer.map = function (target, fragmentId) {
|
14444 | if (fragmentId === void 0) { fragmentId = false; }
|
14445 | var res = new Map();
|
14446 | descendingVisit(target, res.set.bind(res), fragmentId ? _util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier : _util__WEBPACK_IMPORTED_MODULE_0__.encodePointer);
|
14447 | return res;
|
14448 | };
|
14449 | /**
|
14450 | * Gets the target object's value at the pointer's location.
|
14451 | * @param target the target of the operation
|
14452 | */
|
14453 | JsonPointer.prototype.get = function (target) {
|
14454 | if (!this[$get]) {
|
14455 | this[$get] = (0,_util__WEBPACK_IMPORTED_MODULE_0__.compilePointerDereference)(this.path);
|
14456 | }
|
14457 | return this[$get](target);
|
14458 | };
|
14459 | /**
|
14460 | * Sets the target object's value, as specified, at the pointer's location.
|
14461 | *
|
14462 | * If any part of the pointer's path does not exist, the operation aborts
|
14463 | * without modification, unless the caller indicates that pointer's location
|
14464 | * should be created.
|
14465 | *
|
14466 | * @param target the target of the operation
|
14467 | * @param value the value to set
|
14468 | * @param force indicates whether the pointer's location should be created if it doesn't already exist.
|
14469 | */
|
14470 | JsonPointer.prototype.set = function (target, value, force) {
|
14471 | if (force === void 0) { force = false; }
|
14472 | return (0,_util__WEBPACK_IMPORTED_MODULE_0__.setValueAtPath)(target, value, this.path, force);
|
14473 | };
|
14474 | /**
|
14475 | * Removes the target object's value at the pointer's location.
|
14476 | * @param target the target of the operation
|
14477 | *
|
14478 | * @returns the value that was removed from the object graph.
|
14479 | */
|
14480 | JsonPointer.prototype.unset = function (target) {
|
14481 | return (0,_util__WEBPACK_IMPORTED_MODULE_0__.unsetValueAtPath)(target, this.path);
|
14482 | };
|
14483 | /**
|
14484 | * Determines if the specified target's object graph has a value at the pointer's location.
|
14485 | * @param target the target of the operation
|
14486 | */
|
14487 | JsonPointer.prototype.has = function (target) {
|
14488 | return typeof this.get(target) !== 'undefined';
|
14489 | };
|
14490 | /**
|
14491 | * Gets the value in the object graph that is the parent of the pointer location.
|
14492 | * @param target the target of the operation
|
14493 | */
|
14494 | JsonPointer.prototype.parent = function (target) {
|
14495 | var p = this.path;
|
14496 | if (p.length == 1)
|
14497 | return undefined;
|
14498 | var parent = new JsonPointer(p.slice(0, p.length - 1));
|
14499 | return parent.get(target);
|
14500 | };
|
14501 | /**
|
14502 | * Creates a new JsonPointer instance, pointing to the specified relative location in the object graph.
|
14503 | * @param ptr the relative pointer (relative to this)
|
14504 | * @returns A new instance that points to the relative location.
|
14505 | */
|
14506 | JsonPointer.prototype.relative = function (ptr) {
|
14507 | var p = this.path;
|
14508 | var decoded = (0,_util__WEBPACK_IMPORTED_MODULE_0__.decodeRelativePointer)(ptr);
|
14509 | var n = parseInt(decoded[0]);
|
14510 | if (n > p.length)
|
14511 | throw new Error('Relative location does not exist.');
|
14512 | var r = p.slice(0, p.length - n).concat(decoded.slice(1));
|
14513 | if (decoded[0][decoded[0].length - 1] == '#') {
|
14514 | // It references the path segment/name, not the value
|
14515 | var name_1 = r[r.length - 1];
|
14516 | throw new Error("We won't compile a pointer that will always return '".concat(name_1, "'. Use JsonPointer.rel(target, ptr) instead."));
|
14517 | }
|
14518 | return new JsonPointer(r);
|
14519 | };
|
14520 | /**
|
14521 | * Resolves the specified relative pointer path against the specified target object, and gets the target object's value at the relative pointer's location.
|
14522 | * @param target the target of the operation
|
14523 | * @param ptr the relative pointer (relative to this)
|
14524 | * @returns the value at the relative pointer's resolved path; otherwise undefined.
|
14525 | */
|
14526 | JsonPointer.prototype.rel = function (target, ptr) {
|
14527 | var p = this.path;
|
14528 | var decoded = (0,_util__WEBPACK_IMPORTED_MODULE_0__.decodeRelativePointer)(ptr);
|
14529 | var n = parseInt(decoded[0]);
|
14530 | if (n > p.length) {
|
14531 | // out of bounds
|
14532 | return undefined;
|
14533 | }
|
14534 | var r = p.slice(0, p.length - n).concat(decoded.slice(1));
|
14535 | var other = new JsonPointer(r);
|
14536 | if (decoded[0][decoded[0].length - 1] == '#') {
|
14537 | // It references the path segment/name, not the value
|
14538 | var name_2 = r[r.length - 1];
|
14539 | var parent_1 = other.parent(target);
|
14540 | return Array.isArray(parent_1) ? parseInt(name_2, 10) : name_2;
|
14541 | }
|
14542 | return other.get(target);
|
14543 | };
|
14544 | /**
|
14545 | * Creates a new instance by concatenating the specified pointer's path onto this pointer's path.
|
14546 | * @param ptr the string representation of a pointer, it's decoded path, or an instance of JsonPointer indicating the additional path to concatenate onto the pointer.
|
14547 | */
|
14548 | JsonPointer.prototype.concat = function (ptr) {
|
14549 | return new JsonPointer(this.path.concat(ptr instanceof JsonPointer ? ptr.path : (0,_util__WEBPACK_IMPORTED_MODULE_0__.decodePtrInit)(ptr)));
|
14550 | };
|
14551 | Object.defineProperty(JsonPointer.prototype, "pointer", {
|
14552 | /**
|
14553 | * This pointer's JSON Pointer encoded string representation.
|
14554 | */
|
14555 | get: function () {
|
14556 | if (this[$ptr] === undefined) {
|
14557 | this[$ptr] = (0,_util__WEBPACK_IMPORTED_MODULE_0__.encodePointer)(this.path);
|
14558 | }
|
14559 | return this[$ptr];
|
14560 | },
|
14561 | enumerable: false,
|
14562 | configurable: true
|
14563 | });
|
14564 | Object.defineProperty(JsonPointer.prototype, "uriFragmentIdentifier", {
|
14565 | /**
|
14566 | * This pointer's URI fragment identifier encoded string representation.
|
14567 | */
|
14568 | get: function () {
|
14569 | if (!this[$frg]) {
|
14570 | this[$frg] = (0,_util__WEBPACK_IMPORTED_MODULE_0__.encodeUriFragmentIdentifier)(this.path);
|
14571 | }
|
14572 | return this[$frg];
|
14573 | },
|
14574 | enumerable: false,
|
14575 | configurable: true
|
14576 | });
|
14577 | /**
|
14578 | * Emits the JSON Pointer encoded string representation.
|
14579 | */
|
14580 | JsonPointer.prototype.toString = function () {
|
14581 | return this.pointer;
|
14582 | };
|
14583 | return JsonPointer;
|
14584 | }());
|
14585 |
|
14586 | /** @hidden */
|
14587 | var $pointer = Symbol('pointer');
|
14588 | /**
|
14589 | * A reference to a location in an object graph.
|
14590 | *
|
14591 | * This type is used by this module to break cycles in an object graph and to
|
14592 | * reference locations that have already been visited when enumerating pointers.
|
14593 | */
|
14594 | var JsonReference = /** @class */ (function () {
|
14595 | /**
|
14596 | * Creates a new instance.
|
14597 | * @param pointer a JSON Pointer for the reference.
|
14598 | */
|
14599 | function JsonReference(pointer) {
|
14600 | this[$pointer] =
|
14601 | pointer instanceof JsonPointer ? pointer : new JsonPointer(pointer);
|
14602 | this.$ref = this[$pointer].uriFragmentIdentifier;
|
14603 | }
|
14604 | /**
|
14605 | * Determines if the specified `candidate` is a JsonReference.
|
14606 | * @param candidate the candidate
|
14607 | */
|
14608 | JsonReference.isReference = function (candidate) {
|
14609 | if (!candidate)
|
14610 | return false;
|
14611 | var ref = candidate;
|
14612 | return typeof ref.$ref === 'string' && typeof ref.resolve === 'function';
|
14613 | };
|
14614 | /**
|
14615 | * Resolves the reference against the `target` object, returning the value at
|
14616 | * the referenced pointer's location.
|
14617 | * @param target the target object
|
14618 | */
|
14619 | JsonReference.prototype.resolve = function (target) {
|
14620 | return this[$pointer].get(target);
|
14621 | };
|
14622 | /**
|
14623 | * Gets the reference's pointer.
|
14624 | */
|
14625 | JsonReference.prototype.pointer = function () {
|
14626 | return this[$pointer];
|
14627 | };
|
14628 | /**
|
14629 | * Gets the reference pointer's string representation (a URI fragment identifier).
|
14630 | */
|
14631 | JsonReference.prototype.toString = function () {
|
14632 | return this.$ref;
|
14633 | };
|
14634 | return JsonReference;
|
14635 | }());
|
14636 |
|
14637 |
|
14638 |
|
14639 | /***/ }),
|
14640 |
|
14641 | /***/ "./src/types.ts":
|
14642 | /*!**********************!*\
|
14643 | !*** ./src/types.ts ***!
|
14644 | \**********************/
|
14645 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14646 |
|
14647 | "use strict";
|
14648 | __webpack_require__.r(__webpack_exports__);
|
14649 |
|
14650 |
|
14651 |
|
14652 | /***/ }),
|
14653 |
|
14654 | /***/ "./src/util.ts":
|
14655 | /*!*********************!*\
|
14656 | !*** ./src/util.ts ***!
|
14657 | \*********************/
|
14658 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14659 |
|
14660 | "use strict";
|
14661 | __webpack_require__.r(__webpack_exports__);
|
14662 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14663 | /* harmony export */ "replace": () => (/* binding */ replace),
|
14664 | /* harmony export */ "decodeFragmentSegments": () => (/* binding */ decodeFragmentSegments),
|
14665 | /* harmony export */ "encodeFragmentSegments": () => (/* binding */ encodeFragmentSegments),
|
14666 | /* harmony export */ "decodePointerSegments": () => (/* binding */ decodePointerSegments),
|
14667 | /* harmony export */ "encodePointerSegments": () => (/* binding */ encodePointerSegments),
|
14668 | /* harmony export */ "decodePointer": () => (/* binding */ decodePointer),
|
14669 | /* harmony export */ "encodePointer": () => (/* binding */ encodePointer),
|
14670 | /* harmony export */ "decodeUriFragmentIdentifier": () => (/* binding */ decodeUriFragmentIdentifier),
|
14671 | /* harmony export */ "encodeUriFragmentIdentifier": () => (/* binding */ encodeUriFragmentIdentifier),
|
14672 | /* harmony export */ "decodeRelativePointer": () => (/* binding */ decodeRelativePointer),
|
14673 | /* harmony export */ "toArrayIndexReference": () => (/* binding */ toArrayIndexReference),
|
14674 | /* harmony export */ "compilePointerDereference": () => (/* binding */ compilePointerDereference),
|
14675 | /* harmony export */ "setValueAtPath": () => (/* binding */ setValueAtPath),
|
14676 | /* harmony export */ "unsetValueAtPath": () => (/* binding */ unsetValueAtPath),
|
14677 | /* harmony export */ "looksLikeFragment": () => (/* binding */ looksLikeFragment),
|
14678 | /* harmony export */ "pickDecoder": () => (/* binding */ pickDecoder),
|
14679 | /* harmony export */ "decodePtrInit": () => (/* binding */ decodePtrInit)
|
14680 | /* harmony export */ });
|
14681 | function replace(source, find, repl) {
|
14682 | var res = '';
|
14683 | var rem = source;
|
14684 | var beg = 0;
|
14685 | var end = -1;
|
14686 | while ((end = rem.indexOf(find)) > -1) {
|
14687 | res += source.substring(beg, beg + end) + repl;
|
14688 | rem = rem.substring(end + find.length, rem.length);
|
14689 | beg += end + find.length;
|
14690 | }
|
14691 | if (rem.length > 0) {
|
14692 | res += source.substring(source.length - rem.length, source.length);
|
14693 | }
|
14694 | return res;
|
14695 | }
|
14696 | function decodeFragmentSegments(segments) {
|
14697 | var i = -1;
|
14698 | var len = segments.length;
|
14699 | var res = new Array(len);
|
14700 | while (++i < len) {
|
14701 | if (typeof segments[i] === 'string') {
|
14702 | res[i] = replace(replace(decodeURIComponent(segments[i]), '~1', '/'), '~0', '~');
|
14703 | }
|
14704 | else {
|
14705 | res[i] = segments[i];
|
14706 | }
|
14707 | }
|
14708 | return res;
|
14709 | }
|
14710 | function encodeFragmentSegments(segments) {
|
14711 | var i = -1;
|
14712 | var len = segments.length;
|
14713 | var res = new Array(len);
|
14714 | while (++i < len) {
|
14715 | if (typeof segments[i] === 'string') {
|
14716 | res[i] = encodeURIComponent(replace(replace(segments[i], '~', '~0'), '/', '~1'));
|
14717 | }
|
14718 | else {
|
14719 | res[i] = segments[i];
|
14720 | }
|
14721 | }
|
14722 | return res;
|
14723 | }
|
14724 | function decodePointerSegments(segments) {
|
14725 | var i = -1;
|
14726 | var len = segments.length;
|
14727 | var res = new Array(len);
|
14728 | while (++i < len) {
|
14729 | if (typeof segments[i] === 'string') {
|
14730 | res[i] = replace(replace(segments[i], '~1', '/'), '~0', '~');
|
14731 | }
|
14732 | else {
|
14733 | res[i] = segments[i];
|
14734 | }
|
14735 | }
|
14736 | return res;
|
14737 | }
|
14738 | function encodePointerSegments(segments) {
|
14739 | var i = -1;
|
14740 | var len = segments.length;
|
14741 | var res = new Array(len);
|
14742 | while (++i < len) {
|
14743 | if (typeof segments[i] === 'string') {
|
14744 | res[i] = replace(replace(segments[i], '~', '~0'), '/', '~1');
|
14745 | }
|
14746 | else {
|
14747 | res[i] = segments[i];
|
14748 | }
|
14749 | }
|
14750 | return res;
|
14751 | }
|
14752 | function decodePointer(ptr) {
|
14753 | if (typeof ptr !== 'string') {
|
14754 | throw new TypeError('Invalid type: JSON Pointers are represented as strings.');
|
14755 | }
|
14756 | if (ptr.length === 0) {
|
14757 | return [];
|
14758 | }
|
14759 | if (ptr[0] !== '/') {
|
14760 | throw new ReferenceError('Invalid JSON Pointer syntax. Non-empty pointer must begin with a solidus `/`.');
|
14761 | }
|
14762 | return decodePointerSegments(ptr.substring(1).split('/'));
|
14763 | }
|
14764 | function encodePointer(path) {
|
14765 | if (!path || (path && !Array.isArray(path))) {
|
14766 | throw new TypeError('Invalid type: path must be an array of segments.');
|
14767 | }
|
14768 | if (path.length === 0) {
|
14769 | return '';
|
14770 | }
|
14771 | return '/'.concat(encodePointerSegments(path).join('/'));
|
14772 | }
|
14773 | function decodeUriFragmentIdentifier(ptr) {
|
14774 | if (typeof ptr !== 'string') {
|
14775 | throw new TypeError('Invalid type: JSON Pointers are represented as strings.');
|
14776 | }
|
14777 | if (ptr.length === 0 || ptr[0] !== '#') {
|
14778 | throw new ReferenceError('Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.');
|
14779 | }
|
14780 | if (ptr.length === 1) {
|
14781 | return [];
|
14782 | }
|
14783 | if (ptr[1] !== '/') {
|
14784 | throw new ReferenceError('Invalid JSON Pointer syntax.');
|
14785 | }
|
14786 | return decodeFragmentSegments(ptr.substring(2).split('/'));
|
14787 | }
|
14788 | function encodeUriFragmentIdentifier(path) {
|
14789 | if (!path || (path && !Array.isArray(path))) {
|
14790 | throw new TypeError('Invalid type: path must be an array of segments.');
|
14791 | }
|
14792 | if (path.length === 0) {
|
14793 | return '#';
|
14794 | }
|
14795 | return '#/'.concat(encodeFragmentSegments(path).join('/'));
|
14796 | }
|
14797 | var InvalidRelativePointerError = 'Invalid Relative JSON Pointer syntax. Relative pointer must begin with a non-negative integer, followed by either the number sign (#), or a JSON Pointer.';
|
14798 | function decodeRelativePointer(ptr) {
|
14799 | if (typeof ptr !== 'string') {
|
14800 | throw new TypeError('Invalid type: Relative JSON Pointers are represented as strings.');
|
14801 | }
|
14802 | if (ptr.length === 0) {
|
14803 | // https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html#rfc.section.3
|
14804 | throw new ReferenceError(InvalidRelativePointerError);
|
14805 | }
|
14806 | var segments = ptr.split('/');
|
14807 | var first = segments[0];
|
14808 | // It is a name reference; strip the hash.
|
14809 | if (first[first.length - 1] == '#') {
|
14810 | if (segments.length > 1) {
|
14811 | throw new ReferenceError(InvalidRelativePointerError);
|
14812 | }
|
14813 | first = first.substr(0, first.length - 1);
|
14814 | }
|
14815 | var i = -1;
|
14816 | var len = first.length;
|
14817 | while (++i < len) {
|
14818 | if (first[i] < '0' || first[i] > '9') {
|
14819 | throw new ReferenceError(InvalidRelativePointerError);
|
14820 | }
|
14821 | }
|
14822 | var path = decodePointerSegments(segments.slice(1));
|
14823 | path.unshift(segments[0]);
|
14824 | return path;
|
14825 | }
|
14826 | function toArrayIndexReference(arr, idx) {
|
14827 | if (typeof idx === 'number')
|
14828 | return idx;
|
14829 | var len = idx.length;
|
14830 | if (!len)
|
14831 | return -1;
|
14832 | var cursor = 0;
|
14833 | if (len === 1 && idx[0] === '-') {
|
14834 | if (!Array.isArray(arr)) {
|
14835 | return 0;
|
14836 | }
|
14837 | return arr.length;
|
14838 | }
|
14839 | while (++cursor < len) {
|
14840 | if (idx[cursor] < '0' || idx[cursor] > '9') {
|
14841 | return -1;
|
14842 | }
|
14843 | }
|
14844 | return parseInt(idx, 10);
|
14845 | }
|
14846 | function compilePointerDereference(path) {
|
14847 | var body = "if (typeof(it) !== 'undefined'";
|
14848 | if (path.length === 0) {
|
14849 | return function (it) { return it; };
|
14850 | }
|
14851 | body = path.reduce(function (body, _, i) {
|
14852 | return (body +
|
14853 | "\n\t&& it !== null && typeof((it = it['" +
|
14854 | replace(replace(path[i] + '', '\\', '\\\\'), "'", "\\'") +
|
14855 | "'])) !== 'undefined'");
|
14856 | }, "if (typeof(it) !== 'undefined'");
|
14857 | body = body + ') {\n\treturn it;\n }';
|
14858 | // eslint-disable-next-line no-new-func
|
14859 | return new Function('it', body);
|
14860 | }
|
14861 | function setValueAtPath(target, val, path, force) {
|
14862 | if (force === void 0) { force = false; }
|
14863 | if (path.length === 0) {
|
14864 | throw new Error('Cannot set the root object; assign it directly.');
|
14865 | }
|
14866 | if (typeof target === 'undefined') {
|
14867 | throw new TypeError('Cannot set values on undefined');
|
14868 | }
|
14869 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14870 | var it = target;
|
14871 | var len = path.length;
|
14872 | var end = path.length - 1;
|
14873 | var step;
|
14874 | var cursor = -1;
|
14875 | var rem;
|
14876 | var p;
|
14877 | while (++cursor < len) {
|
14878 | step = path[cursor];
|
14879 | if (typeof step !== 'string' && typeof step !== 'number') {
|
14880 | throw new TypeError('PathSegments must be a string or a number.');
|
14881 | }
|
14882 | if (
|
14883 | // Reconsider this strategy. It disallows legitimate structures on
|
14884 | // non - objects, or more precisely, on objects not derived from a class
|
14885 | // or constructor function.
|
14886 | step === '__proto__' ||
|
14887 | step === 'constructor' ||
|
14888 | step === 'prototype') {
|
14889 | throw new Error('Attempted prototype pollution disallowed.');
|
14890 | }
|
14891 | if (Array.isArray(it)) {
|
14892 | if (step === '-' && cursor === end) {
|
14893 | it.push(val);
|
14894 | return undefined;
|
14895 | }
|
14896 | p = toArrayIndexReference(it, step);
|
14897 | if (it.length > p) {
|
14898 | if (cursor === end) {
|
14899 | rem = it[p];
|
14900 | it[p] = val;
|
14901 | break;
|
14902 | }
|
14903 | it = it[p];
|
14904 | }
|
14905 | else if (cursor === end && p === it.length) {
|
14906 | if (force) {
|
14907 | it.push(val);
|
14908 | return undefined;
|
14909 | }
|
14910 | }
|
14911 | else if (force) {
|
14912 | it = it[p] = cursor === end ? val : {};
|
14913 | }
|
14914 | }
|
14915 | else {
|
14916 | if (typeof it[step] === 'undefined') {
|
14917 | if (force) {
|
14918 | if (cursor === end) {
|
14919 | it[step] = val;
|
14920 | return undefined;
|
14921 | }
|
14922 | // if the next step is an array index, this step should be an array.
|
14923 | var n = Number(path[cursor + 1]);
|
14924 | if (Number.isInteger(n) &&
|
14925 | toArrayIndexReference(it[step], n) !== -1) {
|
14926 | it = it[step] = [];
|
14927 | continue;
|
14928 | }
|
14929 | it = it[step] = {};
|
14930 | continue;
|
14931 | }
|
14932 | return undefined;
|
14933 | }
|
14934 | if (cursor === end) {
|
14935 | rem = it[step];
|
14936 | it[step] = val;
|
14937 | break;
|
14938 | }
|
14939 | it = it[step];
|
14940 | }
|
14941 | }
|
14942 | return rem;
|
14943 | }
|
14944 | function unsetValueAtPath(target, path) {
|
14945 | if (path.length === 0) {
|
14946 | throw new Error('Cannot unset the root object; assign it directly.');
|
14947 | }
|
14948 | if (typeof target === 'undefined') {
|
14949 | throw new TypeError('Cannot unset values on undefined');
|
14950 | }
|
14951 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14952 | var it = target;
|
14953 | var len = path.length;
|
14954 | var end = path.length - 1;
|
14955 | var step;
|
14956 | var cursor = -1;
|
14957 | var rem;
|
14958 | var p;
|
14959 | while (++cursor < len) {
|
14960 | step = path[cursor];
|
14961 | if (typeof step !== 'string' && typeof step !== 'number') {
|
14962 | throw new TypeError('PathSegments must be a string or a number.');
|
14963 | }
|
14964 | if (step === '__proto__' ||
|
14965 | step === 'constructor' ||
|
14966 | step === 'prototype') {
|
14967 | throw new Error('Attempted prototype pollution disallowed.');
|
14968 | }
|
14969 | if (Array.isArray(it)) {
|
14970 | p = toArrayIndexReference(it, step);
|
14971 | if (p >= it.length)
|
14972 | return undefined;
|
14973 | if (cursor === end) {
|
14974 | rem = it[p];
|
14975 | delete it[p];
|
14976 | break;
|
14977 | }
|
14978 | it = it[p];
|
14979 | }
|
14980 | else {
|
14981 | if (typeof it[step] === 'undefined') {
|
14982 | return undefined;
|
14983 | }
|
14984 | if (cursor === end) {
|
14985 | rem = it[step];
|
14986 | delete it[step];
|
14987 | break;
|
14988 | }
|
14989 | it = it[step];
|
14990 | }
|
14991 | }
|
14992 | return rem;
|
14993 | }
|
14994 | function looksLikeFragment(ptr) {
|
14995 | return typeof ptr === 'string' && ptr.length > 0 && ptr[0] === '#';
|
14996 | }
|
14997 | function pickDecoder(ptr) {
|
14998 | return looksLikeFragment(ptr) ? decodeUriFragmentIdentifier : decodePointer;
|
14999 | }
|
15000 | function decodePtrInit(ptr) {
|
15001 | return Array.isArray(ptr)
|
15002 | ? ptr.slice(0)
|
15003 | : pickDecoder(ptr)(ptr);
|
15004 | }
|
15005 |
|
15006 |
|
15007 | /***/ }),
|
15008 |
|
15009 | /***/ "./node_modules/type-detect/type-detect.js":
|
15010 | /*!*************************************************!*\
|
15011 | !*** ./node_modules/type-detect/type-detect.js ***!
|
15012 | \*************************************************/
|
15013 | /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
15014 |
|
15015 | (function (global, factory) {
|
15016 | true ? module.exports = factory() :
|
15017 | 0;
|
15018 | }(this, (function () { 'use strict';
|
15019 |
|
15020 | /* !
|
15021 | * type-detect
|
15022 | * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
15023 | * MIT Licensed
|
15024 | */
|
15025 | var promiseExists = typeof Promise === 'function';
|
15026 |
|
15027 | /* eslint-disable no-undef */
|
15028 | var globalObject = typeof self === 'object' ? self : __webpack_require__.g; // eslint-disable-line id-blacklist
|
15029 |
|
15030 | var symbolExists = typeof Symbol !== 'undefined';
|
15031 | var mapExists = typeof Map !== 'undefined';
|
15032 | var setExists = typeof Set !== 'undefined';
|
15033 | var weakMapExists = typeof WeakMap !== 'undefined';
|
15034 | var weakSetExists = typeof WeakSet !== 'undefined';
|
15035 | var dataViewExists = typeof DataView !== 'undefined';
|
15036 | var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
|
15037 | var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
|
15038 | var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
|
15039 | var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
|
15040 | var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
15041 | var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
|
15042 | var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
|
15043 | var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
|
15044 | var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
|
15045 | var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
|
15046 | var toStringLeftSliceLength = 8;
|
15047 | var toStringRightSliceLength = -1;
|
15048 | /**
|
15049 | * ### typeOf (obj)
|
15050 | *
|
15051 | * Uses `Object.prototype.toString` to determine the type of an object,
|
15052 | * normalising behaviour across engine versions & well optimised.
|
15053 | *
|
15054 | * @param {Mixed} object
|
15055 | * @return {String} object type
|
15056 | * @api public
|
15057 | */
|
15058 | function typeDetect(obj) {
|
15059 | /* ! Speed optimisation
|
15060 | * Pre:
|
15061 | * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
|
15062 | * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
|
15063 | * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
|
15064 | * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
|
15065 | * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
|
15066 | * Post:
|
15067 | * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
|
15068 | * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
|
15069 | * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
|
15070 | * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
|
15071 | * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
|
15072 | */
|
15073 | var typeofObj = typeof obj;
|
15074 | if (typeofObj !== 'object') {
|
15075 | return typeofObj;
|
15076 | }
|
15077 |
|
15078 | /* ! Speed optimisation
|
15079 | * Pre:
|
15080 | * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
|
15081 | * Post:
|
15082 | * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
|
15083 | */
|
15084 | if (obj === null) {
|
15085 | return 'null';
|
15086 | }
|
15087 |
|
15088 | /* ! Spec Conformance
|
15089 | * Test: `Object.prototype.toString.call(window)``
|
15090 | * - Node === "[object global]"
|
15091 | * - Chrome === "[object global]"
|
15092 | * - Firefox === "[object Window]"
|
15093 | * - PhantomJS === "[object Window]"
|
15094 | * - Safari === "[object Window]"
|
15095 | * - IE 11 === "[object Window]"
|
15096 | * - IE Edge === "[object Window]"
|
15097 | * Test: `Object.prototype.toString.call(this)``
|
15098 | * - Chrome Worker === "[object global]"
|
15099 | * - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
|
15100 | * - Safari Worker === "[object DedicatedWorkerGlobalScope]"
|
15101 | * - IE 11 Worker === "[object WorkerGlobalScope]"
|
15102 | * - IE Edge Worker === "[object WorkerGlobalScope]"
|
15103 | */
|
15104 | if (obj === globalObject) {
|
15105 | return 'global';
|
15106 | }
|
15107 |
|
15108 | /* ! Speed optimisation
|
15109 | * Pre:
|
15110 | * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
|
15111 | * Post:
|
15112 | * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
|
15113 | */
|
15114 | if (
|
15115 | Array.isArray(obj) &&
|
15116 | (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
|
15117 | ) {
|
15118 | return 'Array';
|
15119 | }
|
15120 |
|
15121 | // Not caching existence of `window` and related properties due to potential
|
15122 | // for `window` to be unset before tests in quasi-browser environments.
|
15123 | if (typeof window === 'object' && window !== null) {
|
15124 | /* ! Spec Conformance
|
15125 | * (https://html.spec.whatwg.org/multipage/browsers.html#location)
|
15126 | * WhatWG HTML$7.7.3 - The `Location` interface
|
15127 | * Test: `Object.prototype.toString.call(window.location)``
|
15128 | * - IE <=11 === "[object Object]"
|
15129 | * - IE Edge <=13 === "[object Object]"
|
15130 | */
|
15131 | if (typeof window.location === 'object' && obj === window.location) {
|
15132 | return 'Location';
|
15133 | }
|
15134 |
|
15135 | |
15136 |
|
15137 |
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 |
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 |
|
15150 |
|
15151 |
|
15152 |
|
15153 |
|
15154 | if (typeof window.document === 'object' && obj === window.document) {
|
15155 | return 'Document';
|
15156 | }
|
15157 |
|
15158 | if (typeof window.navigator === 'object') {
|
15159 | |
15160 |
|
15161 |
|
15162 |
|
15163 |
|
15164 |
|
15165 | if (typeof window.navigator.mimeTypes === 'object' &&
|
15166 | obj === window.navigator.mimeTypes) {
|
15167 | return 'MimeTypeArray';
|
15168 | }
|
15169 |
|
15170 | |
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 | if (typeof window.navigator.plugins === 'object' &&
|
15177 | obj === window.navigator.plugins) {
|
15178 | return 'PluginArray';
|
15179 | }
|
15180 | }
|
15181 |
|
15182 | if ((typeof window.HTMLElement === 'function' ||
|
15183 | typeof window.HTMLElement === 'object') &&
|
15184 | obj instanceof window.HTMLElement) {
|
15185 | |
15186 |
|
15187 |
|
15188 |
|
15189 |
|
15190 |
|
15191 | if (obj.tagName === 'BLOCKQUOTE') {
|
15192 | return 'HTMLQuoteElement';
|
15193 | }
|
15194 |
|
15195 | |
15196 |
|
15197 |
|
15198 |
|
15199 |
|
15200 |
|
15201 |
|
15202 |
|
15203 |
|
15204 |
|
15205 |
|
15206 |
|
15207 | if (obj.tagName === 'TD') {
|
15208 | return 'HTMLTableDataCellElement';
|
15209 | }
|
15210 |
|
15211 | |
15212 |
|
15213 |
|
15214 |
|
15215 |
|
15216 |
|
15217 |
|
15218 |
|
15219 |
|
15220 |
|
15221 |
|
15222 |
|
15223 | if (obj.tagName === 'TH') {
|
15224 | return 'HTMLTableHeaderCellElement';
|
15225 | }
|
15226 | }
|
15227 | }
|
15228 |
|
15229 | |
15230 |
|
15231 |
|
15232 |
|
15233 |
|
15234 |
|
15235 |
|
15236 |
|
15237 |
|
15238 |
|
15239 |
|
15240 |
|
15241 |
|
15242 |
|
15243 |
|
15244 |
|
15245 |
|
15246 |
|
15247 |
|
15248 |
|
15249 |
|
15250 |
|
15251 | var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
|
15252 | if (typeof stringTag === 'string') {
|
15253 | return stringTag;
|
15254 | }
|
15255 |
|
15256 | var objPrototype = Object.getPrototypeOf(obj);
|
15257 | |
15258 |
|
15259 |
|
15260 |
|
15261 |
|
15262 |
|
15263 |
|
15264 |
|
15265 | if (objPrototype === RegExp.prototype) {
|
15266 | return 'RegExp';
|
15267 | }
|
15268 |
|
15269 | |
15270 |
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 | if (objPrototype === Date.prototype) {
|
15276 | return 'Date';
|
15277 | }
|
15278 |
|
15279 | |
15280 |
|
15281 |
|
15282 |
|
15283 |
|
15284 |
|
15285 |
|
15286 |
|
15287 |
|
15288 | if (promiseExists && objPrototype === Promise.prototype) {
|
15289 | return 'Promise';
|
15290 | }
|
15291 |
|
15292 | |
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 | if (setExists && objPrototype === Set.prototype) {
|
15299 | return 'Set';
|
15300 | }
|
15301 |
|
15302 | |
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 | if (mapExists && objPrototype === Map.prototype) {
|
15309 | return 'Map';
|
15310 | }
|
15311 |
|
15312 | |
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 |
|
15318 | if (weakSetExists && objPrototype === WeakSet.prototype) {
|
15319 | return 'WeakSet';
|
15320 | }
|
15321 |
|
15322 | |
15323 |
|
15324 |
|
15325 |
|
15326 |
|
15327 |
|
15328 | if (weakMapExists && objPrototype === WeakMap.prototype) {
|
15329 | return 'WeakMap';
|
15330 | }
|
15331 |
|
15332 | |
15333 |
|
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 | if (dataViewExists && objPrototype === DataView.prototype) {
|
15339 | return 'DataView';
|
15340 | }
|
15341 |
|
15342 | |
15343 |
|
15344 |
|
15345 |
|
15346 |
|
15347 |
|
15348 | if (mapExists && objPrototype === mapIteratorPrototype) {
|
15349 | return 'Map Iterator';
|
15350 | }
|
15351 |
|
15352 | |
15353 |
|
15354 |
|
15355 |
|
15356 |
|
15357 |
|
15358 | if (setExists && objPrototype === setIteratorPrototype) {
|
15359 | return 'Set Iterator';
|
15360 | }
|
15361 |
|
15362 | |
15363 |
|
15364 |
|
15365 |
|
15366 |
|
15367 |
|
15368 | if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
|
15369 | return 'Array Iterator';
|
15370 | }
|
15371 |
|
15372 | |
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 |
|
15378 | if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
|
15379 | return 'String Iterator';
|
15380 | }
|
15381 |
|
15382 | |
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 | if (objPrototype === null) {
|
15389 | return 'Object';
|
15390 | }
|
15391 |
|
15392 | return Object
|
15393 | .prototype
|
15394 | .toString
|
15395 | .call(obj)
|
15396 | .slice(toStringLeftSliceLength, toStringRightSliceLength);
|
15397 | }
|
15398 |
|
15399 | return typeDetect;
|
15400 |
|
15401 | })));
|
15402 |
|
15403 |
|
15404 | }),
|
15405 |
|
15406 | "./node_modules/util/support/isBufferBrowser.js":
|
15407 |
|
15408 |
|
15409 |
|
15410 | ((module) => {
|
15411 |
|
15412 | module.exports = function isBuffer(arg) {
|
15413 | return arg && typeof arg === 'object'
|
15414 | && typeof arg.copy === 'function'
|
15415 | && typeof arg.fill === 'function'
|
15416 | && typeof arg.readUInt8 === 'function';
|
15417 | }
|
15418 |
|
15419 | }),
|
15420 |
|
15421 | "./node_modules/util/support/types.js":
|
15422 |
|
15423 |
|
15424 |
|
15425 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
15426 |
|
15427 | "use strict";
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 |
|
15433 | var isArgumentsObject = __webpack_require__( "./node_modules/is-arguments/index.js");
|
15434 | var isGeneratorFunction = __webpack_require__( "./node_modules/is-generator-function/index.js");
|
15435 | var whichTypedArray = __webpack_require__( "./node_modules/which-typed-array/index.js");
|
15436 | var isTypedArray = __webpack_require__( "./node_modules/is-typed-array/index.js");
|
15437 |
|
15438 | function uncurryThis(f) {
|
15439 | return f.call.bind(f);
|
15440 | }
|
15441 |
|
15442 | var BigIntSupported = typeof BigInt !== 'undefined';
|
15443 | var SymbolSupported = typeof Symbol !== 'undefined';
|
15444 |
|
15445 | var ObjectToString = uncurryThis(Object.prototype.toString);
|
15446 |
|
15447 | var numberValue = uncurryThis(Number.prototype.valueOf);
|
15448 | var stringValue = uncurryThis(String.prototype.valueOf);
|
15449 | var booleanValue = uncurryThis(Boolean.prototype.valueOf);
|
15450 |
|
15451 | if (BigIntSupported) {
|
15452 | var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
|
15453 | }
|
15454 |
|
15455 | if (SymbolSupported) {
|
15456 | var symbolValue = uncurryThis(Symbol.prototype.valueOf);
|
15457 | }
|
15458 |
|
15459 | function checkBoxedPrimitive(value, prototypeValueOf) {
|
15460 | if (typeof value !== 'object') {
|
15461 | return false;
|
15462 | }
|
15463 | try {
|
15464 | prototypeValueOf(value);
|
15465 | return true;
|
15466 | } catch(e) {
|
15467 | return false;
|
15468 | }
|
15469 | }
|
15470 |
|
15471 | exports.isArgumentsObject = isArgumentsObject;
|
15472 | exports.isGeneratorFunction = isGeneratorFunction;
|
15473 | exports.isTypedArray = isTypedArray;
|
15474 |
|
15475 |
|
15476 |
|
15477 | function isPromise(input) {
|
15478 | return (
|
15479 | (
|
15480 | typeof Promise !== 'undefined' &&
|
15481 | input instanceof Promise
|
15482 | ) ||
|
15483 | (
|
15484 | input !== null &&
|
15485 | typeof input === 'object' &&
|
15486 | typeof input.then === 'function' &&
|
15487 | typeof input.catch === 'function'
|
15488 | )
|
15489 | );
|
15490 | }
|
15491 | exports.isPromise = isPromise;
|
15492 |
|
15493 | function isArrayBufferView(value) {
|
15494 | if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
15495 | return ArrayBuffer.isView(value);
|
15496 | }
|
15497 |
|
15498 | return (
|
15499 | isTypedArray(value) ||
|
15500 | isDataView(value)
|
15501 | );
|
15502 | }
|
15503 | exports.isArrayBufferView = isArrayBufferView;
|
15504 |
|
15505 |
|
15506 | function isUint8Array(value) {
|
15507 | return whichTypedArray(value) === 'Uint8Array';
|
15508 | }
|
15509 | exports.isUint8Array = isUint8Array;
|
15510 |
|
15511 | function isUint8ClampedArray(value) {
|
15512 | return whichTypedArray(value) === 'Uint8ClampedArray';
|
15513 | }
|
15514 | exports.isUint8ClampedArray = isUint8ClampedArray;
|
15515 |
|
15516 | function isUint16Array(value) {
|
15517 | return whichTypedArray(value) === 'Uint16Array';
|
15518 | }
|
15519 | exports.isUint16Array = isUint16Array;
|
15520 |
|
15521 | function isUint32Array(value) {
|
15522 | return whichTypedArray(value) === 'Uint32Array';
|
15523 | }
|
15524 | exports.isUint32Array = isUint32Array;
|
15525 |
|
15526 | function isInt8Array(value) {
|
15527 | return whichTypedArray(value) === 'Int8Array';
|
15528 | }
|
15529 | exports.isInt8Array = isInt8Array;
|
15530 |
|
15531 | function isInt16Array(value) {
|
15532 | return whichTypedArray(value) === 'Int16Array';
|
15533 | }
|
15534 | exports.isInt16Array = isInt16Array;
|
15535 |
|
15536 | function isInt32Array(value) {
|
15537 | return whichTypedArray(value) === 'Int32Array';
|
15538 | }
|
15539 | exports.isInt32Array = isInt32Array;
|
15540 |
|
15541 | function isFloat32Array(value) {
|
15542 | return whichTypedArray(value) === 'Float32Array';
|
15543 | }
|
15544 | exports.isFloat32Array = isFloat32Array;
|
15545 |
|
15546 | function isFloat64Array(value) {
|
15547 | return whichTypedArray(value) === 'Float64Array';
|
15548 | }
|
15549 | exports.isFloat64Array = isFloat64Array;
|
15550 |
|
15551 | function isBigInt64Array(value) {
|
15552 | return whichTypedArray(value) === 'BigInt64Array';
|
15553 | }
|
15554 | exports.isBigInt64Array = isBigInt64Array;
|
15555 |
|
15556 | function isBigUint64Array(value) {
|
15557 | return whichTypedArray(value) === 'BigUint64Array';
|
15558 | }
|
15559 | exports.isBigUint64Array = isBigUint64Array;
|
15560 |
|
15561 | function isMapToString(value) {
|
15562 | return ObjectToString(value) === '[object Map]';
|
15563 | }
|
15564 | isMapToString.working = (
|
15565 | typeof Map !== 'undefined' &&
|
15566 | isMapToString(new Map())
|
15567 | );
|
15568 |
|
15569 | function isMap(value) {
|
15570 | if (typeof Map === 'undefined') {
|
15571 | return false;
|
15572 | }
|
15573 |
|
15574 | return isMapToString.working
|
15575 | ? isMapToString(value)
|
15576 | : value instanceof Map;
|
15577 | }
|
15578 | exports.isMap = isMap;
|
15579 |
|
15580 | function isSetToString(value) {
|
15581 | return ObjectToString(value) === '[object Set]';
|
15582 | }
|
15583 | isSetToString.working = (
|
15584 | typeof Set !== 'undefined' &&
|
15585 | isSetToString(new Set())
|
15586 | );
|
15587 | function isSet(value) {
|
15588 | if (typeof Set === 'undefined') {
|
15589 | return false;
|
15590 | }
|
15591 |
|
15592 | return isSetToString.working
|
15593 | ? isSetToString(value)
|
15594 | : value instanceof Set;
|
15595 | }
|
15596 | exports.isSet = isSet;
|
15597 |
|
15598 | function isWeakMapToString(value) {
|
15599 | return ObjectToString(value) === '[object WeakMap]';
|
15600 | }
|
15601 | isWeakMapToString.working = (
|
15602 | typeof WeakMap !== 'undefined' &&
|
15603 | isWeakMapToString(new WeakMap())
|
15604 | );
|
15605 | function isWeakMap(value) {
|
15606 | if (typeof WeakMap === 'undefined') {
|
15607 | return false;
|
15608 | }
|
15609 |
|
15610 | return isWeakMapToString.working
|
15611 | ? isWeakMapToString(value)
|
15612 | : value instanceof WeakMap;
|
15613 | }
|
15614 | exports.isWeakMap = isWeakMap;
|
15615 |
|
15616 | function isWeakSetToString(value) {
|
15617 | return ObjectToString(value) === '[object WeakSet]';
|
15618 | }
|
15619 | isWeakSetToString.working = (
|
15620 | typeof WeakSet !== 'undefined' &&
|
15621 | isWeakSetToString(new WeakSet())
|
15622 | );
|
15623 | function isWeakSet(value) {
|
15624 | return isWeakSetToString(value);
|
15625 | }
|
15626 | exports.isWeakSet = isWeakSet;
|
15627 |
|
15628 | function isArrayBufferToString(value) {
|
15629 | return ObjectToString(value) === '[object ArrayBuffer]';
|
15630 | }
|
15631 | isArrayBufferToString.working = (
|
15632 | typeof ArrayBuffer !== 'undefined' &&
|
15633 | isArrayBufferToString(new ArrayBuffer())
|
15634 | );
|
15635 | function isArrayBuffer(value) {
|
15636 | if (typeof ArrayBuffer === 'undefined') {
|
15637 | return false;
|
15638 | }
|
15639 |
|
15640 | return isArrayBufferToString.working
|
15641 | ? isArrayBufferToString(value)
|
15642 | : value instanceof ArrayBuffer;
|
15643 | }
|
15644 | exports.isArrayBuffer = isArrayBuffer;
|
15645 |
|
15646 | function isDataViewToString(value) {
|
15647 | return ObjectToString(value) === '[object DataView]';
|
15648 | }
|
15649 | isDataViewToString.working = (
|
15650 | typeof ArrayBuffer !== 'undefined' &&
|
15651 | typeof DataView !== 'undefined' &&
|
15652 | isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
|
15653 | );
|
15654 | function isDataView(value) {
|
15655 | if (typeof DataView === 'undefined') {
|
15656 | return false;
|
15657 | }
|
15658 |
|
15659 | return isDataViewToString.working
|
15660 | ? isDataViewToString(value)
|
15661 | : value instanceof DataView;
|
15662 | }
|
15663 | exports.isDataView = isDataView;
|
15664 |
|
15665 |
|
15666 | var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
|
15667 | function isSharedArrayBufferToString(value) {
|
15668 | return ObjectToString(value) === '[object SharedArrayBuffer]';
|
15669 | }
|
15670 | function isSharedArrayBuffer(value) {
|
15671 | if (typeof SharedArrayBufferCopy === 'undefined') {
|
15672 | return false;
|
15673 | }
|
15674 |
|
15675 | if (typeof isSharedArrayBufferToString.working === 'undefined') {
|
15676 | isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
|
15677 | }
|
15678 |
|
15679 | return isSharedArrayBufferToString.working
|
15680 | ? isSharedArrayBufferToString(value)
|
15681 | : value instanceof SharedArrayBufferCopy;
|
15682 | }
|
15683 | exports.isSharedArrayBuffer = isSharedArrayBuffer;
|
15684 |
|
15685 | function isAsyncFunction(value) {
|
15686 | return ObjectToString(value) === '[object AsyncFunction]';
|
15687 | }
|
15688 | exports.isAsyncFunction = isAsyncFunction;
|
15689 |
|
15690 | function isMapIterator(value) {
|
15691 | return ObjectToString(value) === '[object Map Iterator]';
|
15692 | }
|
15693 | exports.isMapIterator = isMapIterator;
|
15694 |
|
15695 | function isSetIterator(value) {
|
15696 | return ObjectToString(value) === '[object Set Iterator]';
|
15697 | }
|
15698 | exports.isSetIterator = isSetIterator;
|
15699 |
|
15700 | function isGeneratorObject(value) {
|
15701 | return ObjectToString(value) === '[object Generator]';
|
15702 | }
|
15703 | exports.isGeneratorObject = isGeneratorObject;
|
15704 |
|
15705 | function isWebAssemblyCompiledModule(value) {
|
15706 | return ObjectToString(value) === '[object WebAssembly.Module]';
|
15707 | }
|
15708 | exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
|
15709 |
|
15710 | function isNumberObject(value) {
|
15711 | return checkBoxedPrimitive(value, numberValue);
|
15712 | }
|
15713 | exports.isNumberObject = isNumberObject;
|
15714 |
|
15715 | function isStringObject(value) {
|
15716 | return checkBoxedPrimitive(value, stringValue);
|
15717 | }
|
15718 | exports.isStringObject = isStringObject;
|
15719 |
|
15720 | function isBooleanObject(value) {
|
15721 | return checkBoxedPrimitive(value, booleanValue);
|
15722 | }
|
15723 | exports.isBooleanObject = isBooleanObject;
|
15724 |
|
15725 | function isBigIntObject(value) {
|
15726 | return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
|
15727 | }
|
15728 | exports.isBigIntObject = isBigIntObject;
|
15729 |
|
15730 | function isSymbolObject(value) {
|
15731 | return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
|
15732 | }
|
15733 | exports.isSymbolObject = isSymbolObject;
|
15734 |
|
15735 | function isBoxedPrimitive(value) {
|
15736 | return (
|
15737 | isNumberObject(value) ||
|
15738 | isStringObject(value) ||
|
15739 | isBooleanObject(value) ||
|
15740 | isBigIntObject(value) ||
|
15741 | isSymbolObject(value)
|
15742 | );
|
15743 | }
|
15744 | exports.isBoxedPrimitive = isBoxedPrimitive;
|
15745 |
|
15746 | function isAnyArrayBuffer(value) {
|
15747 | return typeof Uint8Array !== 'undefined' && (
|
15748 | isArrayBuffer(value) ||
|
15749 | isSharedArrayBuffer(value)
|
15750 | );
|
15751 | }
|
15752 | exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
15753 |
|
15754 | ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
|
15755 | Object.defineProperty(exports, method, {
|
15756 | enumerable: false,
|
15757 | value: function() {
|
15758 | throw new Error(method + ' is not supported in userland');
|
15759 | }
|
15760 | });
|
15761 | });
|
15762 |
|
15763 |
|
15764 | }),
|
15765 |
|
15766 | "./node_modules/util/util.js":
|
15767 |
|
15768 |
|
15769 |
|
15770 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
15771 |
|
15772 |
|
15773 |
|
15774 |
|
15775 |
|
15776 |
|
15777 |
|
15778 |
|
15779 |
|
15780 |
|
15781 |
|
15782 |
|
15783 |
|
15784 |
|
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 |
|
15790 |
|
15791 |
|
15792 |
|
15793 | var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
15794 | function getOwnPropertyDescriptors(obj) {
|
15795 | var keys = Object.keys(obj);
|
15796 | var descriptors = {};
|
15797 | for (var i = 0; i < keys.length; i++) {
|
15798 | descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
|
15799 | }
|
15800 | return descriptors;
|
15801 | };
|
15802 |
|
15803 | var formatRegExp = /%[sdj%]/g;
|
15804 | exports.format = function(f) {
|
15805 | if (!isString(f)) {
|
15806 | var objects = [];
|
15807 | for (var i = 0; i < arguments.length; i++) {
|
15808 | objects.push(inspect(arguments[i]));
|
15809 | }
|
15810 | return objects.join(' ');
|
15811 | }
|
15812 |
|
15813 | var i = 1;
|
15814 | var args = arguments;
|
15815 | var len = args.length;
|
15816 | var str = String(f).replace(formatRegExp, function(x) {
|
15817 | if (x === '%%') return '%';
|
15818 | if (i >= len) return x;
|
15819 | switch (x) {
|
15820 | case '%s': return String(args[i++]);
|
15821 | case '%d': return Number(args[i++]);
|
15822 | case '%j':
|
15823 | try {
|
15824 | return JSON.stringify(args[i++]);
|
15825 | } catch (_) {
|
15826 | return '[Circular]';
|
15827 | }
|
15828 | default:
|
15829 | return x;
|
15830 | }
|
15831 | });
|
15832 | for (var x = args[i]; i < len; x = args[++i]) {
|
15833 | if (isNull(x) || !isObject(x)) {
|
15834 | str += ' ' + x;
|
15835 | } else {
|
15836 | str += ' ' + inspect(x);
|
15837 | }
|
15838 | }
|
15839 | return str;
|
15840 | };
|
15841 |
|
15842 |
|
15843 |
|
15844 |
|
15845 |
|
15846 | exports.deprecate = function(fn, msg) {
|
15847 | if (typeof process !== 'undefined' && process.noDeprecation === true) {
|
15848 | return fn;
|
15849 | }
|
15850 |
|
15851 |
|
15852 | if (typeof process === 'undefined') {
|
15853 | return function() {
|
15854 | return exports.deprecate(fn, msg).apply(this, arguments);
|
15855 | };
|
15856 | }
|
15857 |
|
15858 | var warned = false;
|
15859 | function deprecated() {
|
15860 | if (!warned) {
|
15861 | if (process.throwDeprecation) {
|
15862 | throw new Error(msg);
|
15863 | } else if (process.traceDeprecation) {
|
15864 | console.trace(msg);
|
15865 | } else {
|
15866 | console.error(msg);
|
15867 | }
|
15868 | warned = true;
|
15869 | }
|
15870 | return fn.apply(this, arguments);
|
15871 | }
|
15872 |
|
15873 | return deprecated;
|
15874 | };
|
15875 |
|
15876 |
|
15877 | var debugs = {};
|
15878 | var debugEnvRegex = /^$/;
|
15879 |
|
15880 | if (process.env.NODE_DEBUG) {
|
15881 | var debugEnv = process.env.NODE_DEBUG;
|
15882 | debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
|
15883 | .replace(/\*/g, '.*')
|
15884 | .replace(/,/g, '$|^')
|
15885 | .toUpperCase();
|
15886 | debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
|
15887 | }
|
15888 | exports.debuglog = function(set) {
|
15889 | set = set.toUpperCase();
|
15890 | if (!debugs[set]) {
|
15891 | if (debugEnvRegex.test(set)) {
|
15892 | var pid = process.pid;
|
15893 | debugs[set] = function() {
|
15894 | var msg = exports.format.apply(exports, arguments);
|
15895 | console.error('%s %d: %s', set, pid, msg);
|
15896 | };
|
15897 | } else {
|
15898 | debugs[set] = function() {};
|
15899 | }
|
15900 | }
|
15901 | return debugs[set];
|
15902 | };
|
15903 |
|
15904 |
|
15905 | /**
|
15906 | * Echos the value of a value. Trys to print the value out
|
15907 | * in the best way possible given the different types.
|
15908 | *
|
15909 | * @param {Object} obj The object to print out.
|
15910 | * @param {Object} opts Optional options object that alters the output.
|
15911 | */
|
15912 |
|
15913 | function inspect(obj, opts) {
|
15914 |
|
15915 | var ctx = {
|
15916 | seen: [],
|
15917 | stylize: stylizeNoColor
|
15918 | };
|
15919 |
|
15920 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
15921 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
15922 | if (isBoolean(opts)) {
|
15923 |
|
15924 | ctx.showHidden = opts;
|
15925 | } else if (opts) {
|
15926 |
|
15927 | exports._extend(ctx, opts);
|
15928 | }
|
15929 |
|
15930 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
15931 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
15932 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
15933 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
15934 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
15935 | return formatValue(ctx, obj, ctx.depth);
|
15936 | }
|
15937 | exports.inspect = inspect;
|
15938 |
|
15939 |
|
15940 |
|
15941 | inspect.colors = {
|
15942 | 'bold' : [1, 22],
|
15943 | 'italic' : [3, 23],
|
15944 | 'underline' : [4, 24],
|
15945 | 'inverse' : [7, 27],
|
15946 | 'white' : [37, 39],
|
15947 | 'grey' : [90, 39],
|
15948 | 'black' : [30, 39],
|
15949 | 'blue' : [34, 39],
|
15950 | 'cyan' : [36, 39],
|
15951 | 'green' : [32, 39],
|
15952 | 'magenta' : [35, 39],
|
15953 | 'red' : [31, 39],
|
15954 | 'yellow' : [33, 39]
|
15955 | };
|
15956 |
|
15957 |
|
15958 | inspect.styles = {
|
15959 | 'special': 'cyan',
|
15960 | 'number': 'yellow',
|
15961 | 'boolean': 'yellow',
|
15962 | 'undefined': 'grey',
|
15963 | 'null': 'bold',
|
15964 | 'string': 'green',
|
15965 | 'date': 'magenta',
|
15966 |
|
15967 | 'regexp': 'red'
|
15968 | };
|
15969 |
|
15970 |
|
15971 | function stylizeWithColor(str, styleType) {
|
15972 | var style = inspect.styles[styleType];
|
15973 |
|
15974 | if (style) {
|
15975 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
15976 | '\u001b[' + inspect.colors[style][1] + 'm';
|
15977 | } else {
|
15978 | return str;
|
15979 | }
|
15980 | }
|
15981 |
|
15982 |
|
15983 | function stylizeNoColor(str, styleType) {
|
15984 | return str;
|
15985 | }
|
15986 |
|
15987 |
|
15988 | function arrayToHash(array) {
|
15989 | var hash = {};
|
15990 |
|
15991 | array.forEach(function(val, idx) {
|
15992 | hash[val] = true;
|
15993 | });
|
15994 |
|
15995 | return hash;
|
15996 | }
|
15997 |
|
15998 |
|
15999 | function formatValue(ctx, value, recurseTimes) {
|
16000 |
|
16001 |
|
16002 | if (ctx.customInspect &&
|
16003 | value &&
|
16004 | isFunction(value.inspect) &&
|
16005 |
|
16006 | value.inspect !== exports.inspect &&
|
16007 |
|
16008 | !(value.constructor && value.constructor.prototype === value)) {
|
16009 | var ret = value.inspect(recurseTimes, ctx);
|
16010 | if (!isString(ret)) {
|
16011 | ret = formatValue(ctx, ret, recurseTimes);
|
16012 | }
|
16013 | return ret;
|
16014 | }
|
16015 |
|
16016 |
|
16017 | var primitive = formatPrimitive(ctx, value);
|
16018 | if (primitive) {
|
16019 | return primitive;
|
16020 | }
|
16021 |
|
16022 |
|
16023 | var keys = Object.keys(value);
|
16024 | var visibleKeys = arrayToHash(keys);
|
16025 |
|
16026 | if (ctx.showHidden) {
|
16027 | keys = Object.getOwnPropertyNames(value);
|
16028 | }
|
16029 |
|
16030 |
|
16031 |
|
16032 | if (isError(value)
|
16033 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
16034 | return formatError(value);
|
16035 | }
|
16036 |
|
16037 |
|
16038 | if (keys.length === 0) {
|
16039 | if (isFunction(value)) {
|
16040 | var name = value.name ? ': ' + value.name : '';
|
16041 | return ctx.stylize('[Function' + name + ']', 'special');
|
16042 | }
|
16043 | if (isRegExp(value)) {
|
16044 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
16045 | }
|
16046 | if (isDate(value)) {
|
16047 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
16048 | }
|
16049 | if (isError(value)) {
|
16050 | return formatError(value);
|
16051 | }
|
16052 | }
|
16053 |
|
16054 | var base = '', array = false, braces = ['{', '}'];
|
16055 |
|
16056 |
|
16057 | if (isArray(value)) {
|
16058 | array = true;
|
16059 | braces = ['[', ']'];
|
16060 | }
|
16061 |
|
16062 |
|
16063 | if (isFunction(value)) {
|
16064 | var n = value.name ? ': ' + value.name : '';
|
16065 | base = ' [Function' + n + ']';
|
16066 | }
|
16067 |
|
16068 |
|
16069 | if (isRegExp(value)) {
|
16070 | base = ' ' + RegExp.prototype.toString.call(value);
|
16071 | }
|
16072 |
|
16073 |
|
16074 | if (isDate(value)) {
|
16075 | base = ' ' + Date.prototype.toUTCString.call(value);
|
16076 | }
|
16077 |
|
16078 |
|
16079 | if (isError(value)) {
|
16080 | base = ' ' + formatError(value);
|
16081 | }
|
16082 |
|
16083 | if (keys.length === 0 && (!array || value.length == 0)) {
|
16084 | return braces[0] + base + braces[1];
|
16085 | }
|
16086 |
|
16087 | if (recurseTimes < 0) {
|
16088 | if (isRegExp(value)) {
|
16089 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
16090 | } else {
|
16091 | return ctx.stylize('[Object]', 'special');
|
16092 | }
|
16093 | }
|
16094 |
|
16095 | ctx.seen.push(value);
|
16096 |
|
16097 | var output;
|
16098 | if (array) {
|
16099 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
16100 | } else {
|
16101 | output = keys.map(function(key) {
|
16102 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
16103 | });
|
16104 | }
|
16105 |
|
16106 | ctx.seen.pop();
|
16107 |
|
16108 | return reduceToSingleString(output, base, braces);
|
16109 | }
|
16110 |
|
16111 |
|
16112 | function formatPrimitive(ctx, value) {
|
16113 | if (isUndefined(value))
|
16114 | return ctx.stylize('undefined', 'undefined');
|
16115 | if (isString(value)) {
|
16116 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
16117 | .replace(/'/g, "\\'")
|
16118 | .replace(/\\"/g, '"') + '\'';
|
16119 | return ctx.stylize(simple, 'string');
|
16120 | }
|
16121 | if (isNumber(value))
|
16122 | return ctx.stylize('' + value, 'number');
|
16123 | if (isBoolean(value))
|
16124 | return ctx.stylize('' + value, 'boolean');
|
16125 |
|
16126 | if (isNull(value))
|
16127 | return ctx.stylize('null', 'null');
|
16128 | }
|
16129 |
|
16130 |
|
16131 | function formatError(value) {
|
16132 | return '[' + Error.prototype.toString.call(value) + ']';
|
16133 | }
|
16134 |
|
16135 |
|
16136 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
16137 | var output = [];
|
16138 | for (var i = 0, l = value.length; i < l; ++i) {
|
16139 | if (hasOwnProperty(value, String(i))) {
|
16140 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
16141 | String(i), true));
|
16142 | } else {
|
16143 | output.push('');
|
16144 | }
|
16145 | }
|
16146 | keys.forEach(function(key) {
|
16147 | if (!key.match(/^\d+$/)) {
|
16148 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
16149 | key, true));
|
16150 | }
|
16151 | });
|
16152 | return output;
|
16153 | }
|
16154 |
|
16155 |
|
16156 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
16157 | var name, str, desc;
|
16158 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
16159 | if (desc.get) {
|
16160 | if (desc.set) {
|
16161 | str = ctx.stylize('[Getter/Setter]', 'special');
|
16162 | } else {
|
16163 | str = ctx.stylize('[Getter]', 'special');
|
16164 | }
|
16165 | } else {
|
16166 | if (desc.set) {
|
16167 | str = ctx.stylize('[Setter]', 'special');
|
16168 | }
|
16169 | }
|
16170 | if (!hasOwnProperty(visibleKeys, key)) {
|
16171 | name = '[' + key + ']';
|
16172 | }
|
16173 | if (!str) {
|
16174 | if (ctx.seen.indexOf(desc.value) < 0) {
|
16175 | if (isNull(recurseTimes)) {
|
16176 | str = formatValue(ctx, desc.value, null);
|
16177 | } else {
|
16178 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
16179 | }
|
16180 | if (str.indexOf('\n') > -1) {
|
16181 | if (array) {
|
16182 | str = str.split('\n').map(function(line) {
|
16183 | return ' ' + line;
|
16184 | }).join('\n').substr(2);
|
16185 | } else {
|
16186 | str = '\n' + str.split('\n').map(function(line) {
|
16187 | return ' ' + line;
|
16188 | }).join('\n');
|
16189 | }
|
16190 | }
|
16191 | } else {
|
16192 | str = ctx.stylize('[Circular]', 'special');
|
16193 | }
|
16194 | }
|
16195 | if (isUndefined(name)) {
|
16196 | if (array && key.match(/^\d+$/)) {
|
16197 | return str;
|
16198 | }
|
16199 | name = JSON.stringify('' + key);
|
16200 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
16201 | name = name.substr(1, name.length - 2);
|
16202 | name = ctx.stylize(name, 'name');
|
16203 | } else {
|
16204 | name = name.replace(/'/g, "\\'")
|
16205 | .replace(/\\"/g, '"')
|
16206 | .replace(/(^"|"$)/g, "'");
|
16207 | name = ctx.stylize(name, 'string');
|
16208 | }
|
16209 | }
|
16210 |
|
16211 | return name + ': ' + str;
|
16212 | }
|
16213 |
|
16214 |
|
16215 | function reduceToSingleString(output, base, braces) {
|
16216 | var numLinesEst = 0;
|
16217 | var length = output.reduce(function(prev, cur) {
|
16218 | numLinesEst++;
|
16219 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
16220 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
16221 | }, 0);
|
16222 |
|
16223 | if (length > 60) {
|
16224 | return braces[0] +
|
16225 | (base === '' ? '' : base + '\n ') +
|
16226 | ' ' +
|
16227 | output.join(',\n ') +
|
16228 | ' ' +
|
16229 | braces[1];
|
16230 | }
|
16231 |
|
16232 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
16233 | }
|
16234 |
|
16235 |
|
16236 |
|
16237 |
|
16238 | exports.types = __webpack_require__( "./node_modules/util/support/types.js");
|
16239 |
|
16240 | function isArray(ar) {
|
16241 | return Array.isArray(ar);
|
16242 | }
|
16243 | exports.isArray = isArray;
|
16244 |
|
16245 | function isBoolean(arg) {
|
16246 | return typeof arg === 'boolean';
|
16247 | }
|
16248 | exports.isBoolean = isBoolean;
|
16249 |
|
16250 | function isNull(arg) {
|
16251 | return arg === null;
|
16252 | }
|
16253 | exports.isNull = isNull;
|
16254 |
|
16255 | function isNullOrUndefined(arg) {
|
16256 | return arg == null;
|
16257 | }
|
16258 | exports.isNullOrUndefined = isNullOrUndefined;
|
16259 |
|
16260 | function isNumber(arg) {
|
16261 | return typeof arg === 'number';
|
16262 | }
|
16263 | exports.isNumber = isNumber;
|
16264 |
|
16265 | function isString(arg) {
|
16266 | return typeof arg === 'string';
|
16267 | }
|
16268 | exports.isString = isString;
|
16269 |
|
16270 | function isSymbol(arg) {
|
16271 | return typeof arg === 'symbol';
|
16272 | }
|
16273 | exports.isSymbol = isSymbol;
|
16274 |
|
16275 | function isUndefined(arg) {
|
16276 | return arg === void 0;
|
16277 | }
|
16278 | exports.isUndefined = isUndefined;
|
16279 |
|
16280 | function isRegExp(re) {
|
16281 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
16282 | }
|
16283 | exports.isRegExp = isRegExp;
|
16284 | exports.types.isRegExp = isRegExp;
|
16285 |
|
16286 | function isObject(arg) {
|
16287 | return typeof arg === 'object' && arg !== null;
|
16288 | }
|
16289 | exports.isObject = isObject;
|
16290 |
|
16291 | function isDate(d) {
|
16292 | return isObject(d) && objectToString(d) === '[object Date]';
|
16293 | }
|
16294 | exports.isDate = isDate;
|
16295 | exports.types.isDate = isDate;
|
16296 |
|
16297 | function isError(e) {
|
16298 | return isObject(e) &&
|
16299 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
16300 | }
|
16301 | exports.isError = isError;
|
16302 | exports.types.isNativeError = isError;
|
16303 |
|
16304 | function isFunction(arg) {
|
16305 | return typeof arg === 'function';
|
16306 | }
|
16307 | exports.isFunction = isFunction;
|
16308 |
|
16309 | function isPrimitive(arg) {
|
16310 | return arg === null ||
|
16311 | typeof arg === 'boolean' ||
|
16312 | typeof arg === 'number' ||
|
16313 | typeof arg === 'string' ||
|
16314 | typeof arg === 'symbol' ||
|
16315 | typeof arg === 'undefined';
|
16316 | }
|
16317 | exports.isPrimitive = isPrimitive;
|
16318 |
|
16319 | exports.isBuffer = __webpack_require__( "./node_modules/util/support/isBufferBrowser.js");
|
16320 |
|
16321 | function objectToString(o) {
|
16322 | return Object.prototype.toString.call(o);
|
16323 | }
|
16324 |
|
16325 |
|
16326 | function pad(n) {
|
16327 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
16328 | }
|
16329 |
|
16330 |
|
16331 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
16332 | 'Oct', 'Nov', 'Dec'];
|
16333 |
|
16334 |
|
16335 | function timestamp() {
|
16336 | var d = new Date();
|
16337 | var time = [pad(d.getHours()),
|
16338 | pad(d.getMinutes()),
|
16339 | pad(d.getSeconds())].join(':');
|
16340 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
16341 | }
|
16342 |
|
16343 |
|
16344 |
|
16345 | exports.log = function() {
|
16346 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
16347 | };
|
16348 |
|
16349 |
|
16350 |
|
16351 |
|
16352 |
|
16353 |
|
16354 |
|
16355 |
|
16356 |
|
16357 |
|
16358 |
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 | exports.inherits = __webpack_require__( "./node_modules/inherits/inherits_browser.js");
|
16364 |
|
16365 | exports._extend = function(origin, add) {
|
16366 |
|
16367 | if (!add || !isObject(add)) return origin;
|
16368 |
|
16369 | var keys = Object.keys(add);
|
16370 | var i = keys.length;
|
16371 | while (i--) {
|
16372 | origin[keys[i]] = add[keys[i]];
|
16373 | }
|
16374 | return origin;
|
16375 | };
|
16376 |
|
16377 | function hasOwnProperty(obj, prop) {
|
16378 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
16379 | }
|
16380 |
|
16381 | var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
|
16382 |
|
16383 | exports.promisify = function promisify(original) {
|
16384 | if (typeof original !== 'function')
|
16385 | throw new TypeError('The "original" argument must be of type Function');
|
16386 |
|
16387 | if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
16388 | var fn = original[kCustomPromisifiedSymbol];
|
16389 | if (typeof fn !== 'function') {
|
16390 | throw new TypeError('The "util.promisify.custom" argument must be of type Function');
|
16391 | }
|
16392 | Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
16393 | value: fn, enumerable: false, writable: false, configurable: true
|
16394 | });
|
16395 | return fn;
|
16396 | }
|
16397 |
|
16398 | function fn() {
|
16399 | var promiseResolve, promiseReject;
|
16400 | var promise = new Promise(function (resolve, reject) {
|
16401 | promiseResolve = resolve;
|
16402 | promiseReject = reject;
|
16403 | });
|
16404 |
|
16405 | var args = [];
|
16406 | for (var i = 0; i < arguments.length; i++) {
|
16407 | args.push(arguments[i]);
|
16408 | }
|
16409 | args.push(function (err, value) {
|
16410 | if (err) {
|
16411 | promiseReject(err);
|
16412 | } else {
|
16413 | promiseResolve(value);
|
16414 | }
|
16415 | });
|
16416 |
|
16417 | try {
|
16418 | original.apply(this, args);
|
16419 | } catch (err) {
|
16420 | promiseReject(err);
|
16421 | }
|
16422 |
|
16423 | return promise;
|
16424 | }
|
16425 |
|
16426 | Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
|
16427 |
|
16428 | if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
16429 | value: fn, enumerable: false, writable: false, configurable: true
|
16430 | });
|
16431 | return Object.defineProperties(
|
16432 | fn,
|
16433 | getOwnPropertyDescriptors(original)
|
16434 | );
|
16435 | }
|
16436 |
|
16437 | exports.promisify.custom = kCustomPromisifiedSymbol
|
16438 |
|
16439 | function callbackifyOnRejected(reason, cb) {
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 | if (!reason) {
|
16445 | var newReason = new Error('Promise was rejected with a falsy value');
|
16446 | newReason.reason = reason;
|
16447 | reason = newReason;
|
16448 | }
|
16449 | return cb(reason);
|
16450 | }
|
16451 |
|
16452 | function callbackify(original) {
|
16453 | if (typeof original !== 'function') {
|
16454 | throw new TypeError('The "original" argument must be of type Function');
|
16455 | }
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 | function callbackified() {
|
16461 | var args = [];
|
16462 | for (var i = 0; i < arguments.length; i++) {
|
16463 | args.push(arguments[i]);
|
16464 | }
|
16465 |
|
16466 | var maybeCb = args.pop();
|
16467 | if (typeof maybeCb !== 'function') {
|
16468 | throw new TypeError('The last argument must be of type Function');
|
16469 | }
|
16470 | var self = this;
|
16471 | var cb = function() {
|
16472 | return maybeCb.apply(self, arguments);
|
16473 | };
|
16474 |
|
16475 |
|
16476 | original.apply(this, args)
|
16477 | .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
|
16478 | function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
|
16479 | }
|
16480 |
|
16481 | Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
|
16482 | Object.defineProperties(callbackified,
|
16483 | getOwnPropertyDescriptors(original));
|
16484 | return callbackified;
|
16485 | }
|
16486 | exports.callbackify = callbackify;
|
16487 |
|
16488 |
|
16489 | }),
|
16490 |
|
16491 | "./node_modules/which-typed-array/index.js":
|
16492 |
|
16493 |
|
16494 |
|
16495 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
16496 |
|
16497 | "use strict";
|
16498 |
|
16499 |
|
16500 | var forEach = __webpack_require__( "./node_modules/foreach/index.js");
|
16501 | var availableTypedArrays = __webpack_require__( "./node_modules/available-typed-arrays/index.js");
|
16502 | var callBound = __webpack_require__( "./node_modules/call-bind/callBound.js");
|
16503 |
|
16504 | var $toString = callBound('Object.prototype.toString');
|
16505 | var hasToStringTag = __webpack_require__( "./node_modules/has-tostringtag/shams.js")();
|
16506 |
|
16507 | var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
|
16508 | var typedArrays = availableTypedArrays();
|
16509 |
|
16510 | var $slice = callBound('String.prototype.slice');
|
16511 | var toStrTags = {};
|
16512 | var gOPD = __webpack_require__( "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
|
16513 | var getPrototypeOf = Object.getPrototypeOf;
|
16514 | if (hasToStringTag && gOPD && getPrototypeOf) {
|
16515 | forEach(typedArrays, function (typedArray) {
|
16516 | if (typeof g[typedArray] === 'function') {
|
16517 | var arr = new g[typedArray]();
|
16518 | if (Symbol.toStringTag in arr) {
|
16519 | var proto = getPrototypeOf(arr);
|
16520 | var descriptor = gOPD(proto, Symbol.toStringTag);
|
16521 | if (!descriptor) {
|
16522 | var superProto = getPrototypeOf(proto);
|
16523 | descriptor = gOPD(superProto, Symbol.toStringTag);
|
16524 | }
|
16525 | toStrTags[typedArray] = descriptor.get;
|
16526 | }
|
16527 | }
|
16528 | });
|
16529 | }
|
16530 |
|
16531 | var tryTypedArrays = function tryAllTypedArrays(value) {
|
16532 | var foundName = false;
|
16533 | forEach(toStrTags, function (getter, typedArray) {
|
16534 | if (!foundName) {
|
16535 | try {
|
16536 | var name = getter.call(value);
|
16537 | if (name === typedArray) {
|
16538 | foundName = name;
|
16539 | }
|
16540 | } catch (e) {}
|
16541 | }
|
16542 | });
|
16543 | return foundName;
|
16544 | };
|
16545 |
|
16546 | var isTypedArray = __webpack_require__( "./node_modules/is-typed-array/index.js");
|
16547 |
|
16548 | module.exports = function whichTypedArray(value) {
|
16549 | if (!isTypedArray(value)) { return false; }
|
16550 | if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }
|
16551 | return tryTypedArrays(value);
|
16552 | };
|
16553 |
|
16554 |
|
16555 | }),
|
16556 |
|
16557 | "./node_modules/available-typed-arrays/index.js":
|
16558 |
|
16559 |
|
16560 |
|
16561 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
16562 |
|
16563 | "use strict";
|
16564 |
|
16565 |
|
16566 | var possibleNames = [
|
16567 | 'BigInt64Array',
|
16568 | 'BigUint64Array',
|
16569 | 'Float32Array',
|
16570 | 'Float64Array',
|
16571 | 'Int16Array',
|
16572 | 'Int32Array',
|
16573 | 'Int8Array',
|
16574 | 'Uint16Array',
|
16575 | 'Uint32Array',
|
16576 | 'Uint8Array',
|
16577 | 'Uint8ClampedArray'
|
16578 | ];
|
16579 |
|
16580 | var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
|
16581 |
|
16582 | module.exports = function availableTypedArrays() {
|
16583 | var out = [];
|
16584 | for (var i = 0; i < possibleNames.length; i++) {
|
16585 | if (typeof g[possibleNames[i]] === 'function') {
|
16586 | out[out.length] = possibleNames[i];
|
16587 | }
|
16588 | }
|
16589 | return out;
|
16590 | };
|
16591 |
|
16592 |
|
16593 | }),
|
16594 |
|
16595 | "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js":
|
16596 |
|
16597 |
|
16598 |
|
16599 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
16600 |
|
16601 | "use strict";
|
16602 |
|
16603 |
|
16604 | var GetIntrinsic = __webpack_require__( "./node_modules/get-intrinsic/index.js");
|
16605 |
|
16606 | var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
16607 | if ($gOPD) {
|
16608 | try {
|
16609 | $gOPD([], 'length');
|
16610 | } catch (e) {
|
16611 |
|
16612 | $gOPD = null;
|
16613 | }
|
16614 | }
|
16615 |
|
16616 | module.exports = $gOPD;
|
16617 |
|
16618 |
|
16619 | }),
|
16620 |
|
16621 | "./node_modules/chai/index.mjs":
|
16622 |
|
16623 |
|
16624 |
|
16625 | ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
16626 |
|
16627 | "use strict";
|
16628 | __webpack_require__.r(__webpack_exports__);
|
16629 | __webpack_require__.d(__webpack_exports__, {
|
16630 | "expect": () => ( expect),
|
16631 | "version": () => ( version),
|
16632 | "Assertion": () => ( Assertion),
|
16633 | "AssertionError": () => ( AssertionError),
|
16634 | "util": () => ( util),
|
16635 | "config": () => ( config),
|
16636 | "use": () => ( use),
|
16637 | "should": () => ( should),
|
16638 | "assert": () => ( assert),
|
16639 | "core": () => ( core),
|
16640 | "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
16641 | });
|
16642 | var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./node_modules/chai/index.js");
|
16643 |
|
16644 |
|
16645 | const expect = _index_js__WEBPACK_IMPORTED_MODULE_0__.expect;
|
16646 | const version = _index_js__WEBPACK_IMPORTED_MODULE_0__.version;
|
16647 | const Assertion = _index_js__WEBPACK_IMPORTED_MODULE_0__.Assertion;
|
16648 | const AssertionError = _index_js__WEBPACK_IMPORTED_MODULE_0__.AssertionError;
|
16649 | const util = _index_js__WEBPACK_IMPORTED_MODULE_0__.util;
|
16650 | const config = _index_js__WEBPACK_IMPORTED_MODULE_0__.config;
|
16651 | const use = _index_js__WEBPACK_IMPORTED_MODULE_0__.use;
|
16652 | const should = _index_js__WEBPACK_IMPORTED_MODULE_0__.should;
|
16653 | const assert = _index_js__WEBPACK_IMPORTED_MODULE_0__.assert;
|
16654 | const core = _index_js__WEBPACK_IMPORTED_MODULE_0__.core;
|
16655 |
|
16656 | const __WEBPACK_DEFAULT_EXPORT__ = (_index_js__WEBPACK_IMPORTED_MODULE_0__);
|
16657 |
|
16658 |
|
16659 | })
|
16660 |
|
16661 | });
|
16662 |
|
16663 |
|
16664 | var __webpack_module_cache__ = {};
|
16665 |
|
16666 |
|
16667 | function __webpack_require__(moduleId) {
|
16668 |
|
16669 | var cachedModule = __webpack_module_cache__[moduleId];
|
16670 | if (cachedModule !== undefined) {
|
16671 | return cachedModule.exports;
|
16672 | }
|
16673 |
|
16674 | var module = __webpack_module_cache__[moduleId] = {
|
16675 |
|
16676 |
|
16677 | exports: {}
|
16678 | };
|
16679 |
|
16680 |
|
16681 | __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
16682 |
|
16683 |
|
16684 | return module.exports;
|
16685 | }
|
16686 |
|
16687 |
|
16688 |
|
16689 | (() => {
|
16690 |
|
16691 | __webpack_require__.n = (module) => {
|
16692 | var getter = module && module.__esModule ?
|
16693 | () => (module['default']) :
|
16694 | () => (module);
|
16695 | __webpack_require__.d(getter, { a: getter });
|
16696 | return getter;
|
16697 | };
|
16698 | })();
|
16699 |
|
16700 |
|
16701 | (() => {
|
16702 |
|
16703 | __webpack_require__.d = (exports, definition) => {
|
16704 | for(var key in definition) {
|
16705 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
16706 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
16707 | }
|
16708 | }
|
16709 | };
|
16710 | })();
|
16711 |
|
16712 |
|
16713 | (() => {
|
16714 | __webpack_require__.g = (function() {
|
16715 | if (typeof globalThis === 'object') return globalThis;
|
16716 | try {
|
16717 | return this || new Function('return this')();
|
16718 | } catch (e) {
|
16719 | if (typeof window === 'object') return window;
|
16720 | }
|
16721 | })();
|
16722 | })();
|
16723 |
|
16724 |
|
16725 | (() => {
|
16726 | __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
16727 | })();
|
16728 |
|
16729 |
|
16730 | (() => {
|
16731 |
|
16732 | __webpack_require__.r = (exports) => {
|
16733 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
16734 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
16735 | }
|
16736 | Object.defineProperty(exports, '__esModule', { value: true });
|
16737 | };
|
16738 | })();
|
16739 |
|
16740 |
|
16741 | var __webpack_exports__ = {};
|
16742 |
|
16743 | (() => {
|
16744 | "use strict";
|
16745 |
|
16746 |
|
16747 |
|
16748 | __webpack_require__.r(__webpack_exports__);
|
16749 | var _pointer_spec__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/__tests__/pointer.spec.ts");
|
16750 | var _ptr_spec__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/__tests__/ptr.spec.ts");
|
16751 | var _reference_spec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./src/__tests__/reference.spec.ts");
|
16752 | var _utils_spec__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./src/__tests__/utils.spec.ts");
|
16753 |
|
16754 |
|
16755 |
|
16756 |
|
16757 |
|
16758 | })();
|
16759 |
|
16760 | })()
|
16761 | ;
|
16762 |
|
\ | No newline at end of file |