manyfest 1.0.37 → 1.0.38
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
|
@@ -47,9 +47,19 @@ class ManyfestObjectAddressResolverGetValue
|
|
|
47
47
|
getValueAtAddress (pObject, pAddress, pParentAddress, pRootObject)
|
|
48
48
|
{
|
|
49
49
|
// Make sure pObject (the object we are meant to be recursing) is an object (which could be an array or object)
|
|
50
|
-
if (typeof(pObject) != 'object')
|
|
50
|
+
if (typeof(pObject) != 'object')
|
|
51
|
+
{
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (pObject === null)
|
|
55
|
+
{
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
51
58
|
// Make sure pAddress (the address we are resolving) is a string
|
|
52
|
-
if (typeof(pAddress) != 'string')
|
|
59
|
+
if (typeof(pAddress) != 'string')
|
|
60
|
+
{
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
53
63
|
// Stash the parent address for later resolution
|
|
54
64
|
let tmpParentAddress = "";
|
|
55
65
|
if (typeof(pParentAddress) == 'string')
|
|
@@ -335,7 +345,7 @@ class ManyfestObjectAddressResolverGetValue
|
|
|
335
345
|
}
|
|
336
346
|
else
|
|
337
347
|
{
|
|
338
|
-
return
|
|
348
|
+
return null;
|
|
339
349
|
}
|
|
340
350
|
}
|
|
341
351
|
}
|
|
@@ -43,6 +43,25 @@ suite
|
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
test
|
|
46
|
+
(
|
|
47
|
+
'Javascript null values should not cause errors..',
|
|
48
|
+
(fTestComplete)=>
|
|
49
|
+
{
|
|
50
|
+
let _Manyfest = new libManyfest({ Scope:'Archive.org', Descriptors: {'metadata.creator': {Name:'Creator', Hash:'Creator'}}});
|
|
51
|
+
let tmpNullSampleData = JSON.parse(JSON.stringify(_SampleDataArchiveOrgFrankenberry));
|
|
52
|
+
tmpNullSampleData.Noel = null;
|
|
53
|
+
let tmpNullValue = _Manyfest.getValueAtAddress(tmpNullSampleData, 'Noel');
|
|
54
|
+
let tmpNullValueOneDeep = _Manyfest.getValueAtAddress(tmpNullSampleData, 'Noel.SomeChildValue');
|
|
55
|
+
let tmpNullValueTwoDeep = _Manyfest.getValueAtAddress(tmpNullSampleData, 'Noel.SomeChildValue.SecondTier');
|
|
56
|
+
let tmpNullValueTwoDeepObject = _Manyfest.getValueAtAddress(tmpNullSampleData, 'Noel.SomeChildValue[SecondTier]');
|
|
57
|
+
let tmpNullValueTwoDeepArray = _Manyfest.getValueAtAddress(tmpNullSampleData, 'Noel.SomeChildValue.SecondTier[0]');
|
|
58
|
+
Expect(tmpNullValue).to.equal(null);
|
|
59
|
+
Expect(tmpNullValueOneDeep).to.equal(undefined);
|
|
60
|
+
Expect(tmpNullValueTwoDeep).to.equal(undefined);
|
|
61
|
+
fTestComplete();
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
test
|
|
46
65
|
(
|
|
47
66
|
'It should be trivial to access subproperties with a schema by hash.',
|
|
48
67
|
(fTestComplete)=>
|