fable 3.1.43 → 3.1.45
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.js +7 -7
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-Math.js +6 -5
- package/test/Math_test.js +2 -0
package/dist/fable.js
CHANGED
|
@@ -3062,7 +3062,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
3062
3062
|
// presumably different callback function.
|
|
3063
3063
|
// This makes sure that own properties are retained, so that
|
|
3064
3064
|
// decorations and such are not lost along the way.
|
|
3065
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],148:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],149:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.
|
|
3065
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],148:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],149:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.45","description":"A service dependency injection, configuration and logging library.","main":"source/Fable.js","scripts":{"start":"node source/Fable.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","test":"./node_modules/.bin/mocha -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t fable-image:local","docker-dev-run":"docker run -it -d --name fable-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" fable-image:local","docker-dev-shell":"docker exec -it fable-dev /bin/bash","tests":"./node_modules/mocha/bin/_mocha -u tdd --exit -R spec --grep"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"browser":{"./source/service/Fable-Service-EnvironmentData.js":"./source/service/Fable-Service-EnvironmentData-Web.js","./source/service/Fable-Service-FilePersistence.js":"./source/service/Fable-Service-FilePersistence-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable/issues"},"homepage":"https://github.com/stevenvelozo/fable","devDependencies":{"quackage":"^1.0.45"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^7.0.1","cachetrax":"^1.0.4","cookie":"^1.0.2","data-arithmatic":"^1.0.7","dayjs":"^1.11.18","fable-log":"^3.0.16","fable-serviceproviderbase":"^3.0.15","fable-settings":"^3.0.12","fable-uuid":"^3.0.11","manyfest":"^1.0.42","simple-get":"^4.0.1"}};},{}],150:[function(require,module,exports){/**
|
|
3066
3066
|
* Fable Application Services Support Library
|
|
3067
3067
|
* @author <steven@velozo.com>
|
|
3068
3068
|
*/// Pre-init services
|
|
@@ -4108,14 +4108,14 @@ tmpNumber=typeof pNonNumberValue==='undefined'?"0.0":pNonNumberValue;}return tmp
|
|
|
4108
4108
|
* @param {number} pDecimals - The number of decimal places to round to.
|
|
4109
4109
|
* @param {function} [pRoundingMethod] - The rounding method to use. Defaults to `this.roundHalfUp`.
|
|
4110
4110
|
* @returns {string} - The rounded value as a string.
|
|
4111
|
-
*/roundPrecise(pValue,pDecimals,pRoundingMethod){let tmpValue=isNaN(pValue)?0:pValue;let tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);let tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:parseInt(pRoundingMethod,10);let tmpArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
4111
|
+
*/roundPrecise(pValue,pDecimals,pRoundingMethod){let tmpValue=pValue===false||isNaN(pValue)?0:pValue;let tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);let tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:parseInt(pRoundingMethod,10);let tmpArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpArbitraryValue.round(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
4112
4112
|
* Returns a string representation of a number with a specified number of decimals.
|
|
4113
4113
|
*
|
|
4114
4114
|
* @param {number} pValue - The number to be formatted.
|
|
4115
4115
|
* @param {number} pDecimals - The number of decimals to include in the formatted string.
|
|
4116
4116
|
* @param {string} [pRoundingMethod] - The rounding method to use. Defaults to 'roundHalfUp'.
|
|
4117
4117
|
* @returns {string} - The formatted number as a string.
|
|
4118
|
-
*/toFixedPrecise(pValue,pDecimals,pRoundingMethod){let tmpValue=isNaN(pValue)?0:pValue;let tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);let tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;let tmpArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpArbitraryValue.toFixed(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
4118
|
+
*/toFixedPrecise(pValue,pDecimals,pRoundingMethod){let tmpValue=pValue===false||isNaN(pValue)?0:pValue;let tmpDecimals=isNaN(pDecimals)?0:parseInt(pDecimals,10);let tmpRoundingMethod=typeof pRoundingMethod==='undefined'?this.roundHalfUp:pRoundingMethod;let tmpArbitraryValue=new this.bigNumber(tmpValue);let tmpResult=tmpArbitraryValue.toFixed(tmpDecimals,tmpRoundingMethod);return tmpResult.toString();}/**
|
|
4119
4119
|
* Adds two values precisely.
|
|
4120
4120
|
* @param {number|string} pLeftValue - The left value to be added.
|
|
4121
4121
|
* @param {number|string} pRightValue - The right value to be added.
|
|
@@ -4468,14 +4468,14 @@ return A.map(row=>row[0]);}/**
|
|
|
4468
4468
|
* Compute least squares regression coefficients for multivariable linear interpolation.
|
|
4469
4469
|
*
|
|
4470
4470
|
* @param {Array<Array<number|string>> | Array<number|string> | string} pIndependentVariableVectors - array of arrays [[x11, x12, ...], [x21, x22, ...], ...] or single array for single variable.
|
|
4471
|
-
* @param {Array<number|string
|
|
4471
|
+
* @param {Array<number|string>|string} pDependentVariableVector - array of target values [y1, y2, ...]
|
|
4472
4472
|
*
|
|
4473
4473
|
* @return {Array<number|string>} - linear coefficients [b0, b1, ..., bn] where y = b0 + b1*x1 + b2*x2 + ... + bn*xn
|
|
4474
|
-
*/leastSquares(pIndependentVariableVectors,pDependentVariableVector){const tmpIndependentVariableVectors=Array.isArray(pIndependentVariableVectors)?Array.isArray(pIndependentVariableVectors[0])?this.matrixTranspose(pIndependentVariableVectors):pIndependentVariableVectors.map(value=>[value]):[[pIndependentVariableVectors]];if(tmpIndependentVariableVectors.length===1){// degenerate case: only one independent variable value, result is just a y-intercept
|
|
4475
|
-
return[
|
|
4474
|
+
*/leastSquares(pIndependentVariableVectors,pDependentVariableVector){const tmpIndependentVariableVectors=Array.isArray(pIndependentVariableVectors)?Array.isArray(pIndependentVariableVectors[0])?this.matrixTranspose(pIndependentVariableVectors):pIndependentVariableVectors.map(value=>[value]):[[pIndependentVariableVectors]];const tmpDependentVariableVector=Array.isArray(pDependentVariableVector)?pDependentVariableVector:[pDependentVariableVector];if(tmpIndependentVariableVectors.length===1){// degenerate case: only one independent variable value, result is just a y-intercept
|
|
4475
|
+
return[tmpDependentVariableVector[0],'0.0'];}// Add bias term (intercept)
|
|
4476
4476
|
const tmpIndependentVariableMatrixWithBiasTerm=tmpIndependentVariableVectors.map(row=>[1,...row]);// Compute X^T * X
|
|
4477
4477
|
const tmpIndependentTermTranpose=this.matrixTranspose(tmpIndependentVariableMatrixWithBiasTerm);const tmpDependentTransposeMultiplication=this.matrixMultiply(tmpIndependentTermTranpose,tmpIndependentVariableMatrixWithBiasTerm);// Compute X^T * y
|
|
4478
|
-
const tmpIndependentTransposeMultiplication=this.matrixVectorMultiply(tmpIndependentTermTranpose,
|
|
4478
|
+
const tmpIndependentTransposeMultiplication=this.matrixVectorMultiply(tmpIndependentTermTranpose,tmpDependentVariableVector);// Solve (XtX) * beta = Xty
|
|
4479
4479
|
const tmpLinearCoefficients=this.gaussianElimination(tmpDependentTransposeMultiplication,tmpIndependentTransposeMultiplication);return tmpLinearCoefficients;}/**
|
|
4480
4480
|
* Helper function to transpose a matrix
|
|
4481
4481
|
*
|