fable 3.0.20 → 3.0.21
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.
- package/dist/fable.compatible.js +648 -143
- package/dist/fable.compatible.min.js +19 -14
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +576 -119
- package/dist/fable.min.js +19 -14
- package/dist/fable.min.js.map +1 -1
- package/package.json +2 -1
- package/source/Fable-Service-DataArithmatic.js +16 -0
- package/source/{Fable-Utility.js → Fable-Service-Utility.js} +16 -4
- package/source/Fable.js +14 -4
- package/test/FableDataArithmatic_tests.js +223 -0
- package/test/Fable_tests.js +0 -1
package/dist/fable.compatible.js
CHANGED
|
@@ -297,7 +297,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
297
297
|
}).call(this);
|
|
298
298
|
}).call(this, require("timers").setImmediate);
|
|
299
299
|
}, {
|
|
300
|
-
"timers":
|
|
300
|
+
"timers": 34
|
|
301
301
|
}],
|
|
302
302
|
14: [function (require, module, exports) {
|
|
303
303
|
'use strict';
|
|
@@ -348,6 +348,462 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
348
348
|
}],
|
|
349
349
|
16: [function (require, module, exports) {}, {}],
|
|
350
350
|
17: [function (require, module, exports) {
|
|
351
|
+
/**
|
|
352
|
+
* @license MIT
|
|
353
|
+
* @author <steven@velozo.com>
|
|
354
|
+
*/
|
|
355
|
+
/**
|
|
356
|
+
* Data Arithmatic
|
|
357
|
+
*
|
|
358
|
+
* @class DataArithmatic
|
|
359
|
+
*/
|
|
360
|
+
var DataArithmatic = /*#__PURE__*/function () {
|
|
361
|
+
function DataArithmatic() {
|
|
362
|
+
_classCallCheck(this, DataArithmatic);
|
|
363
|
+
// Regular Expressions (so they don't have to be recompiled every time)
|
|
364
|
+
// These could be defined as static, but I'm not sure if that will work with browserify ... and specifically the QT browser.
|
|
365
|
+
this._Regex_formatterInsertCommas = /.{1,3}/g;
|
|
366
|
+
// Match Function:
|
|
367
|
+
// function(pMatch, pSign, pZeros, pBefore, pDecimal, pAfter)
|
|
368
|
+
// Thoughts about below: /^([+-]?)(0*)(\d+)(\.(\d+))?$/;
|
|
369
|
+
this._Regex_formatterAddCommasToNumber = /^([-+]?)(0?)(\d+)(.?)(\d+)$/g;
|
|
370
|
+
this._Regex_formatterDollarsRemoveCommas = /,/gi;
|
|
371
|
+
this._Regex_formatterCleanNonAlpha = /[^a-z0-9]/gi;
|
|
372
|
+
|
|
373
|
+
// TODO: Potentially pull these in from a configuration.
|
|
374
|
+
// TODO: Use locale data for this if it's defaults all the way down.
|
|
375
|
+
this._Value_MoneySign_Currency = '$';
|
|
376
|
+
this._Value_NaN_Currency = '--';
|
|
377
|
+
this._Value_GroupSeparator_Number = ',';
|
|
378
|
+
this._Value_Prefix_StringHash = 'HSH';
|
|
379
|
+
this._Value_Clean_formatterCleanNonAlpha = '_';
|
|
380
|
+
this._UseEngineStringStartsWith = typeof String.prototype.startsWith === 'function';
|
|
381
|
+
this._UseEngineStringEndsWith = typeof String.prototype.endsWith === 'function';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/*************************************************************************
|
|
385
|
+
* String Manipulation and Comparison Functions
|
|
386
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Reverse a string
|
|
390
|
+
*
|
|
391
|
+
* @param {string} pString - The string to reverse
|
|
392
|
+
* @returns {string}
|
|
393
|
+
*/
|
|
394
|
+
_createClass(DataArithmatic, [{
|
|
395
|
+
key: "stringReverse",
|
|
396
|
+
value: function stringReverse(pString) {
|
|
397
|
+
// TODO: Benchmark if there are faster ways we want to do this with all the newer JS stuff
|
|
398
|
+
// ... and if it will work with browserify in a clean way.
|
|
399
|
+
return pString.split('').reverse().join('');
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Test if a string starts with a given substring.
|
|
404
|
+
*
|
|
405
|
+
* @param {*} pString
|
|
406
|
+
* @param {*} pSearchString
|
|
407
|
+
* @param {*} pStartIndex
|
|
408
|
+
* @returns {*}
|
|
409
|
+
*/
|
|
410
|
+
}, {
|
|
411
|
+
key: "stringStartsWith",
|
|
412
|
+
value: function stringStartsWith(pString, pSearchString, pStartIndex) {
|
|
413
|
+
if (this._UseEngineStringStartsWith) {
|
|
414
|
+
return pString.startsWith(pSearchString, pStartIndex);
|
|
415
|
+
} else {
|
|
416
|
+
return this.stringStartsWith_Polyfill.call(pString, pSearchString, pStartIndex);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Check if a string starts with a given substring. This is a safe polyfill for the ES6 string.startsWith() function.
|
|
422
|
+
*
|
|
423
|
+
* @param {*} pSearchString - The string to search for
|
|
424
|
+
* @param {*} pStartIndex - The index to start the search at
|
|
425
|
+
* @returns {boolean}
|
|
426
|
+
*/
|
|
427
|
+
}, {
|
|
428
|
+
key: "stringStartsWith_Polyfill",
|
|
429
|
+
value: function stringStartsWith_Polyfill(pSearchString, pStartIndex) {
|
|
430
|
+
return this.slice(pStartIndex || 0, pSearchString.length) === pSearchString;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Test if a string starts with a given substring.
|
|
435
|
+
*
|
|
436
|
+
* @param {*} pString
|
|
437
|
+
* @param {*} pSearchString
|
|
438
|
+
* @param {*} pEndIndex
|
|
439
|
+
* @returns {*}
|
|
440
|
+
*/
|
|
441
|
+
}, {
|
|
442
|
+
key: "stringEndsWith",
|
|
443
|
+
value: function stringEndsWith(pString, pSearchString, pEndIndex) {
|
|
444
|
+
if (this._UseEngineStringEndsWith) {
|
|
445
|
+
return pString.endsWith(pSearchString, pEndIndex);
|
|
446
|
+
} else {
|
|
447
|
+
return this.stringEndsWith_Polyfill.call(pString, pSearchString, pEndIndex);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Check if a string starts with a given substring. This is a safe polyfill for the ES6 string.startsWith() function.
|
|
453
|
+
*
|
|
454
|
+
* @param {*} pSearchString - The string to search for
|
|
455
|
+
* @param {*} pEndIndex - The index to end the search at
|
|
456
|
+
* @returns {boolean}
|
|
457
|
+
*/
|
|
458
|
+
}, {
|
|
459
|
+
key: "stringEndsWith_Polyfill",
|
|
460
|
+
value: function stringEndsWith_Polyfill(pSearchString, pEndIndex) {
|
|
461
|
+
// This works much better than >= because
|
|
462
|
+
// it compensates for NaN:
|
|
463
|
+
if (!(pEndIndex < this.length)) {
|
|
464
|
+
pEndIndex = this.length;
|
|
465
|
+
} else {
|
|
466
|
+
pEndIndex |= 0; // round position
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return this.substr(pEndIndex - pSearchString.length, pSearchString.length) === pSearchString;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Generate an insecure string hash. Not meant to be secure, just a quick way to generate a hash for a string. This is not a cryptographic hash. Additional warranty and disclaimer ... this is not for passwords!
|
|
474
|
+
*
|
|
475
|
+
* @param {string} pString
|
|
476
|
+
* @returns {string}
|
|
477
|
+
*/
|
|
478
|
+
}, {
|
|
479
|
+
key: "insecureStringHash",
|
|
480
|
+
value: function insecureStringHash(pString) {
|
|
481
|
+
var tmpHash = 0;
|
|
482
|
+
var tmpStringLength = pString.length;
|
|
483
|
+
var tmpCharacterIndex = 0;
|
|
484
|
+
while (tmpCharacterIndex < tmpStringLength) {
|
|
485
|
+
tmpHash = (tmpHash << 5) - tmpHash + pString.charCodeAt(tmpCharacterIndex++) | 0;
|
|
486
|
+
}
|
|
487
|
+
return "".concat(this._Value_Prefix_StringHash).concat(tmpHash);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Clean wrapping characters if they exist consistently around the string. If they do not, the string is returned unchanged.
|
|
492
|
+
*
|
|
493
|
+
* @param {string} pWrapCharacter - The character expected as the wrapping character
|
|
494
|
+
* @param {string} pString - the string to clean
|
|
495
|
+
* @returns {string}
|
|
496
|
+
*/
|
|
497
|
+
}, {
|
|
498
|
+
key: "cleanEnclosureWrapCharacters",
|
|
499
|
+
value: function cleanEnclosureWrapCharacters(pWrapCharacter, pString) {
|
|
500
|
+
// # Use case from ManyFest DSL:
|
|
501
|
+
//
|
|
502
|
+
// When a boxed property is passed in, it should have quotes of some
|
|
503
|
+
// kind around it.
|
|
504
|
+
//
|
|
505
|
+
// For instance:
|
|
506
|
+
// MyValues['Name']
|
|
507
|
+
// MyValues["Age"]
|
|
508
|
+
// MyValues[`Cost`]
|
|
509
|
+
//
|
|
510
|
+
// This function is necessary to remove the wrapping quotes before object
|
|
511
|
+
// resolution can occur.
|
|
512
|
+
if (pString.startsWith(pWrapCharacter) && pString.endsWith(pWrapCharacter)) {
|
|
513
|
+
return pString.substring(1, pString.length - 1);
|
|
514
|
+
} else {
|
|
515
|
+
return pString;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
*
|
|
521
|
+
* @param {*} pString
|
|
522
|
+
* @returns
|
|
523
|
+
*/
|
|
524
|
+
}, {
|
|
525
|
+
key: "cleanNonAlphaCharacters",
|
|
526
|
+
value: function cleanNonAlphaCharacters(pString) {
|
|
527
|
+
if (typeof pString == 'string' && pString != '') {
|
|
528
|
+
return pString.replace(this._Regex_formatterCleanNonAlpha, this._Value_Clean_formatterCleanNonAlpha);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/*************************************************************************
|
|
533
|
+
* Number Formatting Functions
|
|
534
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Insert commas every 3 characters from the right. Used by formatterAddCommasToNumber().
|
|
538
|
+
*
|
|
539
|
+
* @param {*} pString
|
|
540
|
+
* @returns {*}
|
|
541
|
+
*/
|
|
542
|
+
}, {
|
|
543
|
+
key: "formatterInsertCommas",
|
|
544
|
+
value: function formatterInsertCommas(pString) {
|
|
545
|
+
// Reverse, because it's easier to do things from the left, given arbitrary digit counts
|
|
546
|
+
var tmpReversed = this.stringReverse(pString);
|
|
547
|
+
// Add commas every three characters
|
|
548
|
+
var tmpReversedWithCommas = tmpReversed.match(this._Regex_formatterInsertCommas).join(',');
|
|
549
|
+
// Reverse again (back to normal direction)
|
|
550
|
+
return this.stringReverse(tmpReversedWithCommas);
|
|
551
|
+
}
|
|
552
|
+
}, {
|
|
553
|
+
key: "processAddCommasToNumberRegex",
|
|
554
|
+
value: function processAddCommasToNumberRegex(pMatch, pSign, pZeros, pBefore, pDecimal, pAfter) {
|
|
555
|
+
// If there was no decimal, the last capture grabs the final digit, so
|
|
556
|
+
// we have to put it back together with the 'before' substring
|
|
557
|
+
return pSign + (pDecimal ? this.formatterInsertCommas(pBefore) + pDecimal + pAfter : this.formatterInsertCommas(pBefore + pAfter));
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Add Commas to a Number for readability.
|
|
562
|
+
*
|
|
563
|
+
* @param {*} pNumber
|
|
564
|
+
* @returns {string}
|
|
565
|
+
*/
|
|
566
|
+
}, {
|
|
567
|
+
key: "formatterAddCommasToNumber",
|
|
568
|
+
value: function formatterAddCommasToNumber(pNumber) {
|
|
569
|
+
// If the regex doesn't match, `replace` returns the string unmodified
|
|
570
|
+
return pNumber.toString().replace(this._Regex_formatterAddCommasToNumber, this.processAddCommasToNumberRegex.bind(this));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* This will take a number and format it as a dollar string. It will also add commas to the number. If the number is not a number, it will return '--'.
|
|
575
|
+
*
|
|
576
|
+
* @param {*} pValue
|
|
577
|
+
* @returns {string}
|
|
578
|
+
*/
|
|
579
|
+
}, {
|
|
580
|
+
key: "formatterDollars",
|
|
581
|
+
value: function formatterDollars(pValue) {
|
|
582
|
+
var tmpDollarAmount = parseFloat(pValue).toFixed(2);
|
|
583
|
+
if (isNaN(tmpDollarAmount)) {
|
|
584
|
+
// Try again and see if what was passed in was a dollars string.
|
|
585
|
+
if (typeof pValue == 'string') {
|
|
586
|
+
// TODO: Better rounding function? This is a hack to get rid of the currency symbol and commas.
|
|
587
|
+
tmpDollarAmount = parseFloat(pValue.replace(this._Value_MoneySign_Currency, '').replace(this._Regex_formatterDollarsRemoveCommas, '')).toFixed(2);
|
|
588
|
+
}
|
|
589
|
+
// If we didn't get a number, return the "not a number" string.
|
|
590
|
+
if (isNaN(tmpDollarAmount)) {
|
|
591
|
+
return this._Value_NaN_Currency;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// TODO: Get locale data and use that for this stuff.
|
|
596
|
+
return "$".concat(this.formatterAddCommasToNumber(tmpDollarAmount));
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Round a number to a certain number of digits. If the number is not a number, it will return 0. If no digits are specified, it will default to 2 significant digits.
|
|
601
|
+
*
|
|
602
|
+
* @param {*} pValue
|
|
603
|
+
* @param {number} pDigits
|
|
604
|
+
* @returns {string}
|
|
605
|
+
*/
|
|
606
|
+
}, {
|
|
607
|
+
key: "formatterRoundNumber",
|
|
608
|
+
value: function formatterRoundNumber(pValue, pDigits) {
|
|
609
|
+
var tmpDigits = typeof pDigits == 'undefined' ? 2 : pDigits;
|
|
610
|
+
var tmpValue = Number.parseFloat(pValue).toFixed(tmpDigits);
|
|
611
|
+
if (isNaN(tmpValue)) {
|
|
612
|
+
var tmpZed = 0;
|
|
613
|
+
return tmpZed.toFixed(tmpDigits);
|
|
614
|
+
} else {
|
|
615
|
+
return tmpValue;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/*************************************************************************
|
|
620
|
+
* String Tokenization Functions
|
|
621
|
+
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Return the string before the matched substring.
|
|
625
|
+
*
|
|
626
|
+
* If the substring is not found, the entire string is returned. This only deals with the *first* match.
|
|
627
|
+
*
|
|
628
|
+
* @param {string} pString
|
|
629
|
+
* @param {string} pMatch
|
|
630
|
+
* @returns {string}
|
|
631
|
+
*/
|
|
632
|
+
}, {
|
|
633
|
+
key: "stringBeforeMatch",
|
|
634
|
+
value: function stringBeforeMatch(pString, pMatch) {
|
|
635
|
+
return pString.split(pMatch)[0];
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Return the string after the matched substring.
|
|
640
|
+
*
|
|
641
|
+
* If the substring is not found, an empty string is returned. This only deals with the *first* match.
|
|
642
|
+
*
|
|
643
|
+
* @param {string} pString
|
|
644
|
+
* @param {string} pMatch
|
|
645
|
+
* @returns {string}
|
|
646
|
+
*/
|
|
647
|
+
}, {
|
|
648
|
+
key: "stringAfterMatch",
|
|
649
|
+
value: function stringAfterMatch(pString, pMatch) {
|
|
650
|
+
var tmpStringSplitLocation = pString.indexOf(pMatch);
|
|
651
|
+
if (tmpStringSplitLocation < 0 || tmpStringSplitLocation + pMatch.length >= pString.length) {
|
|
652
|
+
return '';
|
|
653
|
+
}
|
|
654
|
+
return pString.substring(tmpStringSplitLocation + pMatch.length);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Count the number of enclosures in a string based on the start and end characters.
|
|
659
|
+
*
|
|
660
|
+
* If no start or end characters are specified, it will default to parentheses. If the string is not a string, it will return 0.
|
|
661
|
+
*
|
|
662
|
+
* @param {string} pString
|
|
663
|
+
* @param {string} pEnclosureStart
|
|
664
|
+
* @param {string} pEnclosureEnd
|
|
665
|
+
* @returns the count of full in the string
|
|
666
|
+
*/
|
|
667
|
+
}, {
|
|
668
|
+
key: "stringCountEnclosures",
|
|
669
|
+
value: function stringCountEnclosures(pString, pEnclosureStart, pEnclosureEnd) {
|
|
670
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
671
|
+
var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
|
|
672
|
+
var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
|
|
673
|
+
var tmpEnclosureCount = 0;
|
|
674
|
+
var tmpEnclosureDepth = 0;
|
|
675
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
676
|
+
// This is the start of an enclosure
|
|
677
|
+
if (tmpString[i] == tmpEnclosureStart) {
|
|
678
|
+
if (tmpEnclosureDepth == 0) {
|
|
679
|
+
tmpEnclosureCount++;
|
|
680
|
+
}
|
|
681
|
+
tmpEnclosureDepth++;
|
|
682
|
+
} else if (tmpString[i] == tmpEnclosureEnd) {
|
|
683
|
+
tmpEnclosureDepth--;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return tmpEnclosureCount;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Get the value of the enclosure at the specified index.
|
|
691
|
+
*
|
|
692
|
+
* If the index is not a number, it will default to 0. If the string is not a string, it will return an empty string. If the enclosure is not found, it will return an empty string. If the enclosure
|
|
693
|
+
*
|
|
694
|
+
* @param {string} pString
|
|
695
|
+
* @param {number} pEnclosureIndexToGet
|
|
696
|
+
* @param {string} pEnclosureStart
|
|
697
|
+
* @param {string}} pEnclosureEnd
|
|
698
|
+
* @returns {string}
|
|
699
|
+
*/
|
|
700
|
+
}, {
|
|
701
|
+
key: "stringGetEnclosureValueByIndex",
|
|
702
|
+
value: function stringGetEnclosureValueByIndex(pString, pEnclosureIndexToGet, pEnclosureStart, pEnclosureEnd) {
|
|
703
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
704
|
+
var tmpEnclosureIndexToGet = typeof pEnclosureIndexToGet == 'number' ? pEnclosureIndexToGet : 0;
|
|
705
|
+
var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
|
|
706
|
+
var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
|
|
707
|
+
var tmpEnclosureCount = 0;
|
|
708
|
+
var tmpEnclosureDepth = 0;
|
|
709
|
+
var tmpMatchedEnclosureIndex = false;
|
|
710
|
+
var tmpEnclosedValueStartIndex = 0;
|
|
711
|
+
var tmpEnclosedValueEndIndex = 0;
|
|
712
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
713
|
+
// This is the start of an enclosure
|
|
714
|
+
if (tmpString[i] == tmpEnclosureStart) {
|
|
715
|
+
tmpEnclosureDepth++;
|
|
716
|
+
|
|
717
|
+
// Only count enclosures at depth 1, but still this parses both pairs of all of them.
|
|
718
|
+
if (tmpEnclosureDepth == 1) {
|
|
719
|
+
tmpEnclosureCount++;
|
|
720
|
+
if (tmpEnclosureIndexToGet == tmpEnclosureCount - 1) {
|
|
721
|
+
// This is the start of *the* enclosure
|
|
722
|
+
tmpMatchedEnclosureIndex = true;
|
|
723
|
+
tmpEnclosedValueStartIndex = i;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
// This is the end of an enclosure
|
|
728
|
+
else if (tmpString[i] == tmpEnclosureEnd) {
|
|
729
|
+
tmpEnclosureDepth--;
|
|
730
|
+
|
|
731
|
+
// Again, only count enclosures at depth 1, but still this parses both pairs of all of them.
|
|
732
|
+
if (tmpEnclosureDepth == 0 && tmpMatchedEnclosureIndex && tmpEnclosedValueEndIndex <= tmpEnclosedValueStartIndex) {
|
|
733
|
+
tmpEnclosedValueEndIndex = i;
|
|
734
|
+
tmpMatchedEnclosureIndex = false;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (tmpEnclosureCount <= tmpEnclosureIndexToGet) {
|
|
739
|
+
// Return an empty string if the enclosure is not found
|
|
740
|
+
return '';
|
|
741
|
+
}
|
|
742
|
+
if (tmpEnclosedValueEndIndex > 0 && tmpEnclosedValueEndIndex > tmpEnclosedValueStartIndex) {
|
|
743
|
+
return tmpString.substring(tmpEnclosedValueStartIndex + 1, tmpEnclosedValueEndIndex);
|
|
744
|
+
} else {
|
|
745
|
+
return tmpString.substring(tmpEnclosedValueStartIndex + 1);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Remove an enclosure from a string based on the index of the enclosure.
|
|
751
|
+
*
|
|
752
|
+
* @param {string} pString
|
|
753
|
+
* @param {number} pEnclosureIndexToRemove
|
|
754
|
+
* @param {number} pEnclosureStart
|
|
755
|
+
* @param {number} pEnclosureEnd
|
|
756
|
+
* @returns {string}
|
|
757
|
+
*/
|
|
758
|
+
}, {
|
|
759
|
+
key: "stringRemoveEnclosureByIndex",
|
|
760
|
+
value: function stringRemoveEnclosureByIndex(pString, pEnclosureIndexToRemove, pEnclosureStart, pEnclosureEnd) {
|
|
761
|
+
var tmpString = typeof pString == 'string' ? pString : '';
|
|
762
|
+
var tmpEnclosureIndexToRemove = typeof pEnclosureIndexToRemove == 'number' ? pEnclosureIndexToRemove : 0;
|
|
763
|
+
var tmpEnclosureStart = typeof pEnclosureStart == 'string' ? pEnclosureStart : '(';
|
|
764
|
+
var tmpEnclosureEnd = typeof pEnclosureEnd == 'string' ? pEnclosureEnd : ')';
|
|
765
|
+
var tmpEnclosureCount = 0;
|
|
766
|
+
var tmpEnclosureDepth = 0;
|
|
767
|
+
var tmpMatchedEnclosureIndex = false;
|
|
768
|
+
var tmpEnclosureStartIndex = 0;
|
|
769
|
+
var tmpEnclosureEndIndex = 0;
|
|
770
|
+
for (var i = 0; i < tmpString.length; i++) {
|
|
771
|
+
// This is the start of an enclosure
|
|
772
|
+
if (tmpString[i] == tmpEnclosureStart) {
|
|
773
|
+
tmpEnclosureDepth++;
|
|
774
|
+
if (tmpEnclosureDepth == 1) {
|
|
775
|
+
tmpEnclosureCount++;
|
|
776
|
+
if (tmpEnclosureIndexToRemove == tmpEnclosureCount - 1) {
|
|
777
|
+
tmpMatchedEnclosureIndex = true;
|
|
778
|
+
tmpEnclosureStartIndex = i;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
} else if (tmpString[i] == tmpEnclosureEnd) {
|
|
782
|
+
tmpEnclosureDepth--;
|
|
783
|
+
if (tmpEnclosureDepth == 0 && tmpMatchedEnclosureIndex && tmpEnclosureEndIndex <= tmpEnclosureStartIndex) {
|
|
784
|
+
tmpEnclosureEndIndex = i;
|
|
785
|
+
tmpMatchedEnclosureIndex = false;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
if (tmpEnclosureCount <= tmpEnclosureIndexToRemove) {
|
|
790
|
+
return tmpString;
|
|
791
|
+
}
|
|
792
|
+
var tmpReturnString = '';
|
|
793
|
+
if (tmpEnclosureStartIndex > 1) {
|
|
794
|
+
tmpReturnString = tmpString.substring(0, tmpEnclosureStartIndex);
|
|
795
|
+
}
|
|
796
|
+
if (tmpString.length > tmpEnclosureEndIndex + 1 && tmpEnclosureEndIndex > tmpEnclosureStartIndex) {
|
|
797
|
+
tmpReturnString += tmpString.substring(tmpEnclosureEndIndex + 1);
|
|
798
|
+
}
|
|
799
|
+
return tmpReturnString;
|
|
800
|
+
}
|
|
801
|
+
}]);
|
|
802
|
+
return DataArithmatic;
|
|
803
|
+
}();
|
|
804
|
+
module.exports = DataArithmatic;
|
|
805
|
+
}, {}],
|
|
806
|
+
18: [function (require, module, exports) {
|
|
351
807
|
/**
|
|
352
808
|
* Base Logger Class
|
|
353
809
|
*
|
|
@@ -431,7 +887,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
431
887
|
}();
|
|
432
888
|
module.exports = BaseLogger;
|
|
433
889
|
}, {}],
|
|
434
|
-
|
|
890
|
+
19: [function (require, module, exports) {
|
|
435
891
|
/**
|
|
436
892
|
* Default Logger Provider Function
|
|
437
893
|
*
|
|
@@ -449,16 +905,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
449
905
|
};
|
|
450
906
|
module.exports = getDefaultProviders();
|
|
451
907
|
}, {
|
|
452
|
-
"./Fable-Log-Logger-Console.js":
|
|
908
|
+
"./Fable-Log-Logger-Console.js": 21
|
|
453
909
|
}],
|
|
454
|
-
|
|
910
|
+
20: [function (require, module, exports) {
|
|
455
911
|
module.exports = [{
|
|
456
912
|
"loggertype": "console",
|
|
457
913
|
"streamtype": "console",
|
|
458
914
|
"level": "trace"
|
|
459
915
|
}];
|
|
460
916
|
}, {}],
|
|
461
|
-
|
|
917
|
+
21: [function (require, module, exports) {
|
|
462
918
|
var libBaseLogger = require('./Fable-Log-BaseLogger.js');
|
|
463
919
|
var ConsoleLogger = /*#__PURE__*/function (_libBaseLogger) {
|
|
464
920
|
_inherits(ConsoleLogger, _libBaseLogger);
|
|
@@ -513,9 +969,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
513
969
|
}(libBaseLogger);
|
|
514
970
|
module.exports = ConsoleLogger;
|
|
515
971
|
}, {
|
|
516
|
-
"./Fable-Log-BaseLogger.js":
|
|
972
|
+
"./Fable-Log-BaseLogger.js": 18
|
|
517
973
|
}],
|
|
518
|
-
|
|
974
|
+
22: [function (require, module, exports) {
|
|
519
975
|
var libConsoleLog = require('./Fable-Log-Logger-Console.js');
|
|
520
976
|
var libFS = require('fs');
|
|
521
977
|
var libPath = require('path');
|
|
@@ -616,11 +1072,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
616
1072
|
}(libConsoleLog);
|
|
617
1073
|
module.exports = SimpleFlatFileLogger;
|
|
618
1074
|
}, {
|
|
619
|
-
"./Fable-Log-Logger-Console.js":
|
|
1075
|
+
"./Fable-Log-Logger-Console.js": 21,
|
|
620
1076
|
"fs": 16,
|
|
621
|
-
"path":
|
|
1077
|
+
"path": 29
|
|
622
1078
|
}],
|
|
623
|
-
|
|
1079
|
+
23: [function (require, module, exports) {
|
|
624
1080
|
/**
|
|
625
1081
|
* Fable Logging Add-on
|
|
626
1082
|
*
|
|
@@ -839,13 +1295,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
839
1295
|
module.exports.LogProviderConsole = require('./Fable-Log-Logger-Console.js');
|
|
840
1296
|
module.exports.LogProviderConsole = require('./Fable-Log-Logger-SimpleFlatFile.js');
|
|
841
1297
|
}, {
|
|
842
|
-
"./Fable-Log-BaseLogger.js":
|
|
843
|
-
"./Fable-Log-DefaultProviders-Node.js":
|
|
844
|
-
"./Fable-Log-DefaultStreams.json":
|
|
845
|
-
"./Fable-Log-Logger-Console.js":
|
|
846
|
-
"./Fable-Log-Logger-SimpleFlatFile.js":
|
|
1298
|
+
"./Fable-Log-BaseLogger.js": 18,
|
|
1299
|
+
"./Fable-Log-DefaultProviders-Node.js": 19,
|
|
1300
|
+
"./Fable-Log-DefaultStreams.json": 20,
|
|
1301
|
+
"./Fable-Log-Logger-Console.js": 21,
|
|
1302
|
+
"./Fable-Log-Logger-SimpleFlatFile.js": 22
|
|
847
1303
|
}],
|
|
848
|
-
|
|
1304
|
+
24: [function (require, module, exports) {
|
|
849
1305
|
module.exports = {
|
|
850
1306
|
"Product": "ApplicationNameHere",
|
|
851
1307
|
"ProductVersion": "0.0.0",
|
|
@@ -855,7 +1311,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
855
1311
|
}]
|
|
856
1312
|
};
|
|
857
1313
|
}, {}],
|
|
858
|
-
|
|
1314
|
+
25: [function (require, module, exports) {
|
|
859
1315
|
(function (process) {
|
|
860
1316
|
(function () {
|
|
861
1317
|
/**
|
|
@@ -901,9 +1357,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
901
1357
|
}).call(this);
|
|
902
1358
|
}).call(this, require('_process'));
|
|
903
1359
|
}, {
|
|
904
|
-
"_process":
|
|
1360
|
+
"_process": 33
|
|
905
1361
|
}],
|
|
906
|
-
|
|
1362
|
+
26: [function (require, module, exports) {
|
|
907
1363
|
/**
|
|
908
1364
|
* Fable Settings Add-on
|
|
909
1365
|
*
|
|
@@ -1067,11 +1523,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1067
1523
|
module.exports["new"] = autoConstruct;
|
|
1068
1524
|
module.exports.precedent = libPrecedent;
|
|
1069
1525
|
}, {
|
|
1070
|
-
"./Fable-Settings-Default":
|
|
1071
|
-
"./Fable-Settings-TemplateProcessor.js":
|
|
1072
|
-
"precedent":
|
|
1526
|
+
"./Fable-Settings-Default": 24,
|
|
1527
|
+
"./Fable-Settings-TemplateProcessor.js": 25,
|
|
1528
|
+
"precedent": 30
|
|
1073
1529
|
}],
|
|
1074
|
-
|
|
1530
|
+
27: [function (require, module, exports) {
|
|
1075
1531
|
/**
|
|
1076
1532
|
* Random Byte Generator - Browser version
|
|
1077
1533
|
*
|
|
@@ -1132,7 +1588,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1132
1588
|
}();
|
|
1133
1589
|
module.exports = RandomBytes;
|
|
1134
1590
|
}, {}],
|
|
1135
|
-
|
|
1591
|
+
28: [function (require, module, exports) {
|
|
1136
1592
|
/**
|
|
1137
1593
|
* Fable UUID Generator
|
|
1138
1594
|
*
|
|
@@ -1222,9 +1678,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1222
1678
|
module.exports = FableUUID;
|
|
1223
1679
|
module.exports["new"] = autoConstruct;
|
|
1224
1680
|
}, {
|
|
1225
|
-
"./Fable-UUID-Random.js":
|
|
1681
|
+
"./Fable-UUID-Random.js": 27
|
|
1226
1682
|
}],
|
|
1227
|
-
|
|
1683
|
+
29: [function (require, module, exports) {
|
|
1228
1684
|
(function (process) {
|
|
1229
1685
|
(function () {
|
|
1230
1686
|
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
@@ -1693,9 +2149,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1693
2149
|
}).call(this);
|
|
1694
2150
|
}).call(this, require('_process'));
|
|
1695
2151
|
}, {
|
|
1696
|
-
"_process":
|
|
2152
|
+
"_process": 33
|
|
1697
2153
|
}],
|
|
1698
|
-
|
|
2154
|
+
30: [function (require, module, exports) {
|
|
1699
2155
|
/**
|
|
1700
2156
|
* Precedent Meta-Templating
|
|
1701
2157
|
*
|
|
@@ -1748,10 +2204,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1748
2204
|
}();
|
|
1749
2205
|
module.exports = Precedent;
|
|
1750
2206
|
}, {
|
|
1751
|
-
"./StringParser.js":
|
|
1752
|
-
"./WordTree.js":
|
|
2207
|
+
"./StringParser.js": 31,
|
|
2208
|
+
"./WordTree.js": 32
|
|
1753
2209
|
}],
|
|
1754
|
-
|
|
2210
|
+
31: [function (require, module, exports) {
|
|
1755
2211
|
/**
|
|
1756
2212
|
* String Parser
|
|
1757
2213
|
*
|
|
@@ -1914,7 +2370,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1914
2370
|
}();
|
|
1915
2371
|
module.exports = StringParser;
|
|
1916
2372
|
}, {}],
|
|
1917
|
-
|
|
2373
|
+
32: [function (require, module, exports) {
|
|
1918
2374
|
/**
|
|
1919
2375
|
* Word Tree
|
|
1920
2376
|
*
|
|
@@ -1979,7 +2435,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1979
2435
|
}();
|
|
1980
2436
|
module.exports = WordTree;
|
|
1981
2437
|
}, {}],
|
|
1982
|
-
|
|
2438
|
+
33: [function (require, module, exports) {
|
|
1983
2439
|
// shim for using process in browser
|
|
1984
2440
|
var process = module.exports = {};
|
|
1985
2441
|
|
|
@@ -2156,7 +2612,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2156
2612
|
return 0;
|
|
2157
2613
|
};
|
|
2158
2614
|
}, {}],
|
|
2159
|
-
|
|
2615
|
+
34: [function (require, module, exports) {
|
|
2160
2616
|
(function (setImmediate, clearImmediate) {
|
|
2161
2617
|
(function () {
|
|
2162
2618
|
var nextTick = require('process/browser.js').nextTick;
|
|
@@ -2230,19 +2686,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2230
2686
|
}).call(this);
|
|
2231
2687
|
}).call(this, require("timers").setImmediate, require("timers").clearImmediate);
|
|
2232
2688
|
}, {
|
|
2233
|
-
"process/browser.js":
|
|
2234
|
-
"timers":
|
|
2689
|
+
"process/browser.js": 33,
|
|
2690
|
+
"timers": 34
|
|
2235
2691
|
}],
|
|
2236
|
-
|
|
2692
|
+
35: [function (require, module, exports) {
|
|
2237
2693
|
var libNPMModuleWrapper = require('./Fable.js');
|
|
2238
2694
|
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.hasOwnProperty('Fable')) {
|
|
2239
2695
|
window.Fable = libNPMModuleWrapper;
|
|
2240
2696
|
}
|
|
2241
2697
|
module.exports = libNPMModuleWrapper;
|
|
2242
2698
|
}, {
|
|
2243
|
-
"./Fable.js":
|
|
2699
|
+
"./Fable.js": 42
|
|
2244
2700
|
}],
|
|
2245
|
-
|
|
2701
|
+
36: [function (require, module, exports) {
|
|
2246
2702
|
var _OperationStatePrototype = JSON.stringify({
|
|
2247
2703
|
"Metadata": {
|
|
2248
2704
|
"GUID": false,
|
|
@@ -2349,11 +2805,32 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2349
2805
|
}();
|
|
2350
2806
|
module.exports = FableOperation;
|
|
2351
2807
|
}, {}],
|
|
2352
|
-
|
|
2808
|
+
37: [function (require, module, exports) {
|
|
2353
2809
|
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2354
|
-
var
|
|
2355
|
-
|
|
2356
|
-
|
|
2810
|
+
var libDataArithmatic = require('data-arithmatic');
|
|
2811
|
+
var FableServiceDataArithmatic = /*#__PURE__*/function (_libFableServiceBase) {
|
|
2812
|
+
_inherits(FableServiceDataArithmatic, _libFableServiceBase);
|
|
2813
|
+
var _super3 = _createSuper(FableServiceDataArithmatic);
|
|
2814
|
+
function FableServiceDataArithmatic(pFable, pOptions, pServiceHash) {
|
|
2815
|
+
var _this4;
|
|
2816
|
+
_classCallCheck(this, FableServiceDataArithmatic);
|
|
2817
|
+
_this4 = _super3.call(this, pFable, pOptions, pServiceHash);
|
|
2818
|
+
_this4.serviceType = 'DataArithmatic';
|
|
2819
|
+
_this4._DataArithmaticLibrary = new libDataArithmatic();
|
|
2820
|
+
return _this4;
|
|
2821
|
+
}
|
|
2822
|
+
return _createClass(FableServiceDataArithmatic);
|
|
2823
|
+
}(libFableServiceBase);
|
|
2824
|
+
module.exports = FableServiceDataArithmatic;
|
|
2825
|
+
}, {
|
|
2826
|
+
"./Fable-ServiceProviderBase.js": 41,
|
|
2827
|
+
"data-arithmatic": 17
|
|
2828
|
+
}],
|
|
2829
|
+
38: [function (require, module, exports) {
|
|
2830
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2831
|
+
var FableServiceTemplate = /*#__PURE__*/function (_libFableServiceBase2) {
|
|
2832
|
+
_inherits(FableServiceTemplate, _libFableServiceBase2);
|
|
2833
|
+
var _super4 = _createSuper(FableServiceTemplate);
|
|
2357
2834
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2358
2835
|
// string-based template with code snippets into simple executable pieces,
|
|
2359
2836
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -2364,14 +2841,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2364
2841
|
// This is an implementation of that.
|
|
2365
2842
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2366
2843
|
function FableServiceTemplate(pFable, pOptions, pServiceHash) {
|
|
2367
|
-
var
|
|
2844
|
+
var _this5;
|
|
2368
2845
|
_classCallCheck(this, FableServiceTemplate);
|
|
2369
|
-
|
|
2370
|
-
|
|
2846
|
+
_this5 = _super4.call(this, pFable, pOptions, pServiceHash);
|
|
2847
|
+
_this5.serviceType = 'Template';
|
|
2371
2848
|
|
|
2372
2849
|
// These are the exact regex's used in lodash/underscore
|
|
2373
2850
|
// TODO: Switch this to precedent
|
|
2374
|
-
|
|
2851
|
+
_this5.Matchers = {
|
|
2375
2852
|
Evaluate: /<%([\s\S]+?)%>/g,
|
|
2376
2853
|
Interpolate: /<%=([\s\S]+?)%>/g,
|
|
2377
2854
|
Escaper: /\\|'|\r|\n|\t|\u2028|\u2029/g,
|
|
@@ -2382,7 +2859,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2382
2859
|
|
|
2383
2860
|
// This is a helper for the escaper and unescaper functions.
|
|
2384
2861
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
2385
|
-
|
|
2862
|
+
_this5.templateEscapes = {
|
|
2386
2863
|
'\\': '\\',
|
|
2387
2864
|
"'": "'",
|
|
2388
2865
|
'r': '\r',
|
|
@@ -2399,9 +2876,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2399
2876
|
|
|
2400
2877
|
// This is defined as such to underscore that it is a dynamic programming
|
|
2401
2878
|
// function on this class.
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
return
|
|
2879
|
+
_this5.renderFunction = false;
|
|
2880
|
+
_this5.templateString = false;
|
|
2881
|
+
return _this5;
|
|
2405
2882
|
}
|
|
2406
2883
|
_createClass(FableServiceTemplate, [{
|
|
2407
2884
|
key: "renderTemplate",
|
|
@@ -2417,11 +2894,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2417
2894
|
}, {
|
|
2418
2895
|
key: "buildTemplateFunction",
|
|
2419
2896
|
value: function buildTemplateFunction(pTemplateText, pData) {
|
|
2420
|
-
var
|
|
2897
|
+
var _this6 = this;
|
|
2421
2898
|
// For now this is being kept in a weird form ... this is to mimic the old
|
|
2422
2899
|
// underscore code until this is rewritten using precedent.
|
|
2423
2900
|
this.TemplateSource = "__p+='" + pTemplateText.replace(this.Matchers.Escaper, function (pMatch) {
|
|
2424
|
-
return "\\".concat(
|
|
2901
|
+
return "\\".concat(_this6.templateEscapes[pMatch]);
|
|
2425
2902
|
}).replace(this.Matchers.Interpolate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
2426
2903
|
return "'+\n(".concat(decodeURIComponent(pCode), ")+\n'");
|
|
2427
2904
|
}).replace(this.Matchers.Evaluate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
@@ -2444,9 +2921,98 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2444
2921
|
}(libFableServiceBase);
|
|
2445
2922
|
module.exports = FableServiceTemplate;
|
|
2446
2923
|
}, {
|
|
2447
|
-
"./Fable-ServiceProviderBase.js":
|
|
2924
|
+
"./Fable-ServiceProviderBase.js": 41
|
|
2448
2925
|
}],
|
|
2449
|
-
|
|
2926
|
+
39: [function (require, module, exports) {
|
|
2927
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2928
|
+
|
|
2929
|
+
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2930
|
+
var libAsyncWaterfall = require('async.waterfall');
|
|
2931
|
+
var libAsyncEachLimit = require('async.eachlimit');
|
|
2932
|
+
var FableServiceUtility = /*#__PURE__*/function (_libFableServiceBase3) {
|
|
2933
|
+
_inherits(FableServiceUtility, _libFableServiceBase3);
|
|
2934
|
+
var _super5 = _createSuper(FableServiceUtility);
|
|
2935
|
+
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2936
|
+
// string-based template with code snippets into simple executable pieces,
|
|
2937
|
+
// with the added twist of returning a precompiled function ready to go.
|
|
2938
|
+
//
|
|
2939
|
+
// NOTE: This does not implement underscore escape expressions
|
|
2940
|
+
// NOTE: This does not implement underscore magic browser variable assignment
|
|
2941
|
+
//
|
|
2942
|
+
// This is an implementation of that.
|
|
2943
|
+
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2944
|
+
function FableServiceUtility(pFable, pOptions, pServiceHash) {
|
|
2945
|
+
var _this7;
|
|
2946
|
+
_classCallCheck(this, FableServiceUtility);
|
|
2947
|
+
_this7 = _super5.call(this, pFable, pOptions, pServiceHash);
|
|
2948
|
+
_this7.templates = {};
|
|
2949
|
+
|
|
2950
|
+
// These two functions are used extensively throughout
|
|
2951
|
+
_this7.waterfall = libAsyncWaterfall;
|
|
2952
|
+
_this7.eachLimit = libAsyncEachLimit;
|
|
2953
|
+
return _this7;
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2957
|
+
// Now that es6 gives us this, use the native thingy.
|
|
2958
|
+
_createClass(FableServiceUtility, [{
|
|
2959
|
+
key: "extend",
|
|
2960
|
+
value: function extend(pDestinationObject) {
|
|
2961
|
+
for (var _len = arguments.length, pSourceObjects = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2962
|
+
pSourceObjects[_key - 1] = arguments[_key];
|
|
2963
|
+
}
|
|
2964
|
+
return Object.assign.apply(Object, [pDestinationObject].concat(pSourceObjects));
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2968
|
+
// string-based template with code snippets into simple executable pieces,
|
|
2969
|
+
// with the added twist of returning a precompiled function ready to go.
|
|
2970
|
+
}, {
|
|
2971
|
+
key: "template",
|
|
2972
|
+
value: function template(pTemplateText, pData) {
|
|
2973
|
+
var tmpTemplate = this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');
|
|
2974
|
+
return tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
// Build a template function from a template hash, and, register it with the service provider
|
|
2978
|
+
}, {
|
|
2979
|
+
key: "buildHashedTemplate",
|
|
2980
|
+
value: function buildHashedTemplate(pTemplateHash, pTemplateText, pData) {
|
|
2981
|
+
var tmpTemplate = this.fable.serviceManager.instantiateServiceProvider('Template', {}, pTemplateHash);
|
|
2982
|
+
this.templates[pTemplateHash] = tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2983
|
+
return this.templates[pTemplateHash];
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
// This is a safe, modern version of chunk from underscore
|
|
2987
|
+
// Algorithm pulled from a mix of these two polyfills:
|
|
2988
|
+
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_chunk
|
|
2989
|
+
// https://youmightnotneed.com/lodash
|
|
2990
|
+
// This implementation was most tolerant in browsers. Uglify can fix the rest.
|
|
2991
|
+
}, {
|
|
2992
|
+
key: "chunk",
|
|
2993
|
+
value: function chunk(pInput, pChunkSize, pChunkCache) {
|
|
2994
|
+
var tmpInputArray = _toConsumableArray(pInput);
|
|
2995
|
+
// Note lodash defaults to 1, underscore defaults to 0
|
|
2996
|
+
var tmpChunkSize = typeof pChunkSize == 'number' ? pChunkSize : 0;
|
|
2997
|
+
var tmpChunkCache = typeof pChunkCache != 'undefined' ? pChunkCache : [];
|
|
2998
|
+
if (tmpChunkSize <= 0) {
|
|
2999
|
+
return tmpChunkCache;
|
|
3000
|
+
}
|
|
3001
|
+
while (tmpInputArray.length) {
|
|
3002
|
+
tmpChunkCache.push(tmpInputArray.splice(0, tmpChunkSize));
|
|
3003
|
+
}
|
|
3004
|
+
return tmpChunkCache;
|
|
3005
|
+
}
|
|
3006
|
+
}]);
|
|
3007
|
+
return FableServiceUtility;
|
|
3008
|
+
}(libFableServiceBase);
|
|
3009
|
+
module.exports = FableServiceUtility;
|
|
3010
|
+
}, {
|
|
3011
|
+
"./Fable-ServiceProviderBase.js": 41,
|
|
3012
|
+
"async.eachlimit": 1,
|
|
3013
|
+
"async.waterfall": 15
|
|
3014
|
+
}],
|
|
3015
|
+
40: [function (require, module, exports) {
|
|
2450
3016
|
/**
|
|
2451
3017
|
* Fable Application Services Management
|
|
2452
3018
|
* @license MIT
|
|
@@ -2524,9 +3090,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2524
3090
|
module.exports = FableService;
|
|
2525
3091
|
module.exports.ServiceProviderBase = libFableServiceBase;
|
|
2526
3092
|
}, {
|
|
2527
|
-
"./Fable-ServiceProviderBase.js":
|
|
3093
|
+
"./Fable-ServiceProviderBase.js": 41
|
|
2528
3094
|
}],
|
|
2529
|
-
|
|
3095
|
+
41: [function (require, module, exports) {
|
|
2530
3096
|
/**
|
|
2531
3097
|
* Fable Service Base
|
|
2532
3098
|
* @license MIT
|
|
@@ -2542,80 +3108,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2542
3108
|
});
|
|
2543
3109
|
module.exports = FableServiceProviderBase;
|
|
2544
3110
|
}, {}],
|
|
2545
|
-
|
|
2546
|
-
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2547
|
-
var libAsyncWaterfall = require('async.waterfall');
|
|
2548
|
-
var libAsyncEachLimit = require('async.eachlimit');
|
|
2549
|
-
var FableUtility = /*#__PURE__*/function () {
|
|
2550
|
-
function FableUtility(pFable) {
|
|
2551
|
-
_classCallCheck(this, FableUtility);
|
|
2552
|
-
this.fable = pFable;
|
|
2553
|
-
this.templates = {};
|
|
2554
|
-
|
|
2555
|
-
// These two functions are used extensively throughout
|
|
2556
|
-
this.waterfall = libAsyncWaterfall;
|
|
2557
|
-
this.eachLimit = libAsyncEachLimit;
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2561
|
-
// Now that es6 gives us this, use the native thingy.
|
|
2562
|
-
_createClass(FableUtility, [{
|
|
2563
|
-
key: "extend",
|
|
2564
|
-
value: function extend(pDestinationObject) {
|
|
2565
|
-
for (var _len = arguments.length, pSourceObjects = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2566
|
-
pSourceObjects[_key - 1] = arguments[_key];
|
|
2567
|
-
}
|
|
2568
|
-
return Object.assign.apply(Object, [pDestinationObject].concat(pSourceObjects));
|
|
2569
|
-
}
|
|
2570
|
-
|
|
2571
|
-
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2572
|
-
// string-based template with code snippets into simple executable pieces,
|
|
2573
|
-
// with the added twist of returning a precompiled function ready to go.
|
|
2574
|
-
}, {
|
|
2575
|
-
key: "template",
|
|
2576
|
-
value: function template(pTemplateText, pData) {
|
|
2577
|
-
var tmpTemplate = this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');
|
|
2578
|
-
return tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
// Build a template function from a template hash, and, register it with the service provider
|
|
2582
|
-
}, {
|
|
2583
|
-
key: "buildHashedTemplate",
|
|
2584
|
-
value: function buildHashedTemplate(pTemplateHash, pTemplateText, pData) {
|
|
2585
|
-
var tmpTemplate = this.fable.serviceManager.instantiateServiceProvider('Template', {}, pTemplateHash);
|
|
2586
|
-
this.templates[pTemplateHash] = tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2587
|
-
return this.templates[pTemplateHash];
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
// This is a safe, modern version of chunk from underscore
|
|
2591
|
-
// Algorithm pulled from a mix of these two polyfills:
|
|
2592
|
-
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_chunk
|
|
2593
|
-
// https://youmightnotneed.com/lodash
|
|
2594
|
-
// This implementation was most tolerant in browsers. Uglify can fix the rest.
|
|
2595
|
-
}, {
|
|
2596
|
-
key: "chunk",
|
|
2597
|
-
value: function chunk(pInput, pChunkSize, pChunkCache) {
|
|
2598
|
-
var tmpInputArray = _toConsumableArray(pInput);
|
|
2599
|
-
// Note lodash defaults to 1, underscore defaults to 0
|
|
2600
|
-
var tmpChunkSize = typeof pChunkSize == 'number' ? pChunkSize : 0;
|
|
2601
|
-
var tmpChunkCache = typeof pChunkCache != 'undefined' ? pChunkCache : [];
|
|
2602
|
-
if (tmpChunkSize <= 0) {
|
|
2603
|
-
return tmpChunkCache;
|
|
2604
|
-
}
|
|
2605
|
-
while (tmpInputArray.length) {
|
|
2606
|
-
tmpChunkCache.push(tmpInputArray.splice(0, tmpChunkSize));
|
|
2607
|
-
}
|
|
2608
|
-
return tmpChunkCache;
|
|
2609
|
-
}
|
|
2610
|
-
}]);
|
|
2611
|
-
return FableUtility;
|
|
2612
|
-
}();
|
|
2613
|
-
module.exports = FableUtility;
|
|
2614
|
-
}, {
|
|
2615
|
-
"async.eachlimit": 1,
|
|
2616
|
-
"async.waterfall": 15
|
|
2617
|
-
}],
|
|
2618
|
-
40: [function (require, module, exports) {
|
|
3111
|
+
42: [function (require, module, exports) {
|
|
2619
3112
|
/**
|
|
2620
3113
|
* Fable Application Services Support Library
|
|
2621
3114
|
* @license MIT
|
|
@@ -2624,9 +3117,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2624
3117
|
var libFableSettings = require('fable-settings');
|
|
2625
3118
|
var libFableUUID = require('fable-uuid');
|
|
2626
3119
|
var libFableLog = require('fable-log');
|
|
2627
|
-
var libFableUtility = require('./Fable-Utility.js');
|
|
2628
3120
|
var libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
3121
|
+
var libFableServiceDataArithmatic = require('./Fable-Service-DataArithmatic.js');
|
|
2629
3122
|
var libFableServiceTemplate = require('./Fable-Service-Template.js');
|
|
3123
|
+
var libFableServiceUtility = require('./Fable-Service-Utility.js');
|
|
2630
3124
|
var libFableOperation = require('./Fable-Operation.js');
|
|
2631
3125
|
var Fable = /*#__PURE__*/function () {
|
|
2632
3126
|
function Fable(pSettings) {
|
|
@@ -2639,9 +3133,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2639
3133
|
this.log = new libFableLog(this.settingsManager.settings);
|
|
2640
3134
|
this.log.initialize();
|
|
2641
3135
|
|
|
2642
|
-
// Built-in utility belt functions
|
|
2643
|
-
this.Utility = new libFableUtility(this);
|
|
2644
|
-
|
|
2645
3136
|
// Built-in dependencies
|
|
2646
3137
|
this.Dependencies = {
|
|
2647
3138
|
precedent: libFableSettings.precedent
|
|
@@ -2650,7 +3141,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2650
3141
|
// Location for Operation state
|
|
2651
3142
|
this.Operations = {};
|
|
2652
3143
|
this.serviceManager = new libFableServiceManager(this);
|
|
3144
|
+
|
|
3145
|
+
// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
3146
|
+
this.serviceManager.addServiceType('DataArithmatic', libFableServiceDataArithmatic);
|
|
3147
|
+
this.fable.serviceManager.instantiateServiceProvider('DataArithmatic', {}, 'Default-Service-DataArithmatic');
|
|
3148
|
+
// This service is passing through the data arithmatic library
|
|
3149
|
+
this.DataArithmatic = this.serviceManager.defaultServices.DataArithmatic._DataArithmaticLibrary;
|
|
3150
|
+
|
|
3151
|
+
// Initialize the template service
|
|
2653
3152
|
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
3153
|
+
|
|
3154
|
+
// Initialize and instantiate the default baked-in Utility service
|
|
3155
|
+
this.serviceManager.addServiceType('Utility', libFableServiceUtility);
|
|
3156
|
+
this.fable.serviceManager.instantiateServiceProvider('Utility', {}, 'Default-Service-Utility');
|
|
3157
|
+
this.Utility = this.serviceManager.defaultServices.Utility;
|
|
2654
3158
|
this.services = this.serviceManager.services;
|
|
2655
3159
|
this.defaultServices = this.serviceManager.defaultServices;
|
|
2656
3160
|
}
|
|
@@ -2702,13 +3206,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2702
3206
|
module.exports.ServiceProviderBase = libFableServiceManager.ServiceProviderBase;
|
|
2703
3207
|
module.exports.precedent = libFableSettings.precedent;
|
|
2704
3208
|
}, {
|
|
2705
|
-
"./Fable-Operation.js":
|
|
2706
|
-
"./Fable-Service-
|
|
2707
|
-
"./Fable-
|
|
2708
|
-
"./Fable-Utility.js": 39,
|
|
2709
|
-
"
|
|
2710
|
-
"fable-
|
|
2711
|
-
"fable-
|
|
3209
|
+
"./Fable-Operation.js": 36,
|
|
3210
|
+
"./Fable-Service-DataArithmatic.js": 37,
|
|
3211
|
+
"./Fable-Service-Template.js": 38,
|
|
3212
|
+
"./Fable-Service-Utility.js": 39,
|
|
3213
|
+
"./Fable-ServiceManager.js": 40,
|
|
3214
|
+
"fable-log": 23,
|
|
3215
|
+
"fable-settings": 26,
|
|
3216
|
+
"fable-uuid": 28
|
|
2712
3217
|
}]
|
|
2713
|
-
}, {}, [
|
|
3218
|
+
}, {}, [35])(35);
|
|
2714
3219
|
});
|