Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const base = hierarchy[0]
// if I picked the root node,a direct descendent or a package just ask the user to select any object type
// if not, for abap nodes pick child objetc types (if any)
// for non-abap nodes if it's an object type guess the type from the children
if (hierarchy.length > 2)
if (isAbapNode(base) && base.abapObject.type.match(/FUGR\/F/))
return selectObjectType(base.abapObject.type)
else {
const child = base.isFolder
? [...base]
.map(c => c[1])
.find(c => isAbapNode(c) && c.abapObject.type !== PACKAGE)
: base
if (child && isAbapNode(child)) {
const typeid = child.abapObject.type as CreatableTypeIds
const guessed = CreatableTypes.get(typeid)
if (guessed) return guessed
}
}
// default...
return selectObjectType()
}