We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let source = `require('a');console.log(123);require('b');` // source => AST => replaces let replaces = [{ from: 8, to: 11, name: 'a', value: 1 }, { from: 38, to: 41, name: 'b', value: 2 }]; // 期望输出 'require(/* a */1);console.log(123);require(/* b */2);'
The text was updated successfully, but these errors were encountered:
let result = [source]; replaces.sort((a, b) => b.from - a.from).forEach(replace => { let remainSource = result.shift(); result.unshift( remainSource.substr(0, replace.from), `/* ${replace.name} */${replace.value}`, remainSource.substr(replace.to) ) }); console.log(result.join(''));
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: