Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function extractProvide(
statement: estree.Statement | estree.ModuleDeclaration,
provides: string[]
): boolean {
if (
statement.type === Syntax.ExpressionStatement &&
statement.expression.type === Syntax.CallExpression
) {
const callExp = statement.expression;
const firstArg = callExp.arguments[0];
if (
firstArg &&
firstArg.type === Syntax.Literal &&
deepEqual(espurify(callExp.callee), {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'goog',
},
property: {
type: 'Identifier',
name: 'provide',
},
})
) {
if (typeof firstArg.value !== 'string') {
throw new Error('Unexpected value: ' + firstArg.value);
}
provides.push(firstArg.value!);
cloneValue() {
return espurify(this.value);
}