manyfest 1.0.31 → 1.0.32

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.31",
3
+ "version": "1.0.32",
4
4
  "description": "JSON Object Manifest for Data Description and Parsing",
5
5
  "main": "source/Manyfest.js",
6
6
  "scripts": {
@@ -163,8 +163,22 @@ class ManyfestObjectAddressResolverGetValue
163
163
  // Now get the value for each argument
164
164
  for (let i = 0; i < tmpFunctionArguments.length; i++)
165
165
  {
166
- // Resolve the values for each subsequent entry
167
- tmpArgumentValues.push(this.getValueAtAddress(tmpRootObject, tmpFunctionArguments[i]));
166
+ if(tmpFunctionArguments[i][0] == "'" && tmpFunctionArguments[i][tmpFunctionArguments[i].length - 1] == "'")
167
+ {
168
+ tmpArgumentValues.push(tmpFunctionArguments[i].substring(1, tmpFunctionArguments[i].length - 1));
169
+ }
170
+ else if(tmpFunctionArguments[i][0] == '"' && tmpFunctionArguments[i][tmpFunctionArguments[i].length - 1] == '"')
171
+ {
172
+ tmpArgumentValues.push(tmpFunctionArguments[i].substring(1, tmpFunctionArguments[i].length - 1));
173
+ }
174
+ else if(tmpFunctionArguments[i][0] == "`" && tmpFunctionArguments[i][tmpFunctionArguments[i].length - 1] == "`")
175
+ {
176
+ tmpArgumentValues.push(tmpFunctionArguments[i].substring(1, tmpFunctionArguments[i].length - 1));
177
+ }
178
+ else
179
+ {
180
+ tmpArgumentValues.push(this.getValueAtAddress(tmpRootObject, tmpFunctionArguments[i]));
181
+ }
168
182
  }
169
183
 
170
184
  return pObject[tmpFunctionAddress].apply(pObject, tmpArgumentValues);
@@ -272,6 +272,51 @@ suite
272
272
 
273
273
  Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.SillyObject().Stores[0]')).to.equal('Aberdeen');
274
274
 
275
+ fTestComplete();
276
+ }
277
+ );
278
+ test
279
+ (
280
+ 'Functions with fixed and static parameters',
281
+ (fTestComplete)=>
282
+ {
283
+ // Create a compmlex mock object to check metadata on.
284
+ let _MockObject = (
285
+ {
286
+ "Name": "Yadda",
287
+ "ComplexFunction": (pValue, pOutput) => { return `Value is: ${pValue} and would output as ${pOutput}`; },
288
+ "Behaviors":
289
+ {
290
+ "Value": 0,
291
+ "TheFunction": (pValue) => { return `Value is: ${pValue}`; },
292
+ "Increment": function ()
293
+ {
294
+ this.Value++; return this.Value;
295
+ },
296
+ "SillyObject": function()
297
+ {
298
+ return { Cost: 1.00, Name: 'Beanie Baby', Stores: ['Aberdeen', 'Seattle', 'Tacoma'] }
299
+ },
300
+ "FormatOutput": function () { return `My magic value is: ${this.Value}`; }
301
+ },
302
+ "Manyfest":
303
+ {
304
+ Scope:'Function.Mock',
305
+ Descriptors:
306
+ {
307
+ "metadata.creator":
308
+ {
309
+ Name:'Creator',
310
+ Hash:'Creator'
311
+ }
312
+ }
313
+ },
314
+ "Data": _SampleDataArchiveOrgFrankenberry
315
+ });
316
+ let _Manyfest = new libManyfest(_MockObject.Manyfest);
317
+
318
+ Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.TheFunction("100")')).to.equal('Value is: 100');
319
+
275
320
  fTestComplete();
276
321
  }
277
322
  );