manyfest 1.0.35 → 1.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manyfest",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "JSON Object Manifest for Data Description and Parsing",
5
5
  "main": "source/Manyfest.js",
6
6
  "scripts": {
@@ -47,7 +47,7 @@
47
47
  "fable-serviceproviderbase": "^3.0.13"
48
48
  },
49
49
  "devDependencies": {
50
- "quackage": "^1.0.29"
50
+ "quackage": "^1.0.30"
51
51
  },
52
52
  "author": "steven velozo <steven@velozo.com>",
53
53
  "license": "MIT",
@@ -201,7 +201,25 @@ class ManyfestObjectAddressResolverCheckAddressExists
201
201
  if ((tmpFunctionArguments.length == 0) || (tmpFunctionArguments[0] == ''))
202
202
  {
203
203
  // No arguments... just call the function (bound to the scope of the object it is contained withing)
204
- return this.checkAddressExists(pObject[tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpRootObject);
204
+ if (tmpFunctionAddress in pObject)
205
+ {
206
+ try
207
+ {
208
+ return this.checkAddressExists(pObject[tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpRootObject);
209
+ }
210
+ catch(pError)
211
+ {
212
+ // The function call failed, so the address doesn't exist
213
+ libSimpleLog.log(`Error calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
214
+ return false;
215
+ }
216
+ }
217
+ else
218
+ {
219
+ // The function doesn't exist, so the address doesn't exist
220
+ libSimpleLog.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
221
+ return false;
222
+ }
205
223
  }
206
224
  else
207
225
  {
@@ -217,7 +235,26 @@ class ManyfestObjectAddressResolverCheckAddressExists
217
235
  tmpArgumentValues.push(this.getObjectValueClass.getValueAtAddress(tmpRootObject, tmpFunctionArguments[i]));
218
236
  }
219
237
 
220
- return this.checkAddressExists(pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, tmpRootObject);
238
+ //return this.checkAddressExists(pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, tmpRootObject);
239
+ if (tmpFunctionAddress in pObject)
240
+ {
241
+ try
242
+ {
243
+ return this.checkAddressExists(pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, tmpRootObject);
244
+ }
245
+ catch(pError)
246
+ {
247
+ // The function call failed, so the address doesn't exist
248
+ libSimpleLog.log(`Error calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
249
+ return false;
250
+ }
251
+ }
252
+ else
253
+ {
254
+ // The function doesn't exist, so the address doesn't exist
255
+ libSimpleLog.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
256
+ return false;
257
+ }
221
258
  }
222
259
  }
223
260
  // Boxed elements look like this:
@@ -152,7 +152,25 @@ class ManyfestObjectAddressResolverGetValue
152
152
  if ((tmpFunctionArguments.length == 0) || (tmpFunctionArguments[0] == ''))
153
153
  {
154
154
  // No arguments... just call the function (bound to the scope of the object it is contained withing)
155
- return pObject[tmpFunctionAddress].apply(pObject);
155
+ if (tmpFunctionAddress in pObject)
156
+ {
157
+ try
158
+ {
159
+ return pObject[tmpFunctionAddress].apply(pObject);
160
+ }
161
+ catch(pError)
162
+ {
163
+ // The function call failed, so the address doesn't exist
164
+ console.log(`Error in getValueAtAddress calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
165
+ return false;
166
+ }
167
+ }
168
+ else
169
+ {
170
+ // The function doesn't exist, so the address doesn't exist
171
+ console.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
172
+ return false;
173
+ }
156
174
  }
157
175
  else
158
176
  {
@@ -185,7 +203,25 @@ class ManyfestObjectAddressResolverGetValue
185
203
  }
186
204
  }
187
205
 
188
- return pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues);
206
+ if (tmpFunctionAddress in pObject)
207
+ {
208
+ try
209
+ {
210
+ return pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues);
211
+ }
212
+ catch(pError)
213
+ {
214
+ // The function call failed, so the address doesn't exist
215
+ console.log(`Error in getValueAtAddress calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
216
+ return false;
217
+ }
218
+ }
219
+ else
220
+ {
221
+ // The function doesn't exist, so the address doesn't exist
222
+ console.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
223
+ return false;
224
+ }
189
225
  }
190
226
  }
191
227
  // Boxed elements look like this:
@@ -350,7 +386,25 @@ class ManyfestObjectAddressResolverGetValue
350
386
  if ((tmpFunctionArguments.length == 0) || (tmpFunctionArguments[0] == ''))
351
387
  {
352
388
  // No arguments... just call the function (bound to the scope of the object it is contained withing)
353
- return this.getValueAtAddress(pObject[tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpParentAddress, tmpRootObject);
389
+ if (tmpFunctionAddress in pObject)
390
+ {
391
+ try
392
+ {
393
+ return this.getValueAtAddress(pObject[tmpFunctionAddress].apply(pObject), tmpNewAddress, tmpParentAddress, tmpRootObject);
394
+ }
395
+ catch(pError)
396
+ {
397
+ // The function call failed, so the address doesn't exist
398
+ console.log(`Error in getValueAtAddress calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
399
+ return false;
400
+ }
401
+ }
402
+ else
403
+ {
404
+ // The function doesn't exist, so the address doesn't exist
405
+ console.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
406
+ return false;
407
+ }
354
408
  }
355
409
  else
356
410
  {
@@ -383,7 +437,25 @@ class ManyfestObjectAddressResolverGetValue
383
437
  }
384
438
  }
385
439
 
386
- return this.getValueAtAddress(pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, tmpParentAddress, tmpRootObject);
440
+ if (tmpFunctionAddress in pObject)
441
+ {
442
+ try
443
+ {
444
+ return this.getValueAtAddress(pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues), tmpNewAddress, tmpParentAddress, tmpRootObject);
445
+ }
446
+ catch(pError)
447
+ {
448
+ // The function call failed, so the address doesn't exist
449
+ console.log(`Error in getValueAtAddress calling function ${tmpFunctionAddress} (address [${pAddress}]): ${pError.message}`);
450
+ return false;
451
+ }
452
+ }
453
+ else
454
+ {
455
+ // The function doesn't exist, so the address doesn't exist
456
+ console.log(`Function ${tmpFunctionAddress} does not exist (address [${pAddress}])`);
457
+ return false;
458
+ }
387
459
  }
388
460
  }
389
461
  // Boxed elements look like this:
@@ -44,6 +44,8 @@ suite
44
44
  let tmpFileSet = _Manyfest.getValueByHash(_SampleDataArchiveOrgFrankenberry, 'FileSet');
45
45
  Expect(Array.isArray(tmpFileSet)).to.equal(true);
46
46
  let tmpFileSizes = _Manyfest.getValueByHash(_SampleDataArchiveOrgFrankenberry, 'FileSizes');
47
+ Expect(Object.keys(tmpFileSizes).length).to.equal(17);
48
+ let tmpQuantities = _Manyfest.getValueByHash({cores:[100,300,45,10,1]}, 'cores[]');
47
49
  fTestComplete();
48
50
  }
49
51
  );
@@ -240,6 +240,7 @@ suite
240
240
  {
241
241
  return { Cost: 1.00, Name: 'Beanie Baby', Stores: ['Aberdeen', 'Seattle', 'Tacoma'] }
242
242
  },
243
+ "BrokenObject": function() { throw new Error('This is a thrown error message!'); },
243
244
  "FormatOutput": function () { return `My magic value is: ${this.Value}`; }
244
245
  },
245
246
  "Manyfest":
@@ -279,6 +280,8 @@ suite
279
280
  .to.equal(1);
280
281
 
281
282
  Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.SillyObject().Stores[0]')).to.equal('Aberdeen');
283
+ Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.SillyFUNCTIONNOTFOUND().Stores[0]')).to.equal(false);
284
+ Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.BrokenObject().Stores[0]')).to.equal(false);
282
285
 
283
286
  fTestComplete();
284
287
  }