@pie-element/fraction-model 5.0.0-next.42 → 5.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1184 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- /** Used for built-in method references. */
4
-
5
- var objectProto$6 = Object.prototype;
6
-
7
- /**
8
- * Checks if `value` is likely a prototype object.
9
- *
10
- * @private
11
- * @param {*} value The value to check.
12
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
13
- */
14
- function isPrototype$2(value) {
15
- var Ctor = value && value.constructor,
16
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
17
-
18
- return value === proto;
19
- }
20
-
21
- var _isPrototype = isPrototype$2;
22
-
23
- /**
24
- * Creates a unary function that invokes `func` with its argument transformed.
25
- *
26
- * @private
27
- * @param {Function} func The function to wrap.
28
- * @param {Function} transform The argument transform.
29
- * @returns {Function} Returns the new function.
30
- */
31
-
32
- function overArg$1(func, transform) {
33
- return function(arg) {
34
- return func(transform(arg));
35
- };
36
- }
37
-
38
- var _overArg = overArg$1;
39
-
40
- var overArg = _overArg;
41
-
42
- /* Built-in method references for those with the same name as other `lodash` methods. */
43
- var nativeKeys$1 = overArg(Object.keys, Object);
44
-
45
- var _nativeKeys = nativeKeys$1;
46
-
47
- var isPrototype$1 = _isPrototype,
48
- nativeKeys = _nativeKeys;
49
-
50
- /** Used for built-in method references. */
51
- var objectProto$5 = Object.prototype;
52
-
53
- /** Used to check objects for own properties. */
54
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
55
-
56
- /**
57
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
58
- *
59
- * @private
60
- * @param {Object} object The object to query.
61
- * @returns {Array} Returns the array of property names.
62
- */
63
- function baseKeys$1(object) {
64
- if (!isPrototype$1(object)) {
65
- return nativeKeys(object);
66
- }
67
- var result = [];
68
- for (var key in Object(object)) {
69
- if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
70
- result.push(key);
71
- }
72
- }
73
- return result;
74
- }
75
-
76
- var _baseKeys = baseKeys$1;
77
-
78
- /** Detect free variable `global` from Node.js. */
79
-
80
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
81
-
82
- var _freeGlobal = freeGlobal$1;
83
-
84
- var freeGlobal = _freeGlobal;
85
-
86
- /** Detect free variable `self`. */
87
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
88
-
89
- /** Used as a reference to the global object. */
90
- var root$7 = freeGlobal || freeSelf || Function('return this')();
91
-
92
- var _root = root$7;
93
-
94
- var root$6 = _root;
95
-
96
- /** Built-in value references. */
97
- var Symbol$2 = root$6.Symbol;
98
-
99
- var _Symbol = Symbol$2;
100
-
101
- var Symbol$1 = _Symbol;
102
-
103
- /** Used for built-in method references. */
104
- var objectProto$4 = Object.prototype;
105
-
106
- /** Used to check objects for own properties. */
107
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
108
-
109
- /**
110
- * Used to resolve the
111
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
112
- * of values.
113
- */
114
- var nativeObjectToString$1 = objectProto$4.toString;
115
-
116
- /** Built-in value references. */
117
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
118
-
119
- /**
120
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
121
- *
122
- * @private
123
- * @param {*} value The value to query.
124
- * @returns {string} Returns the raw `toStringTag`.
125
- */
126
- function getRawTag$1(value) {
127
- var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
128
- tag = value[symToStringTag$1];
129
-
130
- try {
131
- value[symToStringTag$1] = undefined;
132
- var unmasked = true;
133
- } catch (e) {}
134
-
135
- var result = nativeObjectToString$1.call(value);
136
- if (unmasked) {
137
- if (isOwn) {
138
- value[symToStringTag$1] = tag;
139
- } else {
140
- delete value[symToStringTag$1];
141
- }
142
- }
143
- return result;
144
- }
145
-
146
- var _getRawTag = getRawTag$1;
147
-
148
- /** Used for built-in method references. */
149
-
150
- var objectProto$3 = Object.prototype;
151
-
152
- /**
153
- * Used to resolve the
154
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
155
- * of values.
156
- */
157
- var nativeObjectToString = objectProto$3.toString;
158
-
159
- /**
160
- * Converts `value` to a string using `Object.prototype.toString`.
161
- *
162
- * @private
163
- * @param {*} value The value to convert.
164
- * @returns {string} Returns the converted string.
165
- */
166
- function objectToString$1(value) {
167
- return nativeObjectToString.call(value);
168
- }
169
-
170
- var _objectToString = objectToString$1;
171
-
172
- var Symbol = _Symbol,
173
- getRawTag = _getRawTag,
174
- objectToString = _objectToString;
175
-
176
- /** `Object#toString` result references. */
177
- var nullTag = '[object Null]',
178
- undefinedTag = '[object Undefined]';
179
-
180
- /** Built-in value references. */
181
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
182
-
183
- /**
184
- * The base implementation of `getTag` without fallbacks for buggy environments.
185
- *
186
- * @private
187
- * @param {*} value The value to query.
188
- * @returns {string} Returns the `toStringTag`.
189
- */
190
- function baseGetTag$4(value) {
191
- if (value == null) {
192
- return value === undefined ? undefinedTag : nullTag;
193
- }
194
- return (symToStringTag && symToStringTag in Object(value))
195
- ? getRawTag(value)
196
- : objectToString(value);
197
- }
198
-
199
- var _baseGetTag = baseGetTag$4;
200
-
201
- /**
202
- * Checks if `value` is the
203
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
204
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
205
- *
206
- * @static
207
- * @memberOf _
208
- * @since 0.1.0
209
- * @category Lang
210
- * @param {*} value The value to check.
211
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
212
- * @example
213
- *
214
- * _.isObject({});
215
- * // => true
216
- *
217
- * _.isObject([1, 2, 3]);
218
- * // => true
219
- *
220
- * _.isObject(_.noop);
221
- * // => true
222
- *
223
- * _.isObject(null);
224
- * // => false
225
- */
226
-
227
- function isObject$2(value) {
228
- var type = typeof value;
229
- return value != null && (type == 'object' || type == 'function');
230
- }
231
-
232
- var isObject_1 = isObject$2;
233
-
234
- var baseGetTag$3 = _baseGetTag,
235
- isObject$1 = isObject_1;
236
-
237
- /** `Object#toString` result references. */
238
- var asyncTag = '[object AsyncFunction]',
239
- funcTag$1 = '[object Function]',
240
- genTag = '[object GeneratorFunction]',
241
- proxyTag = '[object Proxy]';
242
-
243
- /**
244
- * Checks if `value` is classified as a `Function` object.
245
- *
246
- * @static
247
- * @memberOf _
248
- * @since 0.1.0
249
- * @category Lang
250
- * @param {*} value The value to check.
251
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
252
- * @example
253
- *
254
- * _.isFunction(_);
255
- * // => true
256
- *
257
- * _.isFunction(/abc/);
258
- * // => false
259
- */
260
- function isFunction$2(value) {
261
- if (!isObject$1(value)) {
262
- return false;
263
- }
264
- // The use of `Object#toString` avoids issues with the `typeof` operator
265
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
266
- var tag = baseGetTag$3(value);
267
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
268
- }
269
-
270
- var isFunction_1 = isFunction$2;
271
-
272
- var root$5 = _root;
273
-
274
- /** Used to detect overreaching core-js shims. */
275
- var coreJsData$1 = root$5['__core-js_shared__'];
276
-
277
- var _coreJsData = coreJsData$1;
278
-
279
- var coreJsData = _coreJsData;
280
-
281
- /** Used to detect methods masquerading as native. */
282
- var maskSrcKey = (function() {
283
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
284
- return uid ? ('Symbol(src)_1.' + uid) : '';
285
- }());
286
-
287
- /**
288
- * Checks if `func` has its source masked.
289
- *
290
- * @private
291
- * @param {Function} func The function to check.
292
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
293
- */
294
- function isMasked$1(func) {
295
- return !!maskSrcKey && (maskSrcKey in func);
296
- }
297
-
298
- var _isMasked = isMasked$1;
299
-
300
- /** Used for built-in method references. */
301
-
302
- var funcProto$1 = Function.prototype;
303
-
304
- /** Used to resolve the decompiled source of functions. */
305
- var funcToString$1 = funcProto$1.toString;
306
-
307
- /**
308
- * Converts `func` to its source code.
309
- *
310
- * @private
311
- * @param {Function} func The function to convert.
312
- * @returns {string} Returns the source code.
313
- */
314
- function toSource$2(func) {
315
- if (func != null) {
316
- try {
317
- return funcToString$1.call(func);
318
- } catch (e) {}
319
- try {
320
- return (func + '');
321
- } catch (e) {}
322
- }
323
- return '';
324
- }
325
-
326
- var _toSource = toSource$2;
327
-
328
- var isFunction$1 = isFunction_1,
329
- isMasked = _isMasked,
330
- isObject = isObject_1,
331
- toSource$1 = _toSource;
332
-
333
- /**
334
- * Used to match `RegExp`
335
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
336
- */
337
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
338
-
339
- /** Used to detect host constructors (Safari). */
340
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
341
-
342
- /** Used for built-in method references. */
343
- var funcProto = Function.prototype,
344
- objectProto$2 = Object.prototype;
345
-
346
- /** Used to resolve the decompiled source of functions. */
347
- var funcToString = funcProto.toString;
348
-
349
- /** Used to check objects for own properties. */
350
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
351
-
352
- /** Used to detect if a method is native. */
353
- var reIsNative = RegExp('^' +
354
- funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
355
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
356
- );
357
-
358
- /**
359
- * The base implementation of `_.isNative` without bad shim checks.
360
- *
361
- * @private
362
- * @param {*} value The value to check.
363
- * @returns {boolean} Returns `true` if `value` is a native function,
364
- * else `false`.
365
- */
366
- function baseIsNative$1(value) {
367
- if (!isObject(value) || isMasked(value)) {
368
- return false;
369
- }
370
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
371
- return pattern.test(toSource$1(value));
372
- }
373
-
374
- var _baseIsNative = baseIsNative$1;
375
-
376
- /**
377
- * Gets the value at `key` of `object`.
378
- *
379
- * @private
380
- * @param {Object} [object] The object to query.
381
- * @param {string} key The key of the property to get.
382
- * @returns {*} Returns the property value.
383
- */
384
-
385
- function getValue$1(object, key) {
386
- return object == null ? undefined : object[key];
387
- }
388
-
389
- var _getValue = getValue$1;
390
-
391
- var baseIsNative = _baseIsNative,
392
- getValue = _getValue;
393
-
394
- /**
395
- * Gets the native function at `key` of `object`.
396
- *
397
- * @private
398
- * @param {Object} object The object to query.
399
- * @param {string} key The key of the method to get.
400
- * @returns {*} Returns the function if it's native, else `undefined`.
401
- */
402
- function getNative$5(object, key) {
403
- var value = getValue(object, key);
404
- return baseIsNative(value) ? value : undefined;
405
- }
406
-
407
- var _getNative = getNative$5;
408
-
409
- var getNative$4 = _getNative,
410
- root$4 = _root;
411
-
412
- /* Built-in method references that are verified to be native. */
413
- var DataView$1 = getNative$4(root$4, 'DataView');
414
-
415
- var _DataView = DataView$1;
416
-
417
- var getNative$3 = _getNative,
418
- root$3 = _root;
419
-
420
- /* Built-in method references that are verified to be native. */
421
- var Map$1 = getNative$3(root$3, 'Map');
422
-
423
- var _Map = Map$1;
424
-
425
- var getNative$2 = _getNative,
426
- root$2 = _root;
427
-
428
- /* Built-in method references that are verified to be native. */
429
- var Promise$2 = getNative$2(root$2, 'Promise');
430
-
431
- var _Promise = Promise$2;
432
-
433
- var getNative$1 = _getNative,
434
- root$1 = _root;
435
-
436
- /* Built-in method references that are verified to be native. */
437
- var Set$1 = getNative$1(root$1, 'Set');
438
-
439
- var _Set = Set$1;
440
-
441
- var getNative = _getNative,
442
- root = _root;
443
-
444
- /* Built-in method references that are verified to be native. */
445
- var WeakMap$1 = getNative(root, 'WeakMap');
446
-
447
- var _WeakMap = WeakMap$1;
448
-
449
- var DataView = _DataView,
450
- Map = _Map,
451
- Promise$1 = _Promise,
452
- Set = _Set,
453
- WeakMap = _WeakMap,
454
- baseGetTag$2 = _baseGetTag,
455
- toSource = _toSource;
456
-
457
- /** `Object#toString` result references. */
458
- var mapTag$2 = '[object Map]',
459
- objectTag$1 = '[object Object]',
460
- promiseTag = '[object Promise]',
461
- setTag$2 = '[object Set]',
462
- weakMapTag$1 = '[object WeakMap]';
463
-
464
- var dataViewTag$1 = '[object DataView]';
465
-
466
- /** Used to detect maps, sets, and weakmaps. */
467
- var dataViewCtorString = toSource(DataView),
468
- mapCtorString = toSource(Map),
469
- promiseCtorString = toSource(Promise$1),
470
- setCtorString = toSource(Set),
471
- weakMapCtorString = toSource(WeakMap);
472
-
473
- /**
474
- * Gets the `toStringTag` of `value`.
475
- *
476
- * @private
477
- * @param {*} value The value to query.
478
- * @returns {string} Returns the `toStringTag`.
479
- */
480
- var getTag$1 = baseGetTag$2;
481
-
482
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
483
- if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
484
- (Map && getTag$1(new Map) != mapTag$2) ||
485
- (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
486
- (Set && getTag$1(new Set) != setTag$2) ||
487
- (WeakMap && getTag$1(new WeakMap) != weakMapTag$1)) {
488
- getTag$1 = function(value) {
489
- var result = baseGetTag$2(value),
490
- Ctor = result == objectTag$1 ? value.constructor : undefined,
491
- ctorString = Ctor ? toSource(Ctor) : '';
492
-
493
- if (ctorString) {
494
- switch (ctorString) {
495
- case dataViewCtorString: return dataViewTag$1;
496
- case mapCtorString: return mapTag$2;
497
- case promiseCtorString: return promiseTag;
498
- case setCtorString: return setTag$2;
499
- case weakMapCtorString: return weakMapTag$1;
500
- }
501
- }
502
- return result;
503
- };
504
- }
505
-
506
- var _getTag = getTag$1;
507
-
508
- /**
509
- * Checks if `value` is object-like. A value is object-like if it's not `null`
510
- * and has a `typeof` result of "object".
511
- *
512
- * @static
513
- * @memberOf _
514
- * @since 4.0.0
515
- * @category Lang
516
- * @param {*} value The value to check.
517
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
518
- * @example
519
- *
520
- * _.isObjectLike({});
521
- * // => true
522
- *
523
- * _.isObjectLike([1, 2, 3]);
524
- * // => true
525
- *
526
- * _.isObjectLike(_.noop);
527
- * // => false
528
- *
529
- * _.isObjectLike(null);
530
- * // => false
531
- */
532
-
533
- function isObjectLike$3(value) {
534
- return value != null && typeof value == 'object';
535
- }
536
-
537
- var isObjectLike_1 = isObjectLike$3;
538
-
539
- var baseGetTag$1 = _baseGetTag,
540
- isObjectLike$2 = isObjectLike_1;
541
-
542
- /** `Object#toString` result references. */
543
- var argsTag$1 = '[object Arguments]';
544
-
545
- /**
546
- * The base implementation of `_.isArguments`.
547
- *
548
- * @private
549
- * @param {*} value The value to check.
550
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
551
- */
552
- function baseIsArguments$1(value) {
553
- return isObjectLike$2(value) && baseGetTag$1(value) == argsTag$1;
554
- }
555
-
556
- var _baseIsArguments = baseIsArguments$1;
557
-
558
- var baseIsArguments = _baseIsArguments,
559
- isObjectLike$1 = isObjectLike_1;
560
-
561
- /** Used for built-in method references. */
562
- var objectProto$1 = Object.prototype;
563
-
564
- /** Used to check objects for own properties. */
565
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
566
-
567
- /** Built-in value references. */
568
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
569
-
570
- /**
571
- * Checks if `value` is likely an `arguments` object.
572
- *
573
- * @static
574
- * @memberOf _
575
- * @since 0.1.0
576
- * @category Lang
577
- * @param {*} value The value to check.
578
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
579
- * else `false`.
580
- * @example
581
- *
582
- * _.isArguments(function() { return arguments; }());
583
- * // => true
584
- *
585
- * _.isArguments([1, 2, 3]);
586
- * // => false
587
- */
588
- var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
589
- return isObjectLike$1(value) && hasOwnProperty$1.call(value, 'callee') &&
590
- !propertyIsEnumerable.call(value, 'callee');
591
- };
592
-
593
- var isArguments_1 = isArguments$1;
594
-
595
- /**
596
- * Checks if `value` is classified as an `Array` object.
597
- *
598
- * @static
599
- * @memberOf _
600
- * @since 0.1.0
601
- * @category Lang
602
- * @param {*} value The value to check.
603
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
604
- * @example
605
- *
606
- * _.isArray([1, 2, 3]);
607
- * // => true
608
- *
609
- * _.isArray(document.body.children);
610
- * // => false
611
- *
612
- * _.isArray('abc');
613
- * // => false
614
- *
615
- * _.isArray(_.noop);
616
- * // => false
617
- */
618
-
619
- var isArray$1 = Array.isArray;
620
-
621
- var isArray_1 = isArray$1;
622
-
623
- /** Used as references for various `Number` constants. */
624
-
625
- var MAX_SAFE_INTEGER = 9007199254740991;
626
-
627
- /**
628
- * Checks if `value` is a valid array-like length.
629
- *
630
- * **Note:** This method is loosely based on
631
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
632
- *
633
- * @static
634
- * @memberOf _
635
- * @since 4.0.0
636
- * @category Lang
637
- * @param {*} value The value to check.
638
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
639
- * @example
640
- *
641
- * _.isLength(3);
642
- * // => true
643
- *
644
- * _.isLength(Number.MIN_VALUE);
645
- * // => false
646
- *
647
- * _.isLength(Infinity);
648
- * // => false
649
- *
650
- * _.isLength('3');
651
- * // => false
652
- */
653
- function isLength$2(value) {
654
- return typeof value == 'number' &&
655
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
656
- }
657
-
658
- var isLength_1 = isLength$2;
659
-
660
- var isFunction = isFunction_1,
661
- isLength$1 = isLength_1;
662
-
663
- /**
664
- * Checks if `value` is array-like. A value is considered array-like if it's
665
- * not a function and has a `value.length` that's an integer greater than or
666
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
667
- *
668
- * @static
669
- * @memberOf _
670
- * @since 4.0.0
671
- * @category Lang
672
- * @param {*} value The value to check.
673
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
674
- * @example
675
- *
676
- * _.isArrayLike([1, 2, 3]);
677
- * // => true
678
- *
679
- * _.isArrayLike(document.body.children);
680
- * // => true
681
- *
682
- * _.isArrayLike('abc');
683
- * // => true
684
- *
685
- * _.isArrayLike(_.noop);
686
- * // => false
687
- */
688
- function isArrayLike$1(value) {
689
- return value != null && isLength$1(value.length) && !isFunction(value);
690
- }
691
-
692
- var isArrayLike_1 = isArrayLike$1;
693
-
694
- var isBuffer$1 = {exports: {}};
695
-
696
- /**
697
- * This method returns `false`.
698
- *
699
- * @static
700
- * @memberOf _
701
- * @since 4.13.0
702
- * @category Util
703
- * @returns {boolean} Returns `false`.
704
- * @example
705
- *
706
- * _.times(2, _.stubFalse);
707
- * // => [false, false]
708
- */
709
-
710
- function stubFalse() {
711
- return false;
712
- }
713
-
714
- var stubFalse_1 = stubFalse;
715
-
716
- (function (module, exports) {
717
- var root = _root,
718
- stubFalse = stubFalse_1;
719
-
720
- /** Detect free variable `exports`. */
721
- var freeExports = exports && !exports.nodeType && exports;
722
-
723
- /** Detect free variable `module`. */
724
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
725
-
726
- /** Detect the popular CommonJS extension `module.exports`. */
727
- var moduleExports = freeModule && freeModule.exports === freeExports;
728
-
729
- /** Built-in value references. */
730
- var Buffer = moduleExports ? root.Buffer : undefined;
731
-
732
- /* Built-in method references for those with the same name as other `lodash` methods. */
733
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
734
-
735
- /**
736
- * Checks if `value` is a buffer.
737
- *
738
- * @static
739
- * @memberOf _
740
- * @since 4.3.0
741
- * @category Lang
742
- * @param {*} value The value to check.
743
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
744
- * @example
745
- *
746
- * _.isBuffer(new Buffer(2));
747
- * // => true
748
- *
749
- * _.isBuffer(new Uint8Array(2));
750
- * // => false
751
- */
752
- var isBuffer = nativeIsBuffer || stubFalse;
753
-
754
- module.exports = isBuffer;
755
- }(isBuffer$1, isBuffer$1.exports));
756
-
757
- var baseGetTag = _baseGetTag,
758
- isLength = isLength_1,
759
- isObjectLike = isObjectLike_1;
760
-
761
- /** `Object#toString` result references. */
762
- var argsTag = '[object Arguments]',
763
- arrayTag = '[object Array]',
764
- boolTag = '[object Boolean]',
765
- dateTag = '[object Date]',
766
- errorTag = '[object Error]',
767
- funcTag = '[object Function]',
768
- mapTag$1 = '[object Map]',
769
- numberTag = '[object Number]',
770
- objectTag = '[object Object]',
771
- regexpTag = '[object RegExp]',
772
- setTag$1 = '[object Set]',
773
- stringTag = '[object String]',
774
- weakMapTag = '[object WeakMap]';
775
-
776
- var arrayBufferTag = '[object ArrayBuffer]',
777
- dataViewTag = '[object DataView]',
778
- float32Tag = '[object Float32Array]',
779
- float64Tag = '[object Float64Array]',
780
- int8Tag = '[object Int8Array]',
781
- int16Tag = '[object Int16Array]',
782
- int32Tag = '[object Int32Array]',
783
- uint8Tag = '[object Uint8Array]',
784
- uint8ClampedTag = '[object Uint8ClampedArray]',
785
- uint16Tag = '[object Uint16Array]',
786
- uint32Tag = '[object Uint32Array]';
787
-
788
- /** Used to identify `toStringTag` values of typed arrays. */
789
- var typedArrayTags = {};
790
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
791
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
792
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
793
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
794
- typedArrayTags[uint32Tag] = true;
795
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
796
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
797
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
798
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
799
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
800
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
801
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
802
- typedArrayTags[weakMapTag] = false;
803
-
804
- /**
805
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
806
- *
807
- * @private
808
- * @param {*} value The value to check.
809
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
810
- */
811
- function baseIsTypedArray$1(value) {
812
- return isObjectLike(value) &&
813
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
814
- }
815
-
816
- var _baseIsTypedArray = baseIsTypedArray$1;
817
-
818
- /**
819
- * The base implementation of `_.unary` without support for storing metadata.
820
- *
821
- * @private
822
- * @param {Function} func The function to cap arguments for.
823
- * @returns {Function} Returns the new capped function.
824
- */
825
-
826
- function baseUnary$1(func) {
827
- return function(value) {
828
- return func(value);
829
- };
830
- }
831
-
832
- var _baseUnary = baseUnary$1;
833
-
834
- var _nodeUtil = {exports: {}};
835
-
836
- (function (module, exports) {
837
- var freeGlobal = _freeGlobal;
838
-
839
- /** Detect free variable `exports`. */
840
- var freeExports = exports && !exports.nodeType && exports;
841
-
842
- /** Detect free variable `module`. */
843
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
844
-
845
- /** Detect the popular CommonJS extension `module.exports`. */
846
- var moduleExports = freeModule && freeModule.exports === freeExports;
847
-
848
- /** Detect free variable `process` from Node.js. */
849
- var freeProcess = moduleExports && freeGlobal.process;
850
-
851
- /** Used to access faster Node.js helpers. */
852
- var nodeUtil = (function() {
853
- try {
854
- // Use `util.types` for Node.js 10+.
855
- var types = freeModule && freeModule.require && freeModule.require('util').types;
856
-
857
- if (types) {
858
- return types;
859
- }
860
-
861
- // Legacy `process.binding('util')` for Node.js < 10.
862
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
863
- } catch (e) {}
864
- }());
865
-
866
- module.exports = nodeUtil;
867
- }(_nodeUtil, _nodeUtil.exports));
868
-
869
- var baseIsTypedArray = _baseIsTypedArray,
870
- baseUnary = _baseUnary,
871
- nodeUtil = _nodeUtil.exports;
872
-
873
- /* Node.js helper references. */
874
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
875
-
876
- /**
877
- * Checks if `value` is classified as a typed array.
878
- *
879
- * @static
880
- * @memberOf _
881
- * @since 3.0.0
882
- * @category Lang
883
- * @param {*} value The value to check.
884
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
885
- * @example
886
- *
887
- * _.isTypedArray(new Uint8Array);
888
- * // => true
889
- *
890
- * _.isTypedArray([]);
891
- * // => false
892
- */
893
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
894
-
895
- var isTypedArray_1 = isTypedArray$1;
896
-
897
- var baseKeys = _baseKeys,
898
- getTag = _getTag,
899
- isArguments = isArguments_1,
900
- isArray = isArray_1,
901
- isArrayLike = isArrayLike_1,
902
- isBuffer = isBuffer$1.exports,
903
- isPrototype = _isPrototype,
904
- isTypedArray = isTypedArray_1;
905
-
906
- /** `Object#toString` result references. */
907
- var mapTag = '[object Map]',
908
- setTag = '[object Set]';
909
-
910
- /** Used for built-in method references. */
911
- var objectProto = Object.prototype;
912
-
913
- /** Used to check objects for own properties. */
914
- var hasOwnProperty = objectProto.hasOwnProperty;
915
-
916
- /**
917
- * Checks if `value` is an empty object, collection, map, or set.
918
- *
919
- * Objects are considered empty if they have no own enumerable string keyed
920
- * properties.
921
- *
922
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
923
- * jQuery-like collections are considered empty if they have a `length` of `0`.
924
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
925
- *
926
- * @static
927
- * @memberOf _
928
- * @since 0.1.0
929
- * @category Lang
930
- * @param {*} value The value to check.
931
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
932
- * @example
933
- *
934
- * _.isEmpty(null);
935
- * // => true
936
- *
937
- * _.isEmpty(true);
938
- * // => true
939
- *
940
- * _.isEmpty(1);
941
- * // => true
942
- *
943
- * _.isEmpty([1, 2, 3]);
944
- * // => false
945
- *
946
- * _.isEmpty({ 'a': 1 });
947
- * // => false
948
- */
949
- function isEmpty(value) {
950
- if (value == null) {
951
- return true;
952
- }
953
- if (isArrayLike(value) &&
954
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
955
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
956
- return !value.length;
957
- }
958
- var tag = getTag(value);
959
- if (tag == mapTag || tag == setTag) {
960
- return !value.size;
961
- }
962
- if (isPrototype(value)) {
963
- return !baseKeys(value).length;
964
- }
965
- for (var key in value) {
966
- if (hasOwnProperty.call(value, key)) {
967
- return false;
968
- }
969
- }
970
- return true;
971
- }
972
-
973
- var isEmpty_1 = isEmpty;
974
-
975
- // Should be exactly the same as configure/defaults.js
976
- var defaults = {
977
- model: {
978
- correctResponse: [],
979
- title: '',
980
- prompt: '',
981
- modelTypeSelected: 'bar',
982
- maxModelSelected: 1,
983
- partsPerModel: 5,
984
- allowedStudentConfig: false,
985
- showGraphLabels: false,
986
- },
987
- };
988
-
989
- /*
990
- * Function to check the correctness of the response
991
- * @param {model} model contains the model object
992
- * @param {answers} answers contains the answers object
993
- * @param {env} env contains the environment object
994
- * @returns {string} returns the correctness of the response
995
- * */
996
- const getResponseCorrectness = (model, answers, env = {}) => {
997
- let correct;
998
- if (model.allowedStudentConfig) {
999
- correct = !!(
1000
- answers.partsPerModel === model.partsPerModel &&
1001
- partialFillCheck(answers.response, model.partsPerModel) &&
1002
- numeratorCheck(model.correctResponse, answers.response)
1003
- );
1004
- } else {
1005
- correct = !!(
1006
- partialFillCheck(answers.response, model.partsPerModel) && numeratorCheck(model.correctResponse, answers.response)
1007
- );
1008
- }
1009
- return correct ? 'correct' : 'incorrect';
1010
- };
1011
-
1012
- /*
1013
- * Function to get the correctness of the response
1014
- * @param {question} question contains the question object
1015
- * @param {env} env contains the environment object
1016
- * @param {answers} answers contains the answers object
1017
- * @returns {string} returns the correctness
1018
- * */
1019
- const getCorrectness = (question, env, answers = {}) => {
1020
- if (env.mode === 'evaluate') {
1021
- return getResponseCorrectness(question, answers, env);
1022
- }
1023
- };
1024
-
1025
- /*
1026
- * Function to get the outcome score
1027
- * @param {question} question contains the question object
1028
- * @param {env} env contains the environment object
1029
- * @param {answers} answers contains the answers object
1030
- * @returns {number} returns the score
1031
- * */
1032
- const getOutComeScore = (question, env, answers = {}) => {
1033
- const correctness = getCorrectness(question, env, answers);
1034
- return correctness === 'correct' ? 1 : 0;
1035
- };
1036
-
1037
- /*
1038
- * Function to check outcome of the session
1039
- * @param {model} model contains the model object
1040
- * @param {session} session contains the session object
1041
- * @param {env} env contains the environment object
1042
- * @returns {Promise} returns the score
1043
- */
1044
- const outcome = (model, session, env) =>
1045
- new Promise((resolve) => {
1046
- if (!session || isEmpty_1(session)) {
1047
- resolve({ score: 0, empty: true });
1048
- } else {
1049
- if (env.mode !== 'evaluate') {
1050
- resolve({ score: undefined, completed: undefined });
1051
- } else {
1052
- resolve({ score: getOutComeScore(model, env, session.answers) });
1053
- }
1054
- }
1055
- });
1056
-
1057
- /*
1058
- * Function to check if the numerator of the response matches the numerator of the correct response
1059
- * @param {correctResponse} correctResponse contains the correct response object
1060
- * @param {response} response contains the response object
1061
- * @returns {boolean} returns true if the numerators match
1062
- * */
1063
- const numeratorCheck = (correctResponse, response) => {
1064
- let correctNumerator = 0;
1065
- let responseNumerator = 0;
1066
- for (let i = 0; i < correctResponse.length; i++) {
1067
- correctNumerator += correctResponse[i].value;
1068
- }
1069
- for (let i = 0; i < response.length; i++) {
1070
- responseNumerator += response[i].value;
1071
- }
1072
- return correctNumerator === responseNumerator;
1073
- };
1074
-
1075
- /*
1076
- * Function to check if the response contains more than one partially-filled model
1077
- * @param {response} response contains the response object
1078
- * @param {partsPerModel} partsPerModel contains the number of parts per model
1079
- * */
1080
- const partialFillCheck = (response, partsPerModel) => {
1081
- if (response.length > 0) {
1082
- let partialModelCount = 0;
1083
- response.forEach((selection) => {
1084
- if (selection.value !== partsPerModel) {
1085
- partialModelCount++;
1086
- }
1087
- });
1088
- return partialModelCount <= 1;
1089
- } else {
1090
- return false;
1091
- }
1092
- };
1093
-
1094
- /*
1095
- * Function to create a default model
1096
- * @param {model} model contains the model object
1097
- * */
1098
- const createDefaultModel = (model = {}) => ({
1099
- ...defaults.model,
1100
- ...model,
1101
- });
1102
-
1103
- /*
1104
- * Return the model object
1105
- * */
1106
- const model = (question, session, env) => {
1107
- return new Promise((resolve) => {
1108
- session = session || {};
1109
- const model = createDefaultModel(question);
1110
- let correctness, score;
1111
- if ((!session || isEmpty_1(session)) && env.mode === 'evaluate') {
1112
- correctness = 'unanswered';
1113
- score = '0%';
1114
- } else {
1115
- correctness = getCorrectness(model, env, session && session.answers);
1116
- score = `${getOutComeScore(model, env, session && session.answers) * 100}%`;
1117
- }
1118
- const correctInfo = {
1119
- score,
1120
- correctness,
1121
- };
1122
- const out = {
1123
- env,
1124
- ...model,
1125
- view: env.mode === 'view' || env.mode === 'evaluate',
1126
- };
1127
- if (env.mode === 'evaluate') {
1128
- Object.assign(out, {
1129
- correctness: correctInfo,
1130
- });
1131
- }
1132
- resolve(out);
1133
- });
1134
- };
1135
-
1136
- /*
1137
- * Function to create a correct response session
1138
- * @param {model} model contains the model object
1139
- * @param {env} env contains the environment object
1140
- * @returns {Promise} returns the correct response session
1141
- * */
1142
- const createCorrectResponseSession = (model, env) => {
1143
- return new Promise((resolve) => {
1144
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
1145
- const { correctResponse, maxModelSelected, partsPerModel } = model;
1146
- resolve({
1147
- answers: {
1148
- response: correctResponse,
1149
- noOfModel: maxModelSelected,
1150
- partsPerModel,
1151
- },
1152
- id: '1',
1153
- });
1154
- } else {
1155
- resolve(null);
1156
- }
1157
- });
1158
- };
1159
-
1160
- /*
1161
- * Function to validate the model
1162
- * @param {model} model contains the model object
1163
- * @param {config} config contains the config object
1164
- * */
1165
- const validate = (model = {}, config = {}) => {
1166
- const errors = {};
1167
- if (model.correctResponse.length === 0) {
1168
- errors.correctResponse = 'To save the item, at least one section must be marked as correct.';
1169
- }
1170
- if (model.correctResponse.length > 0) {
1171
- let partialModelCount = 0;
1172
- model.correctResponse.forEach((selection) => {
1173
- if (selection.value !== model.partsPerModel) {
1174
- partialModelCount++;
1175
- }
1176
- });
1177
- if (partialModelCount > 1) {
1178
- errors.correctResponse = 'The correct answer should include no more than one partially-filled model';
1179
- }
1180
- }
1181
- return errors;
1182
- };
1183
-
1184
- export { createCorrectResponseSession, createDefaultModel, getResponseCorrectness, model, outcome, validate };