manyfest 1.0.10 → 1.0.11

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.10",
3
+ "version": "1.0.11",
4
4
  "description": "JSON Object Manifest for Data Description and Parsing",
5
5
  "main": "source/Manyfest.js",
6
6
  "scripts": {
@@ -249,6 +249,17 @@ class Manyfest
249
249
  return this.elementDescriptors[pAddress];
250
250
  }
251
251
 
252
+ // execute an action function for each descriptor
253
+ eachDescriptor(fAction)
254
+ {
255
+ let tmpDescriptorAddresses = Object.keys(this.elementDescriptors);
256
+ for (let i = 0; i < tmpDescriptorAddresses.length; i++)
257
+ {
258
+ fAction(this.elementDescriptors[tmpDescriptorAddresses[i]]);
259
+ }
260
+
261
+ }
262
+
252
263
  /*************************************************************************
253
264
  * Beginning of Object Manipulation (read & write) Functions
254
265
  */
@@ -243,6 +243,48 @@ suite
243
243
  fTestComplete();
244
244
  }
245
245
  );
246
+ test
247
+ (
248
+ 'Iterate through elements of a schema.',
249
+ (fTestComplete)=>
250
+ {
251
+ let _Manyfest = new libManyfest(
252
+ {
253
+ "Scope": "Animal",
254
+ "Descriptors":
255
+ {
256
+ "IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" },
257
+ "Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." },
258
+ "Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." },
259
+ "MedicalStats":
260
+ {
261
+ "Name":"Medical Statistics", "Description":"Basic medical statistics for this animal"
262
+ },
263
+ "MedicalStats.Temps.MinET": { "Name":"Minimum Environmental Temperature", "NameShort":"MinET", "Description":"Safest minimum temperature for this animal to survive in."},
264
+ "MedicalStats.Temps.MaxET": { "Name":"Maximum Environmental Temperature", "NameShort":"MaxET", "Description":"Safest maximum temperature for this animal to survive in."},
265
+ "MedicalStats.Temps.CET":
266
+ {
267
+ "Name":"Comfortable Environmental Temperature",
268
+ "NameShort":"Comf Env Temp",
269
+ "Hash":"ComfET",
270
+ "Description":"The most comfortable temperature for this animal to survive in.",
271
+ "Default": "96.8"
272
+ }
273
+ }
274
+ });
275
+
276
+ let tmpSchemaAddresses = [];
277
+
278
+ _Manyfest.eachDescriptor(
279
+ (pDescriptor)=>
280
+ {
281
+ tmpSchemaAddresses.push(pDescriptor.Hash);
282
+ })
283
+ Expect(tmpSchemaAddresses.length).to.equal(7);
284
+ Expect(tmpSchemaAddresses[6]).to.equal('ComfET');
285
+ fTestComplete();
286
+ }
287
+ );
246
288
  }
247
289
  );
248
290
  }