Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return params.reduce((prev, param): string[] => {
if (param.type === Syntax.Identifier) {
return prev.concat(getIdentifierName(param));
}
if (param.type === Syntax.AssignmentPattern) {
return prev.concat(getAssignmentPatternName(param));
}
if (param.type === Syntax.ArrayPattern) {
return prev.concat(getArrayPatternName(param));
}
if (param.type === Syntax.ObjectPattern) {
return prev.concat(getObjectPatternName(param));
}
if (param.type === Syntax.RestElement) {
return prev.concat(getRestElementName(param));
}
}, []);
}
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));
}
}, []);
}