fable 3.0.20 → 3.0.22
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 +701 -143
- package/dist/fable.compatible.min.js +19 -14
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +618 -119
- package/dist/fable.min.js +19 -14
- package/dist/fable.min.js.map +1 -1
- package/package.json +4 -2
- package/source/Fable-Service-DataArithmatic.js +16 -0
- package/source/Fable-Service-MetaTemplate.js +41 -0
- package/source/{Fable-Utility.js → Fable-Service-Utility.js} +16 -4
- package/source/Fable.js +18 -4
- package/test/FableDataArithmatic_tests.js +223 -0
- package/test/FableMetaTemplating_tests.js +96 -0
- package/test/FableOperations_tests.js +0 -1
- package/test/FableUtility_tests.js +0 -1
- 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": 43
|
|
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,80 @@ 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) {
|
|
2809
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
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": 42,
|
|
2827
|
+
"data-arithmatic": 17
|
|
2828
|
+
}],
|
|
2829
|
+
38: [function (require, module, exports) {
|
|
2830
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2831
|
+
var libPrecedent = require('precedent');
|
|
2832
|
+
var FableServiceMetaTemplate = /*#__PURE__*/function (_libFableServiceBase2) {
|
|
2833
|
+
_inherits(FableServiceMetaTemplate, _libFableServiceBase2);
|
|
2834
|
+
var _super4 = _createSuper(FableServiceMetaTemplate);
|
|
2835
|
+
function FableServiceMetaTemplate(pFable, pOptions, pServiceHash) {
|
|
2836
|
+
var _this5;
|
|
2837
|
+
_classCallCheck(this, FableServiceMetaTemplate);
|
|
2838
|
+
_this5 = _super4.call(this, pFable, pOptions, pServiceHash);
|
|
2839
|
+
_this5.serviceType = 'MetaTemplate';
|
|
2840
|
+
_this5._MetaTemplateLibrary = new libPrecedent(_this5.options);
|
|
2841
|
+
return _this5;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
/**
|
|
2845
|
+
* Add a Pattern to the Parse Tree
|
|
2846
|
+
* @method addPattern
|
|
2847
|
+
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
2848
|
+
* @param {string} pPattern - The string to add to the tree
|
|
2849
|
+
* @param {number} pIndex - callback function
|
|
2850
|
+
* @return {bool} True if adding the pattern was successful
|
|
2851
|
+
*/
|
|
2852
|
+
_createClass(FableServiceMetaTemplate, [{
|
|
2853
|
+
key: "addPattern",
|
|
2854
|
+
value: function addPattern(pPatternStart, pPatternEnd, pParser) {
|
|
2855
|
+
return this._MetaTemplateLibrary.addPattern(pPatternStart, pPatternEnd, pParser);
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* Parse a string with the existing parse tree
|
|
2860
|
+
* @method parseString
|
|
2861
|
+
* @param {string} pString - The string to parse
|
|
2862
|
+
* @return {string} The result from the parser
|
|
2863
|
+
*/
|
|
2864
|
+
}, {
|
|
2865
|
+
key: "parseString",
|
|
2866
|
+
value: function parseString(pString) {
|
|
2867
|
+
return this._MetaTemplateLibrary.parseString(pString, this.ParseTree);
|
|
2868
|
+
}
|
|
2869
|
+
}]);
|
|
2870
|
+
return FableServiceMetaTemplate;
|
|
2871
|
+
}(libFableServiceBase);
|
|
2872
|
+
module.exports = FableServiceMetaTemplate;
|
|
2873
|
+
}, {
|
|
2874
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2875
|
+
"precedent": 30
|
|
2876
|
+
}],
|
|
2877
|
+
39: [function (require, module, exports) {
|
|
2353
2878
|
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2354
|
-
var FableServiceTemplate = /*#__PURE__*/function (
|
|
2355
|
-
_inherits(FableServiceTemplate,
|
|
2356
|
-
var
|
|
2879
|
+
var FableServiceTemplate = /*#__PURE__*/function (_libFableServiceBase3) {
|
|
2880
|
+
_inherits(FableServiceTemplate, _libFableServiceBase3);
|
|
2881
|
+
var _super5 = _createSuper(FableServiceTemplate);
|
|
2357
2882
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2358
2883
|
// string-based template with code snippets into simple executable pieces,
|
|
2359
2884
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -2364,14 +2889,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2364
2889
|
// This is an implementation of that.
|
|
2365
2890
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2366
2891
|
function FableServiceTemplate(pFable, pOptions, pServiceHash) {
|
|
2367
|
-
var
|
|
2892
|
+
var _this6;
|
|
2368
2893
|
_classCallCheck(this, FableServiceTemplate);
|
|
2369
|
-
|
|
2370
|
-
|
|
2894
|
+
_this6 = _super5.call(this, pFable, pOptions, pServiceHash);
|
|
2895
|
+
_this6.serviceType = 'Template';
|
|
2371
2896
|
|
|
2372
2897
|
// These are the exact regex's used in lodash/underscore
|
|
2373
2898
|
// TODO: Switch this to precedent
|
|
2374
|
-
|
|
2899
|
+
_this6.Matchers = {
|
|
2375
2900
|
Evaluate: /<%([\s\S]+?)%>/g,
|
|
2376
2901
|
Interpolate: /<%=([\s\S]+?)%>/g,
|
|
2377
2902
|
Escaper: /\\|'|\r|\n|\t|\u2028|\u2029/g,
|
|
@@ -2382,7 +2907,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2382
2907
|
|
|
2383
2908
|
// This is a helper for the escaper and unescaper functions.
|
|
2384
2909
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
2385
|
-
|
|
2910
|
+
_this6.templateEscapes = {
|
|
2386
2911
|
'\\': '\\',
|
|
2387
2912
|
"'": "'",
|
|
2388
2913
|
'r': '\r',
|
|
@@ -2399,9 +2924,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2399
2924
|
|
|
2400
2925
|
// This is defined as such to underscore that it is a dynamic programming
|
|
2401
2926
|
// function on this class.
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
return
|
|
2927
|
+
_this6.renderFunction = false;
|
|
2928
|
+
_this6.templateString = false;
|
|
2929
|
+
return _this6;
|
|
2405
2930
|
}
|
|
2406
2931
|
_createClass(FableServiceTemplate, [{
|
|
2407
2932
|
key: "renderTemplate",
|
|
@@ -2417,11 +2942,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2417
2942
|
}, {
|
|
2418
2943
|
key: "buildTemplateFunction",
|
|
2419
2944
|
value: function buildTemplateFunction(pTemplateText, pData) {
|
|
2420
|
-
var
|
|
2945
|
+
var _this7 = this;
|
|
2421
2946
|
// For now this is being kept in a weird form ... this is to mimic the old
|
|
2422
2947
|
// underscore code until this is rewritten using precedent.
|
|
2423
2948
|
this.TemplateSource = "__p+='" + pTemplateText.replace(this.Matchers.Escaper, function (pMatch) {
|
|
2424
|
-
return "\\".concat(
|
|
2949
|
+
return "\\".concat(_this7.templateEscapes[pMatch]);
|
|
2425
2950
|
}).replace(this.Matchers.Interpolate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
2426
2951
|
return "'+\n(".concat(decodeURIComponent(pCode), ")+\n'");
|
|
2427
2952
|
}).replace(this.Matchers.Evaluate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
@@ -2444,9 +2969,98 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2444
2969
|
}(libFableServiceBase);
|
|
2445
2970
|
module.exports = FableServiceTemplate;
|
|
2446
2971
|
}, {
|
|
2447
|
-
"./Fable-ServiceProviderBase.js":
|
|
2972
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
2448
2973
|
}],
|
|
2449
|
-
|
|
2974
|
+
40: [function (require, module, exports) {
|
|
2975
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2976
|
+
|
|
2977
|
+
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2978
|
+
var libAsyncWaterfall = require('async.waterfall');
|
|
2979
|
+
var libAsyncEachLimit = require('async.eachlimit');
|
|
2980
|
+
var FableServiceUtility = /*#__PURE__*/function (_libFableServiceBase4) {
|
|
2981
|
+
_inherits(FableServiceUtility, _libFableServiceBase4);
|
|
2982
|
+
var _super6 = _createSuper(FableServiceUtility);
|
|
2983
|
+
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2984
|
+
// string-based template with code snippets into simple executable pieces,
|
|
2985
|
+
// with the added twist of returning a precompiled function ready to go.
|
|
2986
|
+
//
|
|
2987
|
+
// NOTE: This does not implement underscore escape expressions
|
|
2988
|
+
// NOTE: This does not implement underscore magic browser variable assignment
|
|
2989
|
+
//
|
|
2990
|
+
// This is an implementation of that.
|
|
2991
|
+
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2992
|
+
function FableServiceUtility(pFable, pOptions, pServiceHash) {
|
|
2993
|
+
var _this8;
|
|
2994
|
+
_classCallCheck(this, FableServiceUtility);
|
|
2995
|
+
_this8 = _super6.call(this, pFable, pOptions, pServiceHash);
|
|
2996
|
+
_this8.templates = {};
|
|
2997
|
+
|
|
2998
|
+
// These two functions are used extensively throughout
|
|
2999
|
+
_this8.waterfall = libAsyncWaterfall;
|
|
3000
|
+
_this8.eachLimit = libAsyncEachLimit;
|
|
3001
|
+
return _this8;
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
3005
|
+
// Now that es6 gives us this, use the native thingy.
|
|
3006
|
+
_createClass(FableServiceUtility, [{
|
|
3007
|
+
key: "extend",
|
|
3008
|
+
value: function extend(pDestinationObject) {
|
|
3009
|
+
for (var _len = arguments.length, pSourceObjects = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3010
|
+
pSourceObjects[_key - 1] = arguments[_key];
|
|
3011
|
+
}
|
|
3012
|
+
return Object.assign.apply(Object, [pDestinationObject].concat(pSourceObjects));
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
3016
|
+
// string-based template with code snippets into simple executable pieces,
|
|
3017
|
+
// with the added twist of returning a precompiled function ready to go.
|
|
3018
|
+
}, {
|
|
3019
|
+
key: "template",
|
|
3020
|
+
value: function template(pTemplateText, pData) {
|
|
3021
|
+
var tmpTemplate = this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');
|
|
3022
|
+
return tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
// Build a template function from a template hash, and, register it with the service provider
|
|
3026
|
+
}, {
|
|
3027
|
+
key: "buildHashedTemplate",
|
|
3028
|
+
value: function buildHashedTemplate(pTemplateHash, pTemplateText, pData) {
|
|
3029
|
+
var tmpTemplate = this.fable.serviceManager.instantiateServiceProvider('Template', {}, pTemplateHash);
|
|
3030
|
+
this.templates[pTemplateHash] = tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
3031
|
+
return this.templates[pTemplateHash];
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
// This is a safe, modern version of chunk from underscore
|
|
3035
|
+
// Algorithm pulled from a mix of these two polyfills:
|
|
3036
|
+
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_chunk
|
|
3037
|
+
// https://youmightnotneed.com/lodash
|
|
3038
|
+
// This implementation was most tolerant in browsers. Uglify can fix the rest.
|
|
3039
|
+
}, {
|
|
3040
|
+
key: "chunk",
|
|
3041
|
+
value: function chunk(pInput, pChunkSize, pChunkCache) {
|
|
3042
|
+
var tmpInputArray = _toConsumableArray(pInput);
|
|
3043
|
+
// Note lodash defaults to 1, underscore defaults to 0
|
|
3044
|
+
var tmpChunkSize = typeof pChunkSize == 'number' ? pChunkSize : 0;
|
|
3045
|
+
var tmpChunkCache = typeof pChunkCache != 'undefined' ? pChunkCache : [];
|
|
3046
|
+
if (tmpChunkSize <= 0) {
|
|
3047
|
+
return tmpChunkCache;
|
|
3048
|
+
}
|
|
3049
|
+
while (tmpInputArray.length) {
|
|
3050
|
+
tmpChunkCache.push(tmpInputArray.splice(0, tmpChunkSize));
|
|
3051
|
+
}
|
|
3052
|
+
return tmpChunkCache;
|
|
3053
|
+
}
|
|
3054
|
+
}]);
|
|
3055
|
+
return FableServiceUtility;
|
|
3056
|
+
}(libFableServiceBase);
|
|
3057
|
+
module.exports = FableServiceUtility;
|
|
3058
|
+
}, {
|
|
3059
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
3060
|
+
"async.eachlimit": 1,
|
|
3061
|
+
"async.waterfall": 15
|
|
3062
|
+
}],
|
|
3063
|
+
41: [function (require, module, exports) {
|
|
2450
3064
|
/**
|
|
2451
3065
|
* Fable Application Services Management
|
|
2452
3066
|
* @license MIT
|
|
@@ -2524,9 +3138,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2524
3138
|
module.exports = FableService;
|
|
2525
3139
|
module.exports.ServiceProviderBase = libFableServiceBase;
|
|
2526
3140
|
}, {
|
|
2527
|
-
"./Fable-ServiceProviderBase.js":
|
|
3141
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
2528
3142
|
}],
|
|
2529
|
-
|
|
3143
|
+
42: [function (require, module, exports) {
|
|
2530
3144
|
/**
|
|
2531
3145
|
* Fable Service Base
|
|
2532
3146
|
* @license MIT
|
|
@@ -2542,80 +3156,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2542
3156
|
});
|
|
2543
3157
|
module.exports = FableServiceProviderBase;
|
|
2544
3158
|
}, {}],
|
|
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) {
|
|
3159
|
+
43: [function (require, module, exports) {
|
|
2619
3160
|
/**
|
|
2620
3161
|
* Fable Application Services Support Library
|
|
2621
3162
|
* @license MIT
|
|
@@ -2624,9 +3165,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2624
3165
|
var libFableSettings = require('fable-settings');
|
|
2625
3166
|
var libFableUUID = require('fable-uuid');
|
|
2626
3167
|
var libFableLog = require('fable-log');
|
|
2627
|
-
var libFableUtility = require('./Fable-Utility.js');
|
|
2628
3168
|
var libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
3169
|
+
var libFableServiceDataArithmatic = require('./Fable-Service-DataArithmatic.js');
|
|
2629
3170
|
var libFableServiceTemplate = require('./Fable-Service-Template.js');
|
|
3171
|
+
var libFableServiceMetaTemplate = require('./Fable-Service-MetaTemplate.js');
|
|
3172
|
+
var libFableServiceUtility = require('./Fable-Service-Utility.js');
|
|
2630
3173
|
var libFableOperation = require('./Fable-Operation.js');
|
|
2631
3174
|
var Fable = /*#__PURE__*/function () {
|
|
2632
3175
|
function Fable(pSettings) {
|
|
@@ -2639,9 +3182,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2639
3182
|
this.log = new libFableLog(this.settingsManager.settings);
|
|
2640
3183
|
this.log.initialize();
|
|
2641
3184
|
|
|
2642
|
-
// Built-in utility belt functions
|
|
2643
|
-
this.Utility = new libFableUtility(this);
|
|
2644
|
-
|
|
2645
3185
|
// Built-in dependencies
|
|
2646
3186
|
this.Dependencies = {
|
|
2647
3187
|
precedent: libFableSettings.precedent
|
|
@@ -2650,7 +3190,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2650
3190
|
// Location for Operation state
|
|
2651
3191
|
this.Operations = {};
|
|
2652
3192
|
this.serviceManager = new libFableServiceManager(this);
|
|
3193
|
+
|
|
3194
|
+
// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
3195
|
+
this.serviceManager.addServiceType('DataArithmatic', libFableServiceDataArithmatic);
|
|
3196
|
+
this.fable.serviceManager.instantiateServiceProvider('DataArithmatic', {}, 'Default-Service-DataArithmatic');
|
|
3197
|
+
// This service is passing through the data arithmatic library
|
|
3198
|
+
this.DataArithmatic = this.serviceManager.defaultServices.DataArithmatic._DataArithmaticLibrary;
|
|
3199
|
+
|
|
3200
|
+
// Initialize the template service
|
|
2653
3201
|
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
3202
|
+
|
|
3203
|
+
// Initialize the metatemplate service
|
|
3204
|
+
this.serviceManager.addServiceType('MetaTemplate', libFableServiceMetaTemplate);
|
|
3205
|
+
|
|
3206
|
+
// Initialize and instantiate the default baked-in Utility service
|
|
3207
|
+
this.serviceManager.addServiceType('Utility', libFableServiceUtility);
|
|
3208
|
+
this.fable.serviceManager.instantiateServiceProvider('Utility', {}, 'Default-Service-Utility');
|
|
3209
|
+
this.Utility = this.serviceManager.defaultServices.Utility;
|
|
2654
3210
|
this.services = this.serviceManager.services;
|
|
2655
3211
|
this.defaultServices = this.serviceManager.defaultServices;
|
|
2656
3212
|
}
|
|
@@ -2702,13 +3258,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2702
3258
|
module.exports.ServiceProviderBase = libFableServiceManager.ServiceProviderBase;
|
|
2703
3259
|
module.exports.precedent = libFableSettings.precedent;
|
|
2704
3260
|
}, {
|
|
2705
|
-
"./Fable-Operation.js":
|
|
2706
|
-
"./Fable-Service-
|
|
2707
|
-
"./Fable-
|
|
2708
|
-
"./Fable-
|
|
2709
|
-
"
|
|
2710
|
-
"
|
|
2711
|
-
"fable-
|
|
3261
|
+
"./Fable-Operation.js": 36,
|
|
3262
|
+
"./Fable-Service-DataArithmatic.js": 37,
|
|
3263
|
+
"./Fable-Service-MetaTemplate.js": 38,
|
|
3264
|
+
"./Fable-Service-Template.js": 39,
|
|
3265
|
+
"./Fable-Service-Utility.js": 40,
|
|
3266
|
+
"./Fable-ServiceManager.js": 41,
|
|
3267
|
+
"fable-log": 23,
|
|
3268
|
+
"fable-settings": 26,
|
|
3269
|
+
"fable-uuid": 28
|
|
2712
3270
|
}]
|
|
2713
|
-
}, {}, [
|
|
3271
|
+
}, {}, [35])(35);
|
|
2714
3272
|
});
|