mirror of
https://github.com/ritz078/transform.git
synced 2026-11-20 16:22:53 +03:00
fix: valid JSDoc types, nested objects and order (#308)
* keep type to lowercase * correct order for nested objs
This commit is contained in:
1 parent
6890a7e109
commit
39782e214a
1 file changed
+7
-7
Vendored
+7
-7
@@ -82,8 +82,7 @@ function getTypeOfValue(value) {
|
||||
.toLowerCase();
|
||||
|
||||
if (!currentType) currentType = "*";
|
||||
|
||||
return currentType[0].toUpperCase() + currentType.substr(1);
|
||||
return currentType;
|
||||
}
|
||||
/**
|
||||
* @param {Array} array - The array that we want to parse
|
||||
@@ -125,6 +124,12 @@ function parseObject(obj, objectName, doNotReinsert = false) {
|
||||
const currentPrefix = `${prefix}${propertyName}`;
|
||||
let result = null;
|
||||
|
||||
// Root Object don't have a objectName
|
||||
if (!doNotReinsert && objectName) {
|
||||
if (!(objectName in this)) this[objectName] = [];
|
||||
this[objectName].push("object");
|
||||
}
|
||||
|
||||
// If it's Array, we need the values inside.
|
||||
if (propertyType === "array")
|
||||
parseArray.bind(this, currentValue, currentPrefix)();
|
||||
@@ -136,11 +141,6 @@ function parseObject(obj, objectName, doNotReinsert = false) {
|
||||
this[currentPrefix].push(result);
|
||||
}
|
||||
});
|
||||
// Root Object don't have a objectName
|
||||
if (!doNotReinsert && objectName) {
|
||||
if (!(objectName in this)) this[objectName] = [];
|
||||
this[objectName].push("object");
|
||||
}
|
||||
}
|
||||
|
||||
function ParseRootDefinition(obj) {
|
||||
|
||||
Reference in new issue
Block a user