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));
}
}, []);
}
function getPropertyKey(property) {
if ( property.key.type === Syntax.Identifier ) {
return property.key.name;
} else if ( property.key.type === Syntax.Literal ) {
return String(property.key.value);
} else {
throw new Error();
}
}
function isIdentifier(node, name) {
if ( node.type != Syntax.Identifier ) {
return false;
}
if ( typeof name == "string" ) {
return name === node.name;
}
for (let i = 0; i < name.length; i++) {
if ( name[i] === node.name || name[i] === "*" ) {
return true;
}
}
return false;
}
this.paramNames = params.map( (param) => {
if ( param.type !== Syntax.Identifier ) {
throw new TypeError();
}
return param.name;
});
if ( this.factory.params.length < this.dependencyInsertionIdx ) {
function getAssignmentPatternName(node): string[] {
if (node.left.type === Syntax.Identifier) {
return [getIdentifierName(node.left)];
}
if (node.left.type === Syntax.ArrayPattern) {
return getArrayPatternName(node.left);
}
if (node.left.type === Syntax.ObjectPattern) {
return getObjectPatternName(node.left);
}
}
function getRestElementName(node): string[] {
visitMemberExpression.test = function(node, path, state) {
return node.type === Syntax.MemberExpression &&
node.property.type === Syntax.Identifier &&
reservedDict[node.property.name] === true;
};