fable 3.1.14 → 3.1.15
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 +17 -11
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +2 -2
package/dist/fable.js
CHANGED
|
@@ -1399,11 +1399,11 @@ let tmpBracketStartIndex=pAddress.indexOf('[');let tmpBracketStopIndex=pAddress.
|
|
|
1399
1399
|
if(tmpBracketStartIndex>0// 2) The end bracket has something between them
|
|
1400
1400
|
&&tmpBracketStopIndex>tmpBracketStartIndex// 3) There is data
|
|
1401
1401
|
&&tmpBracketStopIndex-tmpBracketStartIndex>1){// The "Name" of the Object contained too the left of the bracket
|
|
1402
|
-
let tmpBoxedPropertyName=pAddress.substring(0,tmpBracketStartIndex).trim();//
|
|
1403
|
-
// This is a rare case where Arrays testing as Objects is useful
|
|
1404
|
-
if(typeof pObject[tmpBoxedPropertyName]!=='object'){return false;}// The "Reference" to the property within it, either an array element or object property
|
|
1402
|
+
let tmpBoxedPropertyName=pAddress.substring(0,tmpBracketStartIndex).trim();// The "Reference" to the property within it, either an array element or object property
|
|
1405
1403
|
let tmpBoxedPropertyReference=pAddress.substring(tmpBracketStartIndex+1,tmpBracketStopIndex).trim();// Attempt to parse the reference as a number, which will be used as an array element
|
|
1406
|
-
let tmpBoxedPropertyNumber=parseInt(tmpBoxedPropertyReference,10)
|
|
1404
|
+
let tmpBoxedPropertyNumber=parseInt(tmpBoxedPropertyReference,10);let tmpIndexIsNumeric=!isNaN(tmpBoxedPropertyNumber);if(pObject[tmpBoxedPropertyName]==null){if(tmpIndexIsNumeric){pObject[tmpBoxedPropertyName]=[];}else{pObject[tmpBoxedPropertyName]={};}}// If the subproperty doesn't test as a proper Object, none of the rest of this is possible.
|
|
1405
|
+
// This is a rare case where Arrays testing as Objects is useful
|
|
1406
|
+
if(typeof pObject[tmpBoxedPropertyName]!=='object'){return false;}// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1407
1407
|
// This seems confusing to me at first read, so explaination:
|
|
1408
1408
|
// Is the Boxed Object an Array? TRUE
|
|
1409
1409
|
// And is the Reference inside the boxed Object not a number? TRUE
|
|
@@ -1412,8 +1412,11 @@ if(Array.isArray(pObject[tmpBoxedPropertyName])==isNaN(tmpBoxedPropertyNumber)){
|
|
|
1412
1412
|
// otherwise we will try to treat it as a dynamic object property.
|
|
1413
1413
|
if(isNaN(tmpBoxedPropertyNumber)){// This isn't a number ... let's treat it as a dynamic object property.
|
|
1414
1414
|
// We would expect the property to be wrapped in some kind of quotes so strip them
|
|
1415
|
-
tmpBoxedPropertyReference=this.cleanWrapCharacters('"',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters('`',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters("'",tmpBoxedPropertyReference)
|
|
1416
|
-
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference]=
|
|
1415
|
+
tmpBoxedPropertyReference=this.cleanWrapCharacters('"',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters('`',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters("'",tmpBoxedPropertyReference);if(!(tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName])){// If the subobject doesn't exist, create it
|
|
1416
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference]={};}// Return the value in the property
|
|
1417
|
+
//TODO: For cases where we have chained [][] properties, this needs to recurse somehow
|
|
1418
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference]=pValue;return true;}else{while(pObject[tmpBoxedPropertyName].length<tmpBoxedPropertyNumber+1){// If the subobject doesn't exist, create it
|
|
1419
|
+
pObject[tmpBoxedPropertyName].push({});}pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumber]=pValue;return true;}}else{// Now is the time in recursion to set the value in the object
|
|
1417
1420
|
pObject[pAddress]=pValue;return true;}}else{let tmpSubObjectName=pAddress.substring(0,tmpSeparatorIndex);let tmpNewAddress=pAddress.substring(tmpSeparatorIndex+1);// Test if the tmpNewAddress is an array or object
|
|
1418
1421
|
// Check if it's a boxed property
|
|
1419
1422
|
let tmpBracketStartIndex=tmpSubObjectName.indexOf('[');let tmpBracketStopIndex=tmpSubObjectName.indexOf(']');// Boxed elements look like this:
|
|
@@ -1427,7 +1430,8 @@ let tmpBracketStartIndex=tmpSubObjectName.indexOf('[');let tmpBracketStopIndex=t
|
|
|
1427
1430
|
// 1) The start bracket is after character 0
|
|
1428
1431
|
if(tmpBracketStartIndex>0// 2) The end bracket has something between them
|
|
1429
1432
|
&&tmpBracketStopIndex>tmpBracketStartIndex// 3) There is data
|
|
1430
|
-
&&tmpBracketStopIndex-tmpBracketStartIndex>1){let tmpBoxedPropertyName=tmpSubObjectName.substring(0,tmpBracketStartIndex).trim();let tmpBoxedPropertyReference=tmpSubObjectName.substring(tmpBracketStartIndex+1,tmpBracketStopIndex).trim();let tmpBoxedPropertyNumber=parseInt(tmpBoxedPropertyReference,10);//
|
|
1433
|
+
&&tmpBracketStopIndex-tmpBracketStartIndex>1){let tmpBoxedPropertyName=tmpSubObjectName.substring(0,tmpBracketStartIndex).trim();let tmpBoxedPropertyReference=tmpSubObjectName.substring(tmpBracketStartIndex+1,tmpBracketStopIndex).trim();let tmpBoxedPropertyNumber=parseInt(tmpBoxedPropertyReference,10);let tmpIndexIsNumeric=!isNaN(tmpBoxedPropertyNumber);//if (typeof(pObject[tmpBoxedPropertyName]) !== 'object')
|
|
1434
|
+
if(pObject[tmpBoxedPropertyName]==null){if(tmpIndexIsNumeric){pObject[tmpBoxedPropertyName]=[];}else{pObject[tmpBoxedPropertyName]={};}}// Guard: If the referrant is a number and the boxed property is not an array, or vice versa, return undefined.
|
|
1431
1435
|
// This seems confusing to me at first read, so explaination:
|
|
1432
1436
|
// Is the Boxed Object an Array? TRUE
|
|
1433
1437
|
// And is the Reference inside the boxed Object not a number? TRUE
|
|
@@ -1441,12 +1445,14 @@ if(tmpBracketStartIndex>0// 2) The end bracket has something between them
|
|
|
1441
1445
|
// BUT
|
|
1442
1446
|
// StudentData.Sections.Algebra.Students is an array, so the ["JaneDoe"].Grade is not possible to access
|
|
1443
1447
|
// TODO: Should this be an error or something? Should we keep a log of failures like this?
|
|
1444
|
-
if(Array.isArray(pObject[tmpBoxedPropertyName])
|
|
1448
|
+
if(Array.isArray(pObject[tmpBoxedPropertyName])!=tmpIndexIsNumeric){return false;}//This is a bracketed value
|
|
1445
1449
|
// 4) If the middle part is *only* a number (no single, double or backtick quotes) it is an array element,
|
|
1446
1450
|
// otherwise we will try to reat it as a dynamic object property.
|
|
1447
1451
|
if(isNaN(tmpBoxedPropertyNumber)){// This isn't a number ... let's treat it as a dynanmic object property.
|
|
1448
|
-
tmpBoxedPropertyReference=this.cleanWrapCharacters('"',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters('`',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters("'",tmpBoxedPropertyReference)
|
|
1449
|
-
|
|
1452
|
+
tmpBoxedPropertyReference=this.cleanWrapCharacters('"',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters('`',tmpBoxedPropertyReference);tmpBoxedPropertyReference=this.cleanWrapCharacters("'",tmpBoxedPropertyReference);if(!(tmpBoxedPropertyReference in pObject[tmpBoxedPropertyName])){// If the subobject doesn't exist, create it
|
|
1453
|
+
pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference]={};}// Recurse directly into the subobject
|
|
1454
|
+
return this.setValueAtAddress(pObject[tmpBoxedPropertyName][tmpBoxedPropertyReference],tmpNewAddress,pValue);}else{while(pObject[tmpBoxedPropertyName].length<tmpBoxedPropertyNumber+1){// If the subobject doesn't exist, create it
|
|
1455
|
+
pObject[tmpBoxedPropertyName].push({});}// We parsed a valid number out of the boxed property name, so recurse into the array
|
|
1450
1456
|
return this.setValueAtAddress(pObject[tmpBoxedPropertyName][tmpBoxedPropertyNumber],tmpNewAddress,pValue);}}// If there is an object property already named for the sub object, but it isn't an object
|
|
1451
1457
|
// then the system can't set the value in there. Error and abort!
|
|
1452
1458
|
if(tmpSubObjectName in pObject&&typeof pObject[tmpSubObjectName]!=='object'){if(!('__ERROR'in pObject))pObject['__ERROR']={};// Put it in an error object so data isn't lost
|
|
@@ -3020,7 +3026,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
3020
3026
|
// presumably different callback function.
|
|
3021
3027
|
// This makes sure that own properties are retained, so that
|
|
3022
3028
|
// decorations and such are not lost along the way.
|
|
3023
|
-
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.
|
|
3029
|
+
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.15","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.42"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^6.2.2","cachetrax":"^1.0.4","cookie":"^0.6.0","data-arithmatic":"^1.0.7","dayjs":"^1.11.13","fable-log":"^3.0.16","fable-serviceproviderbase":"^3.0.15","fable-settings":"^3.0.12","fable-uuid":"^3.0.11","manyfest":"^1.0.40","simple-get":"^4.0.1"}};},{}],150:[function(require,module,exports){/**
|
|
3024
3030
|
* Fable Application Services Support Library
|
|
3025
3031
|
* @author <steven@velozo.com>
|
|
3026
3032
|
*/// Pre-init services
|