manyfest 1.0.41 → 1.0.42
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/manyfest.compatible.js +219 -70
- package/dist/manyfest.compatible.js.map +1 -0
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +207 -61
- package/dist/manyfest.js.map +1 -0
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/package.json +3 -3
- package/source/Manyfest.js +23 -5
- package/test/Manyfest_Object_Read_tests.js +13 -0
- package/types/Manyfest.d.ts +1 -0
- package/types/Manyfest.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manyfest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
4
4
|
"description": "JSON Object Manifest for Data Description and Parsing",
|
|
5
5
|
"main": "source/Manyfest.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"fable-serviceproviderbase": "^3.0.15"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"quackage": "^1.0.
|
|
53
|
-
"typescript": "^5.
|
|
52
|
+
"quackage": "^1.0.42",
|
|
53
|
+
"typescript": "^5.9.2"
|
|
54
54
|
},
|
|
55
55
|
"author": "steven velozo <steven@velozo.com>",
|
|
56
56
|
"license": "MIT",
|
package/source/Manyfest.js
CHANGED
|
@@ -362,21 +362,37 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
362
362
|
return tmpValue;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
lintAddress(pAddress)
|
|
366
|
+
{
|
|
367
|
+
let tmpLintedAddress = pAddress.trim();
|
|
368
|
+
// Check for a single . (but not a ..) at the end of the address and remove it.
|
|
369
|
+
if (tmpLintedAddress.endsWith('..'))
|
|
370
|
+
{
|
|
371
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
372
|
+
}
|
|
373
|
+
else if (tmpLintedAddress.endsWith('.'))
|
|
374
|
+
{
|
|
375
|
+
tmpLintedAddress = tmpLintedAddress.slice(0, -1);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return tmpLintedAddress;
|
|
379
|
+
}
|
|
380
|
+
|
|
365
381
|
// Get the value of an element at an address
|
|
366
382
|
getValueAtAddress (pObject, pAddress)
|
|
367
383
|
{
|
|
368
|
-
let tmpLintedAddress =
|
|
384
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
369
385
|
if (tmpLintedAddress == '')
|
|
370
386
|
{
|
|
371
387
|
this.logError(`(${this.scope}) Error getting value at address; address is an empty string.`, pObject);
|
|
372
388
|
return undefined;
|
|
373
389
|
}
|
|
374
|
-
let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject,
|
|
390
|
+
let tmpValue = this.objectAddressGetValue.getValueAtAddress(pObject, tmpLintedAddress);
|
|
375
391
|
|
|
376
392
|
if (typeof(tmpValue) == 'undefined')
|
|
377
393
|
{
|
|
378
394
|
// Try to get a default if it exists
|
|
379
|
-
tmpValue = this.getDefaultValue(this.getDescriptor(
|
|
395
|
+
tmpValue = this.getDefaultValue(this.getDescriptor(tmpLintedAddress));
|
|
380
396
|
}
|
|
381
397
|
|
|
382
398
|
return tmpValue;
|
|
@@ -391,7 +407,8 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
391
407
|
// Set the value of an element at an address
|
|
392
408
|
setValueAtAddress (pObject, pAddress, pValue)
|
|
393
409
|
{
|
|
394
|
-
|
|
410
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
411
|
+
return this.objectAddressSetValue.setValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
395
412
|
}
|
|
396
413
|
|
|
397
414
|
// Delete the value of an element by its hash
|
|
@@ -403,7 +420,8 @@ class Manyfest extends libFableServiceProviderBase
|
|
|
403
420
|
// Delete the value of an element at an address
|
|
404
421
|
deleteValueAtAddress (pObject, pAddress, pValue)
|
|
405
422
|
{
|
|
406
|
-
|
|
423
|
+
let tmpLintedAddress = this.lintAddress(pAddress);
|
|
424
|
+
return this.objectAddressDeleteValue.deleteValueAtAddress(pObject, tmpLintedAddress, pValue);
|
|
407
425
|
}
|
|
408
426
|
|
|
409
427
|
// Validate the consistency of an object against the schema
|
|
@@ -160,6 +160,19 @@ suite
|
|
|
160
160
|
}
|
|
161
161
|
);
|
|
162
162
|
test
|
|
163
|
+
(
|
|
164
|
+
'Access relative objects with invalid dots',
|
|
165
|
+
(fTestComplete)=>
|
|
166
|
+
{
|
|
167
|
+
let _Manyfest = new libManyfest();
|
|
168
|
+
Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'location.city')).to.equal('Sunnyvale');
|
|
169
|
+
Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'location.city.')).to.equal('Sunnyvale');
|
|
170
|
+
Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'current_observation.wind.').chill).to.equal(59);
|
|
171
|
+
Expect(_Manyfest.getValueAtAddress(_SampleDataYahooWeather, 'current_observation.BadObjectPropertyName.')).to.equal(undefined);
|
|
172
|
+
fTestComplete();
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
test
|
|
163
176
|
(
|
|
164
177
|
'Access specific array elements',
|
|
165
178
|
(fTestComplete)=>
|
package/types/Manyfest.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ declare class Manyfest {
|
|
|
78
78
|
checkAddressExists(pObject: any, pAddress: any): any;
|
|
79
79
|
resolveHashAddress(pHash: any): any;
|
|
80
80
|
getValueByHash(pObject: any, pHash: any): any;
|
|
81
|
+
lintAddress(pAddress: any): any;
|
|
81
82
|
getValueAtAddress(pObject: any, pAddress: any): any;
|
|
82
83
|
setValueByHash(pObject: any, pHash: any, pValue: any): any;
|
|
83
84
|
setValueAtAddress(pObject: any, pAddress: any, pValue: any): any;
|
package/types/Manyfest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manyfest.d.ts","sourceRoot":"","sources":["../source/Manyfest.js"],"names":[],"mappings":";AAiBA;;;;;;;;;;GAUG;AAEH;;;;EAIE;AACF;IAEC,4DAkEC;IAvDA,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IAEN,oBAA6B;IAGnC,kDAA2B;IAC3B,mDAA4B;IAG5B,oEAA0G;IAC1G,gDAAsF;IACtF,gDAAsF;IACtF,sDAA4F;IAwB5F,WAAsB;IACtB,wBAAiC;IACjC,kBAA8B;IAC9B,uBAAmC;IASnC,2CAAiF;IACjF,oDAA0F;IAE1F,qCAA2E;IAE3E,oBAA8D;IAG/D;;OAEG;IAGH,cAMC;IAED,iCAWC;IAGD,wCAIC;IAGD,mCAiEC;IAGD,oBAGC;IAED;;;;MAQC;IAED;;;;;OAKG;IACH,wBAHW,MAAM,eACN,kBAAkB,WAyC5B;IAED;;;;OAIG;IACH,2BAJW,MAAM,GAEL,kBAAkB,CAK7B;IAED;;;;OAIG;IACH,wBAJW,MAAM,GAEL,kBAAkB,CAK7B;IAED;;;OAGG;IACH,wBAFW,CAAC,CAAC,EAAE,kBAAkB,KAAK,IAAI,QAUzC;IAED;;OAEG;IAEH,wDAGC;IAGD,qDAGC;IAGD,oCA8BC;IAGD,8CAWC;IAGD,oDAiBC;IAGD,2DAGC;IAGD,
|
|
1
|
+
{"version":3,"file":"Manyfest.d.ts","sourceRoot":"","sources":["../source/Manyfest.js"],"names":[],"mappings":";AAiBA;;;;;;;;;;GAUG;AAEH;;;;EAIE;AACF;IAEC,4DAkEC;IAvDA,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IAEN,oBAA6B;IAGnC,kDAA2B;IAC3B,mDAA4B;IAG5B,oEAA0G;IAC1G,gDAAsF;IACtF,gDAAsF;IACtF,sDAA4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