'use strict';

/** WARNING:
 * this is copy of https://github.com/angular/angular/blob/main/packages/compiler/src/ml_parser/ast.ts
 * since @angular/compiler and @angular-devkit/schematics
 * are not compatible with each other */
function visitAll(visitor, nodes) {
    const result = [];
    const visit = visitor.visit
        ? (ast) => visitor.visit(ast) || ast.visit(visitor)
        : (ast) => ast.visit(visitor);
    nodes.forEach((ast) => {
        visit(ast);
    });
    return result;
}
// attr can be naked or in [ ]
// attr.value can be {{ value }} , 'value'
function getSimpleAttributeName(attrName) {
    return attrName.replace(/[\[\]]/g, '');
}
function getSimpleAttributeValue(attrValue) {
    return attrValue.replace(/[{}']/g, '');
}

exports.getSimpleAttributeName = getSimpleAttributeName;
exports.getSimpleAttributeValue = getSimpleAttributeValue;
exports.visitAll = visitAll;
