Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// assert(String)
this.name = args[i++].value;
}
if ( args[i].type === Syntax.ArrayExpression ) {
this.dependencyArray = args[i++];
this.dependencies = this.dependencyArray.elements.map( (elem) => {
if ( !isString(elem) ) {
throw new TypeError();
}
return ModuleName.resolveRelativeRequireJSName(this.name, elem.value);
});
this.dependencyInsertionIdx = this.dependencyArray.elements.length;
}
if ( args[i].type === Syntax.FunctionExpression ) {
this.factory = args[i++];
params = this.factory.params;
this.paramNames = params.map( (param) => {
if ( param.type !== Syntax.Identifier ) {
throw new TypeError();
}
return param.name;
});
if ( this.factory.params.length < this.dependencyInsertionIdx ) {
this.dependencyInsertionIdx = this.factory.params.length;
}
}
// console.log("declared dependencies: " + this.dependencies);
}
function hasContext(type) {
return [
Syntax.ArrowFunctionExpression,
Syntax.FunctionDeclaration,
Syntax.FunctionExpression,
Syntax.ForStatement,
Syntax.ForInStatement,
Syntax.ForOfStatement,
Syntax.BlockStatement,
].indexOf(type) !== -1;
}