fable 3.0.139 → 3.0.141
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 +30 -30
- package/dist/fable.compatible.js +26 -11
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +26 -11
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/example_applications/mathematical_playground/Equations.json +1 -1
- package/example_applications/mathematical_playground/Math-Solver-Harness.js +30 -27
- package/package.json +2 -2
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json +4 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Messaging.js +22 -2
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js +1 -1
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js +62 -9
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-TokenMap.json +8 -0
- package/source/services/Fable-Service-Math.js +17 -1
- package/test/ExpressionParser_tests.js +17 -0
package/debug/Harness.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const libFable = require('../source/Fable.js');
|
|
1
|
+
// const libFable = require('../source/Fable.js');
|
|
2
2
|
|
|
3
|
-
const _Fable = new libFable({"Product": "Hn"});
|
|
4
|
-
const _ExpressionParser = _Fable.instantiateServiceProviderIfNotExists('ExpressionParser');
|
|
3
|
+
// const _Fable = new libFable({"Product": "Hn"});
|
|
4
|
+
// const _ExpressionParser = _Fable.instantiateServiceProviderIfNotExists('ExpressionParser');
|
|
5
5
|
|
|
6
|
-
const _Expression = "TotalCost = SUM(ItemCosts)";
|
|
7
|
-
const _Values = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const _Manyfest = _Fable.newManyfest(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
// const _Expression = "TotalCost = SUM(ItemCosts)";
|
|
7
|
+
// const _Values = (
|
|
8
|
+
// {
|
|
9
|
+
// "ItemCosts": [100,200,50,45,5]
|
|
10
|
+
// });
|
|
11
|
+
// const _Manyfest = _Fable.newManyfest(
|
|
12
|
+
// {
|
|
13
|
+
// "Scope":"None",
|
|
14
|
+
// "Descriptors":
|
|
15
|
+
// {
|
|
16
|
+
// "Bill.Items[].Cost":
|
|
17
|
+
// {
|
|
18
|
+
// "Name":"Costs of the Bill Items",
|
|
19
|
+
// "Hash":"BillItemCosts"
|
|
20
|
+
// }
|
|
21
|
+
// }
|
|
22
|
+
// });
|
|
23
23
|
|
|
24
|
-
const _SolveResultsObject = {};
|
|
25
|
-
const _DataDestinationObject = {};
|
|
24
|
+
// const _SolveResultsObject = {};
|
|
25
|
+
// const _DataDestinationObject = {};
|
|
26
26
|
|
|
27
|
-
let tmpResult = _ExpressionParser.solve(_Expression, _Values, _SolveResultsObject, _Manyfest, _DataDestinationObject);
|
|
28
|
-
for (let i = 0; i < _SolveResultsObject.PostfixSolveList.length; i++)
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
console.log(`Result: ${tmpResult}`);
|
|
27
|
+
// let tmpResult = _ExpressionParser.solve(_Expression, _Values, _SolveResultsObject, _Manyfest, _DataDestinationObject);
|
|
28
|
+
// for (let i = 0; i < _SolveResultsObject.PostfixSolveList.length; i++)
|
|
29
|
+
// {
|
|
30
|
+
// let tmpToken = _SolveResultsObject.PostfixSolveList[i];
|
|
31
|
+
// console.log(`${i}: ${tmpToken.VirtualSymbolName} = (${tmpToken.LeftValue.Token}::${tmpToken.LeftValue.Value}) ${tmpToken.Operation.Token} (${tmpToken.RightValue.Token}::${tmpToken.RightValue.Value}) `)
|
|
32
|
+
// }
|
|
33
|
+
// console.log(`Result: ${tmpResult}`);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const libMathHarness = require('../example_applications/mathematical_playground/Math-Solver-Harness.js');
|
package/dist/fable.compatible.js
CHANGED
|
@@ -1592,7 +1592,7 @@ else if(tmpInTranslationTable){tmpAddress=this.hashTranslations.translate(pHash)
|
|
|
1592
1592
|
else{tmpAddress=pHash;}return tmpAddress;}// Get the value of an element by its hash
|
|
1593
1593
|
},{key:"getValueByHash",value:function getValueByHash(pObject,pHash){var tmpValue=this.getValueAtAddress(pObject,this.resolveHashAddress(pHash));if(typeof tmpValue=='undefined'){// Try to get a default if it exists
|
|
1594
1594
|
tmpValue=this.getDefaultValue(this.getDescriptorByHash(pHash));}return tmpValue;}// Get the value of an element at an address
|
|
1595
|
-
},{key:"getValueAtAddress",value:function getValueAtAddress(pObject,pAddress){var tmpValue=this.objectAddressGetValue.getValueAtAddress(pObject,pAddress);if(typeof tmpValue=='undefined'){// Try to get a default if it exists
|
|
1595
|
+
},{key:"getValueAtAddress",value:function getValueAtAddress(pObject,pAddress){var tmpLintedAddress=pAddress.trim();if(tmpLintedAddress==''){this.logError("(".concat(this.scope,") Error getting value at address; address is an empty string."),pObject);return undefined;}var tmpValue=this.objectAddressGetValue.getValueAtAddress(pObject,pAddress);if(typeof tmpValue=='undefined'){// Try to get a default if it exists
|
|
1596
1596
|
tmpValue=this.getDefaultValue(this.getDescriptor(pAddress));}return tmpValue;}// Set the value of an element by its hash
|
|
1597
1597
|
},{key:"setValueByHash",value:function setValueByHash(pObject,pHash,pValue){return this.setValueAtAddress(pObject,this.resolveHashAddress(pHash),pValue);}// Set the value of an element at an address
|
|
1598
1598
|
},{key:"setValueAtAddress",value:function setValueAtAddress(pObject,pAddress,pValue){return this.objectAddressSetValue.setValueAtAddress(pObject,pAddress,pValue);}// Delete the value of an element by its hash
|
|
@@ -3493,7 +3493,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
3493
3493
|
// }
|
|
3494
3494
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
3495
3495
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
3496
|
-
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);return ExpressionTokenizer;}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":136}],138:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"}};},{}],139:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserLinter=/*#__PURE__*/function(_libExpressionParserO2){_inherits(ExpressionParserLinter,_libExpressionParserO2);function ExpressionParserLinter(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,ExpressionParserLinter);_this27=_callSuper(this,ExpressionParserLinter,[pFable,pOptions,pServiceHash]);_this27.serviceType='ExpressionParser-Linter';return _this27;}_createClass2(ExpressionParserLinter,[{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
3496
|
+
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}return tmpResults.RawTokens;}}]);return ExpressionTokenizer;}(libExpressionParserOperationBase);module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":136}],138:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"}};},{}],139:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserLinter=/*#__PURE__*/function(_libExpressionParserO2){_inherits(ExpressionParserLinter,_libExpressionParserO2);function ExpressionParserLinter(pFable,pOptions,pServiceHash){var _this27;_classCallCheck2(this,ExpressionParserLinter);_this27=_callSuper(this,ExpressionParserLinter,[pFable,pOptions,pServiceHash]);_this27.serviceType='ExpressionParser-Linter';return _this27;}_createClass2(ExpressionParserLinter,[{key:"lintTokenizedExpression",value:function lintTokenizedExpression(pTokenizedExpression,pResultObject){var tmpResults=_typeof(pResultObject)==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
3497
3497
|
if(!Array.isArray(pTokenizedExpression)){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.lintTokenizedExpression was passed a non-array tokenized expression.");tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}if(pTokenizedExpression.length<1){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.lintTokenizedExpression was passed an empty tokenized expression.");tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}// 1. Check for balanced parenthesis
|
|
3498
3498
|
var tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
3499
3499
|
// State addresses are between squiggly brackets
|
|
@@ -3516,11 +3516,11 @@ if(pTokenizedExpression[_i17]!=='+'&&pTokenizedExpression[_i17]!=='-'){tmpResult
|
|
|
3516
3516
|
* Represents a user-friendly messaging service for the ExpressionParser compiler output.
|
|
3517
3517
|
* @class ExpressionParserMessaging
|
|
3518
3518
|
* @extends libExpressionParserOperationBase
|
|
3519
|
-
*/var ExpressionParserMessaging=/*#__PURE__*/function(_libExpressionParserO3){_inherits(ExpressionParserMessaging,_libExpressionParserO3);function ExpressionParserMessaging(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,ExpressionParserMessaging);_this28=_callSuper(this,ExpressionParserMessaging,[pFable,pOptions,pServiceHash]);_this28.serviceType='ExpressionParser-Messaging';return _this28;}_createClass2(ExpressionParserMessaging,[{key:"getOperationVirtualSymbolName",value:function getOperationVirtualSymbolName(pOperationToken){return pOperationToken&&'VirtualSymbolName'in pOperationToken?pOperationToken.VirtualSymbolName:pOperationToken.Type==='Token.VirtualSymbol'?pOperationToken.Token:'NO_VIRTUAL_SYMBOL_NAME_FOUND';}},{key:"getVirtualTokenValue",value:function getVirtualTokenValue(pToken,pOperationResults){var tmpVirtualSymbol=this.getOperationVirtualSymbolName(pToken);var tmpVirtualSymbolData='VirtualSymbols'in pOperationResults?pOperationResults.VirtualSymbols:{};if(this.ExpressionParser.GenericManifest.checkAddressExists(tmpVirtualSymbolData,tmpVirtualSymbol)){var tmpValue=this.ExpressionParser.GenericManifest.getValueAtAddress(tmpVirtualSymbolData,tmpVirtualSymbol);if(_typeof(tmpValue)==='object'){return"{".concat(Object.keys(tmpValue).length," values}");}if(Array.isArray(tmpValue)){return"[".concat(Object.keys(tmpValue).length," values]");}return tmpValue;}return'NO_VALUE_FOUND';}},{key:"getTokenAddressString",value:function getTokenAddressString(pToken){return pExpression.Token;}},{key:"getTokenSymbolString",value:function getTokenSymbolString(pExpressionToken){return pExpressionToken.Token;}},{key:"getOperationSymbolMessage",value:function getOperationSymbolMessage(pOperation){if(!pOperation){return'INVALID_OPERATION';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);var tmpOperationLeftValue=this.getTokenSymbolString(pOperation.LeftValue);var tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);var tmpOperationRightValue=this.getTokenSymbolString(pOperation.RightValue);var tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
3519
|
+
*/var ExpressionParserMessaging=/*#__PURE__*/function(_libExpressionParserO3){_inherits(ExpressionParserMessaging,_libExpressionParserO3);function ExpressionParserMessaging(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,ExpressionParserMessaging);_this28=_callSuper(this,ExpressionParserMessaging,[pFable,pOptions,pServiceHash]);_this28.serviceType='ExpressionParser-Messaging';return _this28;}_createClass2(ExpressionParserMessaging,[{key:"getOperationVirtualSymbolName",value:function getOperationVirtualSymbolName(pOperationToken){return pOperationToken&&'VirtualSymbolName'in pOperationToken?pOperationToken.VirtualSymbolName:pOperationToken.Type==='Token.VirtualSymbol'?pOperationToken.Token:'NO_VIRTUAL_SYMBOL_NAME_FOUND';}},{key:"getVirtualTokenValue",value:function getVirtualTokenValue(pToken,pOperationResults){var tmpVirtualSymbol=this.getOperationVirtualSymbolName(pToken);if(pToken.Type=='Token.Constant'&&pToken.Value){return pToken.Value.toString();}var tmpVirtualSymbolData='VirtualSymbols'in pOperationResults?pOperationResults.VirtualSymbols:{};if(this.ExpressionParser.GenericManifest.checkAddressExists(tmpVirtualSymbolData,tmpVirtualSymbol)){var tmpValue=this.ExpressionParser.GenericManifest.getValueAtAddress(tmpVirtualSymbolData,tmpVirtualSymbol);if(_typeof(tmpValue)==='object'){return"{".concat(Object.keys(tmpValue).length," values}");}if(Array.isArray(tmpValue)){return"[".concat(Object.keys(tmpValue).length," values]");}return tmpValue;}return'NO_VALUE_FOUND';}},{key:"getTokenAddressString",value:function getTokenAddressString(pToken){return pExpression.Token;}},{key:"getTokenSymbolString",value:function getTokenSymbolString(pExpressionToken){return pExpressionToken.Token;}},{key:"getOperationSymbolMessage",value:function getOperationSymbolMessage(pOperation){if(!pOperation){return'INVALID_OPERATION';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);var tmpOperationLeftValue=this.getTokenSymbolString(pOperation.LeftValue);var tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);var tmpOperationRightValue=this.getTokenSymbolString(pOperation.RightValue);var tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
3520
3520
|
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue);}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
3521
|
-
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(
|
|
3521
|
+
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"getOperationValueMessage",value:function getOperationValueMessage(pOperation,pResultObject){if(!pOperation){return'INVALID_OPERATION';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pOperation);var tmpOperationLeftValue=this.getVirtualTokenValue(pOperation.LeftValue,pResultObject);var tmpOperationSymbol=this.getTokenSymbolString(pOperation.Operation);var tmpOperationRightValue=this.getVirtualTokenValue(pOperation.RightValue,pResultObject);var tmpVirtualSymbolPrefix=tmpOperationVirtualSymbol.substring(0,3);if(tmpOperationSymbol==='='){// Assignment operators are special
|
|
3522
3522
|
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue);}if(tmpVirtualSymbolPrefix==='VFE'){// Virtual Function Expression
|
|
3523
|
-
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"logFunctionOutcome",value:function logFunctionOutcome(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log outcome.");return;}var tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';var tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';var tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info("Solved f(".concat(tmpAssignmentAddress,") = {").concat(tmpRawExpression,"}"));for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];var tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info("".concat(i," Symbols: ").concat(tmpTokenSymbolMessage));var tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info("".concat(i," Values: ").concat(tmpTokenValueMessage));}this.log.info("{".concat(tmpRawExpression,"} = ").concat(tmpRawResult));}},{key:"logFunctionSolve",value:function logFunctionSolve(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log the solve.");return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error("Solver results object did not contain a PostfixSolveList array. Cannot log the solve.");return;}for(var i=0;i<tmpExpressionParseOutcome.PostfixSolveList.length;i++){var tmpToken=tmpExpressionParseOutcome.PostfixSolveList[i];console.log("".concat(i,": ").concat(tmpToken.VirtualSymbolName," = (").concat(tmpToken.LeftValue.Token,"::").concat(tmpToken.LeftValue.Value,") ").concat(tmpToken.Operation.Token," (").concat(tmpToken.RightValue.Token,"::").concat(tmpToken.RightValue.Value,") "));}this.logFunctionOutcome(pResultObject);}}]);return ExpressionParserMessaging;}(libExpressionParserOperationBase);module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":136,"big.js":17}],141:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserPostfix=/*#__PURE__*/function(_libExpressionParserO4){_inherits(ExpressionParserPostfix,_libExpressionParserO4);function ExpressionParserPostfix(pFable,pOptions,pServiceHash){var _this29;_classCallCheck2(this,ExpressionParserPostfix);_this29=_callSuper(this,ExpressionParserPostfix,[pFable,pOptions,pServiceHash]);_this29.serviceType='ExpressionParser-Postfix';return _this29;}_createClass2(ExpressionParserPostfix,[{key:"getPosfixSolveListOperation",value:function getPosfixSolveListOperation(pOperation,pLeftValue,pRightValue,pDepthSolveList,pDepthSolveIndex){var tmpOperation={VirtualSymbolName:pOperation.VirtualSymbolName,Operation:pOperation,LeftValue:pLeftValue,RightValue:pRightValue};var tmpDepthSolveList=Array.isArray(pDepthSolveList)?pDepthSolveList:false;/* These two if blocks are very complex -- they basically provide a
|
|
3523
|
+
return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationSymbol,"(").concat(tmpOperationLeftValue,")");}return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationLeftValue," ").concat(tmpOperationSymbol," ").concat(tmpOperationRightValue);}},{key:"getOperationOutcomeMessage",value:function getOperationOutcomeMessage(pToken,pOperationResults){if(!pToken){return'INVALID_TOKEN';}var tmpOperationVirtualSymbol=this.getOperationVirtualSymbolName(pToken);var tmpOperationOutcomeValue=this.getVirtualTokenValue(pToken,pOperationResults);return"".concat(tmpOperationVirtualSymbol," = ").concat(tmpOperationOutcomeValue);}},{key:"logFunctionOutcome",value:function logFunctionOutcome(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log outcome.");return;}var tmpAssignmentAddress='PostfixedAssignmentAddress'in pResultObject?pResultObject.PostfixedAssignmentAddress:'NO_ASSIGNMENT_ADDRESS_FOUND';var tmpRawExpression='RawExpression'in pResultObject?pResultObject.RawExpression:'NO_EXPRESSION_FOUND';var tmpRawResult='RawResult'in pResultObject?pResultObject.RawResult:'NO_RESULT_FOUND';this.log.info("Solved f(".concat(tmpAssignmentAddress,") = {").concat(tmpRawExpression,"}"));for(var i=0;i<pResultObject.PostfixSolveList.length;i++){var tmpToken=pResultObject.PostfixSolveList[i];var tmpTokenSymbolMessage=this.getOperationSymbolMessage(tmpToken);this.log.info("".concat(i," Symbols: ").concat(tmpTokenSymbolMessage));var tmpTokenValueMessage=this.getOperationValueMessage(tmpToken,pResultObject);this.log.info("".concat(i," Values: ").concat(tmpTokenValueMessage));var tmpTokenOutcome=this.getOperationOutcomeMessage(tmpToken,pResultObject);this.log.info("".concat(i," Outcome: ").concat(tmpTokenOutcome));}this.log.info("{".concat(tmpRawExpression,"} = ").concat(tmpRawResult));}},{key:"logFunctionSolve",value:function logFunctionSolve(pResultObject){if(_typeof(pResultObject)!=='object'){this.log.error("Solver results object was not an object. Cannot log the solve.");return;}if(!('PostfixSolveList'in pResultObject)||!Array.isArray(pResultObject.PostfixSolveList)){this.log.error("Solver results object did not contain a PostfixSolveList array. Cannot log the solve.");return;}for(var i=0;i<tmpExpressionParseOutcome.PostfixSolveList.length;i++){var tmpToken=tmpExpressionParseOutcome.PostfixSolveList[i];console.log("".concat(i,": ").concat(tmpToken.VirtualSymbolName," = (").concat(tmpToken.LeftValue.Token,"::").concat(tmpToken.LeftValue.Value,") ").concat(tmpToken.Operation.Token," (").concat(tmpToken.RightValue.Token,"::").concat(tmpToken.RightValue.Value,") "));}this.logFunctionOutcome(pResultObject);}}]);return ExpressionParserMessaging;}(libExpressionParserOperationBase);module.exports=ExpressionParserMessaging;},{"./Fable-Service-ExpressionParser-Base.js":136,"big.js":17}],141:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserPostfix=/*#__PURE__*/function(_libExpressionParserO4){_inherits(ExpressionParserPostfix,_libExpressionParserO4);function ExpressionParserPostfix(pFable,pOptions,pServiceHash){var _this29;_classCallCheck2(this,ExpressionParserPostfix);_this29=_callSuper(this,ExpressionParserPostfix,[pFable,pOptions,pServiceHash]);_this29.serviceType='ExpressionParser-Postfix';return _this29;}_createClass2(ExpressionParserPostfix,[{key:"getPosfixSolveListOperation",value:function getPosfixSolveListOperation(pOperation,pLeftValue,pRightValue,pDepthSolveList,pDepthSolveIndex){var tmpOperation={VirtualSymbolName:pOperation.VirtualSymbolName,Operation:pOperation,LeftValue:pLeftValue,RightValue:pRightValue};var tmpDepthSolveList=Array.isArray(pDepthSolveList)?pDepthSolveList:false;/* These two if blocks are very complex -- they basically provide a
|
|
3524
3524
|
* way to deal with recursion that can be expressed to the user in
|
|
3525
3525
|
* a meaningful way.
|
|
3526
3526
|
*
|
|
@@ -3591,7 +3591,7 @@ tmpVirtualSymbolName="VP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++
|
|
|
3591
3591
|
else if(tmpPostfixTokenObject.Token==='('){// ... supporting a function
|
|
3592
3592
|
if(tmpResults.PostfixTokenObjects[_i22-1].Type==='Token.Function'){tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.Function=tmpResults.PostfixTokenObjects[_i22-1];var _tmpVirtualSymbolName=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!_tmpVirtualSymbolName){// ... this parenthesis group has no operators in it; make a virtual symbol name.
|
|
3593
3593
|
_tmpVirtualSymbolName="VFP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=_tmpVirtualSymbolName;}else{tmpPostfixTokenObject.IsFunction=false;var _tmpVirtualSymbolName2=tmpResults.PostfixLayerstackMap[tmpPostfixTokenObject.VirtualSymbolName];if(!_tmpVirtualSymbolName2){// This is a parenthesis group with no operators in it; make a virtual symbol name.
|
|
3594
|
-
_tmpVirtualSymbolName2="VP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=_tmpVirtualSymbolName2;}tmpFunctionCacheLIFOStack.push(tmpPostfixTokenObject);}if(tmpPostfixTokenObject.Token===')'){var tmpOpenParenthesis=tmpFunctionCacheLIFOStack.pop();if(tmpOpenParenthesis.IsFunction){tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.Function.VirtualSymbolName;}else{tmpPostfixTokenObject.IsFunction=false;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.VirtualSymbolName;}}}}// X. Postprocess the parenthesis groups to ensure they respect the order of operations for their boundaries
|
|
3594
|
+
_tmpVirtualSymbolName2="VP_".concat(tmpVirtualSymbolIndex);tmpVirtualSymbolIndex++;}tmpPostfixTokenObject.VirtualSymbolName=_tmpVirtualSymbolName2;}tmpFunctionCacheLIFOStack.push(tmpPostfixTokenObject);}else if(tmpPostfixTokenObject.Token===')'){var tmpOpenParenthesis=tmpFunctionCacheLIFOStack.pop();if(tmpOpenParenthesis.IsFunction){tmpPostfixTokenObject.IsFunction=true;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.Function.VirtualSymbolName;}else{tmpPostfixTokenObject.IsFunction=false;tmpPostfixTokenObject.VirtualSymbolName=tmpOpenParenthesis.VirtualSymbolName;}}}}// X. Postprocess the parenthesis groups to ensure they respect the order of operations for their boundaries
|
|
3595
3595
|
for(var _tmpSolveLayerIndex=0;_tmpSolveLayerIndex<tmpSolveLayerKeys.length;_tmpSolveLayerIndex++){var tmpParenthesisStack=[];var tmpLastOperator=false;var _tmpSolveLayerTokens=tmpSolveLayerMap[tmpSolveLayerKeys[_tmpSolveLayerIndex]];for(var _i23=0;_i23<_tmpSolveLayerTokens.length;_i23++){var _tmpPostfixTokenObject=_tmpSolveLayerTokens[_i23];// Keep track of the last operator
|
|
3596
3596
|
if(_tmpPostfixTokenObject.Type==='Token.Operator'){tmpLastOperator=_tmpPostfixTokenObject;}// This is only important to do at the close parenthesis.
|
|
3597
3597
|
if(_tmpPostfixTokenObject.Type==='Token.Function'){_tmpPostfixTokenObject.PreviousOperator=tmpLastOperator;}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token==='('&&_tmpPostfixTokenObject.IsFunction){tmpParenthesisStack.push(_tmpPostfixTokenObject);if(_tmpPostfixTokenObject.Function.PreviousOperator){_tmpPostfixTokenObject.PreviousOperator=_tmpPostfixTokenObject.Function.PreviousOperator;}}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token==='('){_tmpPostfixTokenObject.PreviousOperator=tmpLastOperator;tmpParenthesisStack.push(_tmpPostfixTokenObject);}else if(_tmpPostfixTokenObject.Type==='Token.Parenthesis'&&_tmpPostfixTokenObject.Token===')'){// This is ultra complex, and binds the order of operations logic to the open parenthesis for the group
|
|
@@ -3627,12 +3627,17 @@ tmpResults.VirtualSymbols={};for(var i=0;i<pPostfixedExpression.length;i++){if(p
|
|
|
3627
3627
|
if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.LeftValue.VirtualSymbolName);}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Parenthesis'){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.RightValue.VirtualSymbolName);}// Virtual Constants
|
|
3628
3628
|
if(tmpStepResultObject.ExpressionStep.LeftValue.Type==='Token.Constant'&&!('Value'in tmpStepResultObject.ExpressionStep.LeftValue)){tmpStepResultObject.ExpressionStep.LeftValue.Value=tmpStepResultObject.ExpressionStep.LeftValue.Token;}if(tmpStepResultObject.ExpressionStep.RightValue.Type==='Token.Constant'&&!('Value'in tmpStepResultObject.ExpressionStep.RightValue)){tmpStepResultObject.ExpressionStep.RightValue.Value=tmpStepResultObject.ExpressionStep.RightValue.Token;}if(tmpStepResultObject.ExpressionStep.Operation.Type='Operator'){// TODO: This can be optimized. A lot. If necessary. Seems pretty fast honestly for even thousands of operations. Slowest part is arbitrary precision.
|
|
3629
3629
|
// An operator always has a left and right value.
|
|
3630
|
-
var tmpFunctionAddress=false
|
|
3631
|
-
|
|
3632
|
-
|
|
3630
|
+
var tmpFunctionAddress=false;// Note: There are easier, passive ways of managing this state. But this is complex.
|
|
3631
|
+
var tmpIsFunction=false;if(tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap){tmpFunctionAddress="ResultsObject.".concat(tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function);}else if(tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()in this.ExpressionParser.functionMap){tmpIsFunction=true;tmpFunctionAddress="ResultsObject.".concat(this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address);}if(tmpIsFunction){try{this.log.trace("Solving Function Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));// Build the set of arguments to send to the functions.
|
|
3632
|
+
tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString='';if(typeof tmpStepResultObject.ExpressionStep.LeftValue.Value==='undefined'){tmpStepResultObject.ExpressionStep.LeftValue.Arguments=[];}else if(Array.isArray(tmpStepResultObject.ExpressionStep.LeftValue.Value)){// Allow for array-based math sets to just be pased through
|
|
3633
|
+
tmpStepResultObject.ExpressionStep.LeftValue.Arguments=tmpStepResultObject.ExpressionStep.LeftValue.Value;tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString='ExpressionStep.LeftValue.Arguments';}else if(_typeof(tmpStepResultObject.ExpressionStep.LeftValue.Value)==='object'){// Allow for array-based math sets to just be pased through
|
|
3634
|
+
tmpStepResultObject.ExpressionStep.LeftValue.Arguments=tmpStepResultObject.ExpressionStep.LeftValue.Value;tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString='ExpressionStep.LeftValue.Arguments';}else{// Allow for string-based math sets.
|
|
3635
|
+
tmpStepResultObject.ExpressionStep.LeftValue.Arguments=tmpStepResultObject.ExpressionStep.LeftValue.Value.toString().split(',');for(var j=0;j<tmpStepResultObject.ExpressionStep.LeftValue.Arguments.length;j++){if(tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString!==''){tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString+=',';}tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString+="ExpressionStep.LeftValue.Arguments[".concat(j,"]");}}tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName,tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(").concat(tmpStepResultObject.ExpressionStep.LeftValue.ArgumentString,")")));tmpResults.LastResult=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName);//this.log.trace(` ---> Step ${i}: ${tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]}`)
|
|
3636
|
+
}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,": ").concat(pError));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}}else{try{this.log.trace("Solving Step ".concat(i," [").concat(tmpStepResultObject.ExpressionStep.VirtualSymbolName,"] --> [").concat(tmpStepResultObject.ExpressionStep.Operation.Token,"]: ( ").concat(tmpStepResultObject.ExpressionStep.LeftValue.Value," , ").concat(tmpStepResultObject.ExpressionStep.RightValue.Value," )"));tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName,tmpManifest.getValueAtAddress(tmpStepResultObject,"".concat(tmpFunctionAddress,"(ExpressionStep.LeftValue.Value,ExpressionStep.RightValue.Value)")));tmpResults.LastResult=tmpManifest.getValueAtAddress(tmpResults.VirtualSymbols,tmpStepResultObject.ExpressionStep.VirtualSymbolName);//this.log.trace(` ---> Step ${i}: ${tmpResults.VirtualSymbols[tmpStepResultObject.ExpressionStep.VirtualSymbolName]}`)
|
|
3637
|
+
}catch(pError){tmpResults.ExpressionParserLog.push("ERROR: ExpressionParser.solvePostfixedExpression failed to solve step ".concat(i," with function ").concat(tmpStepResultObject.ExpressionStep.Operation.Token,": ").concat(pError));this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return false;}}// Equations don't always solve in virtual symbol order.
|
|
3633
3638
|
tmpResults.SolverFinalVirtualSymbol=tmpStepResultObject.ExpressionStep.VirtualSymbolName;}}var tmpSolverResultValue=tmpManifest.getValueAtAddress(tmpResults,"VirtualSymbols.".concat(tmpResults.SolverFinalVirtualSymbol));// Now deal with final assignment(s)
|
|
3634
3639
|
for(var _i28=0;_i28<pPostfixedExpression.length;_i28++){if(pPostfixedExpression[_i28].RightValue.Type==='Token.SolverMarshal'){tmpManifest.setValueAtAddress(tmpResults.VirtualSymbols,pPostfixedExpression[_i28].VirtualSymbolName,tmpSolverResultValue);tmpManifest.setValueByHash(tmpDataDestinationObject,pPostfixedExpression[_i28].VirtualSymbolName,tmpSolverResultValue);}}tmpResults.RawResult=tmpSolverResultValue;// Clean up the fable reference if we added it to the object.
|
|
3635
|
-
if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);return ExpressionParserSolver;}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":136}],143:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],144:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserValueMarshal=/*#__PURE__*/function(_libExpressionParserO6){_inherits(ExpressionParserValueMarshal,_libExpressionParserO6);function ExpressionParserValueMarshal(pFable,pOptions,pServiceHash){var _this31;_classCallCheck2(this,ExpressionParserValueMarshal);_this31=_callSuper(this,ExpressionParserValueMarshal,[pFable,pOptions,pServiceHash]);_this31.serviceType='ExpressionParser-ValueMarshal';return _this31;}/**
|
|
3640
|
+
if(!tmpPassedInFable){delete tmpResults.fable;}return tmpSolverResultValue.toString();}}]);return ExpressionParserSolver;}(libExpressionParserOperationBase);module.exports=ExpressionParserSolver;},{"./Fable-Service-ExpressionParser-Base.js":136}],143:[function(require,module,exports){module.exports={"=":{"Name":"Equals","Token":"=","Function":"fable.Math.assignValue","Precedence":0,"Type":"Assignment"},"(":{"Name":"Left Parenthesis","Token":"(","Precedence":0,"Type":"Parenthesis"},")":{"Name":"Right Parenthesis","Token":")","Precedence":0,"Type":"Parenthesis"},",":{"Name":"Set Concatenate","Token":",","Function":"fable.Math.setConcatenate","Precedence":4,"Type":"Operator"},"*":{"Name":"Multiply","Token":"*","Function":"fable.Math.multiplyPrecise","Precedence":3,"Type":"Operator"},"/":{"Name":"Divide","Token":"/","Function":"fable.Math.dividePrecise","Precedence":3,"Type":"Operator"},"^":{"Name":"Exponent","Token":"^","Function":"fable.Math.powerPrecise","Precedence":1,"Type":"Operator"},"%":{"Name":"Modulus","Token":"%","Function":"fable.Math.modPrecise","Precedence":3,"Type":"Operator"},"+":{"Name":"Add","Token":"+","Function":"fable.Math.addPrecise","Precedence":4,"Type":"Operator"},"-":{"Name":"Subtract","Token":"-","Function":"fable.Math.subtractPrecise","Precedence":4,"Type":"Operator"}};},{}],144:[function(require,module,exports){var libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');var ExpressionParserValueMarshal=/*#__PURE__*/function(_libExpressionParserO6){_inherits(ExpressionParserValueMarshal,_libExpressionParserO6);function ExpressionParserValueMarshal(pFable,pOptions,pServiceHash){var _this31;_classCallCheck2(this,ExpressionParserValueMarshal);_this31=_callSuper(this,ExpressionParserValueMarshal,[pFable,pOptions,pServiceHash]);_this31.serviceType='ExpressionParser-ValueMarshal';return _this31;}/**
|
|
3636
3641
|
* Substitutes values in tokenized objects based on the provided data source and manifest.
|
|
3637
3642
|
*
|
|
3638
3643
|
* TODO: Move this to its own file in the "Fable-Service-ExpressionParser" directory.
|
|
@@ -3699,13 +3704,23 @@ return _this33.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pC
|
|
|
3699
3704
|
* @param {number} pOf - The value to calculate the percentage against.
|
|
3700
3705
|
* @returns {string} The precise percentage as a string.
|
|
3701
3706
|
*/},{key:"percentagePrecise",value:function percentagePrecise(pIs,pOf){var tmpLeftValue=isNaN(pIs)?0:pIs;var tmpRightValue=isNaN(pOf)?0:pOf;if(tmpRightValue==0){return'0';}var tmpLeftArbitraryValue=new this.fable.Utility.bigNumber(tmpLeftValue);var tmpResult=tmpLeftArbitraryValue.div(tmpRightValue);tmpResult=tmpResult.times(100);return tmpResult.toString();}/**
|
|
3707
|
+
* Concatenates two value sets and returns the result as a string.
|
|
3708
|
+
*
|
|
3709
|
+
* Value sets are comma separated.
|
|
3710
|
+
*
|
|
3711
|
+
* Used for arbitrary precision set generation.
|
|
3712
|
+
*
|
|
3713
|
+
* @param {any} pLeftValue - The left value to append.
|
|
3714
|
+
* @param {any} pRightValue - The right value to append.
|
|
3715
|
+
* @returns {string} The concatenated string of the left and right values.
|
|
3716
|
+
*/},{key:"setConcatenate",value:function setConcatenate(pLeftValue,pRightValue){return"".concat(pLeftValue,",").concat(pRightValue);}/**
|
|
3702
3717
|
* Rounds a value to a specified number of decimal places using a specified rounding method.
|
|
3703
3718
|
*
|
|
3704
3719
|
* @param {number} pValue - The value to be rounded.
|
|
3705
3720
|
* @param {number} pDecimals - The number of decimal places to round to.
|
|
3706
3721
|
* @param {function} [pRoundingMethod] - The rounding method to use. Defaults to `this.roundHalfUp`.
|
|
3707
3722
|
* @returns {string} - The rounded value as a string.
|
|
3708
|
-
*/},{key:"roundPrecise",value:function roundPrecise(pValue,pDecimals,pRoundingMethod){var tmpValue=isNaN(pValue)?0:pValue;var tmpDecimals=isNaN(pDecimals)?0:pDecimals;var tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;var tmpArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
3723
|
+
*/},{key:"roundPrecise",value:function roundPrecise(pValue,pDecimals,pRoundingMethod){var tmpValue=isNaN(pValue)?0:pValue;var tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);var tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;var tmpArbitraryValue=new this.fable.Utility.bigNumber(tmpValue);var tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
3709
3724
|
* Returns a string representation of a number with a specified number of decimals.
|
|
3710
3725
|
*
|
|
3711
3726
|
* @param {number} pValue - The number to be formatted.
|