Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return node.elements.reduce((prev, element): string[] => {
if (element.type === Syntax.Identifier) {
return prev.concat(getIdentifierName(element));
}
if (element.type === Syntax.AssignmentPattern) {
return prev.concat(getAssignmentPatternName(element));
}
if (element.type === Syntax.ArrayPattern) {
return prev.concat(getArrayPatternName(element));
}
if (element.type === Syntax.ObjectPattern) {
return prev.concat(getObjectPatternName(element));
}
if (element.type === Syntax.RestElement) {
return prev.concat(getRestElementName(element));
}
}, []);
}
return node.properties.reduce((prev, property): string[] => {
const value = property.value;
if (value.type === Syntax.Identifier) {
return prev.concat(getIdentifierName(value));
}
if (value.type === Syntax.AssignmentPattern) {
return prev.concat(getAssignmentPatternName(value));
}
if (value.type === Syntax.ArrayPattern) {
return prev.concat(getArrayPatternName(value));
}
if (value.type === Syntax.ObjectPattern) {
return prev.concat(getObjectPatternName(value));
}
}, []);
}