0
ノードをjavascriptに変換するにはどうすればよいですか?astノードを基になるjavascriptの文字列に変換する方法
// target file
function execute() {
var a = 'a'
}
// jscodeshift
export default(file, api) => {
const j = api.jscodeshift
const root = j(file.source)
var node = root.find(j.VariableDeclaration)
// i want to see what node looks like in javascript.
return root.toSource()
}
おかげで、見つける '' VS find'の結果の違いは何ですが.at.get'? – user2167582
'find'は' collection'を返します。(index)でそのインデックスの要素を選択し、 'get'は実際のノードを返します。 – bluehipy