const generate = require(`@babel/generator`).default;
const parser = require("@babel/parser");


const {extractSignalsKeys, findInVar} = require('./extract')
const fs = require("fs");
const {traverse} = require("@babel/core");
let sourceCode = fs.readFileSync('./decodeResult_ok.js', {encoding: "utf-8"});

let ast = parser.parse(sourceCode);
// signalKeys = extractSignalsKeys(ast)
traverse(ast, {
    VariableDeclaration(path) {
        let {found, value} = findInVar({path, valueToFind: `["userAgent"]`, mode: `endsWith`, siblingKey: 1});
        if (found) {
            console.log(value)

        }

    }
})
