fable 3.0.124 → 3.0.125
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/debug/Harness.js +52 -13
- package/dist/fable.compatible.js +23 -16
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +23 -16
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/package.json +2 -2
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-StringParser.js +23 -14
- package/source/services/Fable-Service-MetaTemplate.js +4 -2
- package/source/services/Fable-Service-Template.js +1 -1
- package/test/MetaTemplating_tests.js +41 -1
package/debug/Harness.js
CHANGED
|
@@ -1,24 +1,63 @@
|
|
|
1
|
+
//let libBookstore = require('../retold-harness/bookstore-serve-meadow-endpoint-apis-run.js');
|
|
2
|
+
const libFable = require('../source/Fable.js');
|
|
1
3
|
|
|
4
|
+
let testFable = new libFable({"Product": "ProgressTrackerExample"});
|
|
2
5
|
|
|
3
|
-
testFable.addServiceType('SimpleService', SimpleService);
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
let tmpTestArray = [
|
|
8
|
+
{Name:'Jimbo', Age: 12},
|
|
9
|
+
{Name:'Susan', Age: 17},
|
|
10
|
+
{Name:'Chris', Age: 15},
|
|
11
|
+
{Name:'Reginald', Age: 19},
|
|
12
|
+
{Name:'Wendy', Age: 14},
|
|
13
|
+
{Name:'Dwight', Age: 16},
|
|
14
|
+
{Name:'Jimbo2', Age: 18},
|
|
15
|
+
{Name:'Susan2', Age: 13},
|
|
16
|
+
{Name:'Chris2', Age: 15},
|
|
17
|
+
{Name:'Reginald2', Age: 19}
|
|
18
|
+
];
|
|
6
19
|
|
|
20
|
+
let tmpProgressTracker = testFable.instantiateServiceProvider('ProgressTrackerSet');
|
|
7
21
|
|
|
8
|
-
|
|
22
|
+
let tmpTestIterations = 50000000;
|
|
23
|
+
// How many interstitial messages we want.
|
|
24
|
+
let tmpMessageChunkSize = tmpTestIterations / 5;
|
|
9
25
|
|
|
10
|
-
|
|
26
|
+
tmpProgressTracker.createProgressTracker('ArrayFromPerformance', tmpTestIterations);
|
|
27
|
+
tmpProgressTracker.logProgressTrackerStatus('ArrayFromPerformance');
|
|
28
|
+
for (let i = 0; i < tmpTestIterations; i++)
|
|
29
|
+
{
|
|
30
|
+
let tmpArray = Array.from(tmpTestArray);
|
|
31
|
+
tmpArray.push({Name:'NewGuy', Age: 21});
|
|
11
32
|
|
|
12
|
-
|
|
33
|
+
tmpProgressTracker.incrementProgressTracker('ArrayFromPerformance', 1);
|
|
13
34
|
|
|
14
|
-
|
|
35
|
+
if (i % tmpMessageChunkSize == 0)
|
|
36
|
+
{
|
|
37
|
+
tmpProgressTracker.logProgressTrackerStatus('ArrayFromPerformance');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
tmpProgressTracker.endProgressTracker('ArrayFromPerformance');
|
|
41
|
+
tmpProgressTracker.logProgressTrackerStatus('ArrayFromPerformance');
|
|
42
|
+
|
|
43
|
+
tmpProgressTracker.createProgressTracker('ForLoopPerformance', tmpTestIterations);
|
|
44
|
+
tmpProgressTracker.logProgressTrackerStatus('ForLoopPerformance');
|
|
45
|
+
for (let i = 0; i < tmpTestIterations; i++)
|
|
46
|
+
{
|
|
47
|
+
let tmpArray = [];
|
|
48
|
+
for (let j = 0; j < tmpTestArray.length; j++)
|
|
49
|
+
{
|
|
50
|
+
tmpArray.push(tmpTestArray[j]);
|
|
51
|
+
}
|
|
52
|
+
tmpArray.push({Name:'NewGuy', Age: 21});
|
|
15
53
|
|
|
16
|
-
|
|
17
|
-
let tmpRestClient = testFable.instantiateServiceProvider('RestClient', {TraceLog: true}, 'RestClient-99');
|
|
54
|
+
tmpProgressTracker.incrementProgressTracker('ForLoopPerformance', 1);
|
|
18
55
|
|
|
19
|
-
|
|
20
|
-
tmpRestClient.getJSON('https://en.wiktionary.org/w/api.php?action=parse&prop=wikitext&format=json&page=dog',
|
|
21
|
-
(pError, pResponse, pBody)=>
|
|
56
|
+
if (i % tmpMessageChunkSize == 0)
|
|
22
57
|
{
|
|
23
|
-
|
|
24
|
-
}
|
|
58
|
+
tmpProgressTracker.logProgressTrackerStatus('ForLoopPerformance');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
tmpProgressTracker.endProgressTracker('ForLoopPerformance');
|
|
62
|
+
tmpProgressTracker.logProgressTrackerStatus('ForLoopPerformance');
|
|
63
|
+
|
package/dist/fable.compatible.js
CHANGED
|
@@ -3381,8 +3381,10 @@ return _this25.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pC
|
|
|
3381
3381
|
* @method parseString
|
|
3382
3382
|
* @param {string} pString - The string to parse
|
|
3383
3383
|
* @param {object} pData - Data to pass in as the second argument
|
|
3384
|
+
* @param {function} fCallback - The callback function to call when a pattern is matched
|
|
3385
|
+
* @param {array} pDataContext - The history of data objects already passed in
|
|
3384
3386
|
* @return {string} The result from the parser
|
|
3385
|
-
*/},{key:"parseString",value:function parseString(pString,pData,fCallback){if(this.LogNoisiness>4){this.fable.log.trace("Metatemplate parsing template string [".concat(pString,"] where the callback is a ").concat(_typeof(fCallback)),{TemplateData:pData});}return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback);}}]);return FableServiceMetaTemplate;}(libFableServiceBase);module.exports=FableServiceMetaTemplate;},{"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":138,"./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js":139,"fable-serviceproviderbase":51}],138:[function(require,module,exports){/**
|
|
3387
|
+
*/},{key:"parseString",value:function parseString(pString,pData,fCallback,pDataContext){if(this.LogNoisiness>4){this.fable.log.trace("Metatemplate parsing template string [".concat(pString,"] where the callback is a ").concat(_typeof(fCallback)),{TemplateData:pData});}return this.StringParser.parseString(pString,this.ParseTree,pData,fCallback,pDataContext);}}]);return FableServiceMetaTemplate;}(libFableServiceBase);module.exports=FableServiceMetaTemplate;},{"./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js":138,"./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js":139,"fable-serviceproviderbase":51}],138:[function(require,module,exports){/**
|
|
3386
3388
|
* String Parser
|
|
3387
3389
|
* @author Steven Velozo <steven@velozo.com>
|
|
3388
3390
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
@@ -3414,42 +3416,45 @@ pParserState.Pattern=false;pParserState.PatternStartNode=false;pParserState.Star
|
|
|
3414
3416
|
* @param {string} pCharacter - The character to append
|
|
3415
3417
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
3416
3418
|
* @private
|
|
3417
|
-
*/},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData){// If we are already in a pattern match traversal
|
|
3419
|
+
*/},{key:"parseCharacter",value:function parseCharacter(pCharacter,pParserState,pData,pDataContext){// If we are already in a pattern match traversal
|
|
3418
3420
|
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
3419
3421
|
if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
3420
3422
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
3421
3423
|
this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
|
|
3422
3424
|
if(pParserState.Pattern.hasOwnProperty('Parse')&&(!pParserState.Pattern.isAsync||pParserState.Pattern.isBoth)){// Run the function
|
|
3423
|
-
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);return this.resetOutputBuffer(pParserState);}else{this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));return this.resetOutputBuffer(pParserState);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
3425
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);return this.resetOutputBuffer(pParserState);}else{this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));return this.resetOutputBuffer(pParserState);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
3424
3426
|
pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
|
|
3425
3427
|
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
3426
3428
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
|
|
3427
3429
|
if(pParserState.Pattern.hasOwnProperty('Parse')){if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){this.fable.log.info("MetaTemplate: The pattern ".concat(pParserState.Pattern.PatternStartString," is asynchronous and cannot be used in a synchronous parser."));this.resetOutputBuffer(pParserState);}else{// Run the t*mplate function
|
|
3428
|
-
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);return this.resetOutputBuffer(pParserState);}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
3430
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);return this.resetOutputBuffer(pParserState);}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
3429
3431
|
this.resetOutputBuffer(pParserState);}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
3430
3432
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
3431
3433
|
if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
|
|
3432
|
-
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}},{key:"executePatternAsync",value:function executePatternAsync(pParserState,pData,fCallback){var _this28=this;// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
3434
|
+
this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}},{key:"executePatternAsync",value:function executePatternAsync(pParserState,pData,fCallback,pDataContext){var _this28=this;// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
3433
3435
|
// Trim the start and end tags off the output buffer now
|
|
3434
3436
|
if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){// Run the function
|
|
3435
|
-
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this28.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this28.resetOutputBuffer(pParserState);return fCallback();});}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
|
|
3436
|
-
return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this28.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this28.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
3437
|
-
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}/**
|
|
3437
|
+
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this28.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this28.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
|
|
3438
|
+
return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){_this28.fable.log.info("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this28.resetOutputBuffer(pParserState);return fCallback();},pDataContext);}else{// Run the t*mplate function
|
|
3439
|
+
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,pDataContext);this.resetOutputBuffer(pParserState);return fCallback();}}/**
|
|
3438
3440
|
* Parse a character in the buffer.
|
|
3439
|
-
* @method
|
|
3441
|
+
* @method parseCharacterAsync
|
|
3440
3442
|
* @param {string} pCharacter - The character to append
|
|
3441
3443
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
3444
|
+
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
3445
|
+
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
3446
|
+
* @param {array} pDataContext - The history of data objects/context already passed in
|
|
3442
3447
|
* @private
|
|
3443
|
-
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){// If we are already in a pattern match traversal
|
|
3448
|
+
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback,pDataContext){// If we are already in a pattern match traversal
|
|
3444
3449
|
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
3445
3450
|
if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
3446
3451
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
3447
3452
|
this.appendOutputBuffer(pCharacter,pParserState);// If this last character is the end of the pattern, parse it.
|
|
3448
|
-
if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
3453
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
3449
3454
|
pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
|
|
3450
3455
|
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
3451
3456
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last character is the end of the pattern, parse it.
|
|
3452
|
-
if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback);}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
3457
|
+
if(pParserState.Pattern.hasOwnProperty('Parse')){return this.executePatternAsync(pParserState,pData,fCallback,pDataContext);}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
3453
3458
|
this.resetOutputBuffer(pParserState);}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
3454
3459
|
else{// This may be the start of a new pattern....
|
|
3455
3460
|
if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root node as the matched node.
|
|
@@ -3462,9 +3467,11 @@ return fCallback();}/**
|
|
|
3462
3467
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
3463
3468
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
3464
3469
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
var
|
|
3470
|
+
* @param {array} pDataContext - The history of data objects/context already passed in
|
|
3471
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback,pDataContext){var _this29=this;// TODO: There is danger here if a template function attempts to functionally recurse and doesn't pass this in.
|
|
3472
|
+
var tmpPreviousDataContext=Array.isArray(pDataContext)?pDataContext:[];var tmpDataContext=Array.from(tmpPreviousDataContext);tmpDataContext.push(pData);if(typeof fCallback!=='function'){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
3473
|
+
this.parseCharacter(pString[i],tmpParserState,pData,tmpDataContext);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
3474
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;var tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');var _loop=function _loop(_i15){tmpAnticipate.anticipate(function(fCallback){_this29.parseCharacterAsync(pString[_i15],_tmpParserState,pData,fCallback,tmpDataContext);});};for(var _i15=0;_i15<pString.length;_i15++){_loop(_i15);}tmpAnticipate.wait(function(pError){// Flush the remaining data
|
|
3468
3475
|
_this29.flushOutputBuffer(_tmpParserState);return fCallback(pError,_tmpParserState.Output);});}}}]);return StringParser;}();module.exports=StringParser;},{}],139:[function(require,module,exports){/**
|
|
3469
3476
|
* Word Tree
|
|
3470
3477
|
* @author Steven Velozo <steven@velozo.com>
|
|
@@ -3574,7 +3581,7 @@ GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper funct
|
|
|
3574
3581
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
3575
3582
|
_this38.templateEscapes={'\\':'\\',"'":"'",'r':'\r','\r':'r','n':'\n','\n':'n','t':'\t','\t':'t','u2028':"\u2028","\u2028":'u2028','u2029':"\u2029","\u2029":'u2029'};// This is defined as such to underscore that it is a dynamic programming
|
|
3576
3583
|
// function on this class.
|
|
3577
|
-
_this38.renderFunction=false;_this38.templateString=false;return _this38;}_createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(
|
|
3584
|
+
_this38.renderFunction=false;_this38.templateString=false;return _this38;}_createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(){var fRenderTemplateBound=this.renderTemplate.bind(this);return fRenderTemplateBound;}},{key:"buildTemplateFunction",value:function buildTemplateFunction(pTemplateText,pData){var _this39=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
3578
3585
|
// underscore code until this is rewritten using precedent.
|
|
3579
3586
|
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this39.templateEscapes[pMatch]);}).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"'+\n(".concat(decodeURIComponent(pCode),")+\n'");}).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"';\n".concat(decodeURIComponent(pCode),"\n;__p+='");})+"';\n";this.TemplateSource="with(pTemplateDataObject||{}){\n".concat(this.TemplateSource,"}\n");this.TemplateSource="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n".concat(this.TemplateSource,"return __p;\n");this.renderFunction=new Function('pTemplateDataObject',this.TemplateSource);if(typeof pData!='undefined'){return this.renderFunction(pData);}// Provide the compiled function source as a convenience for build time
|
|
3580
3587
|
// precompilation.
|