hzoo / babel-plugin-dedupe-string-literals

Dedupe strings with new variable declarations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Account for different parentPaths

hzoo opened this issue · comments

commented

It's hardcoded for 2 cases

['a','a'] - ExpressionStatement, ArrayExpression in the body
var a = ['a','a'] - VariableDeclaration, VariableDeclarator, ArrayExpression.

Needs to traverse parents to some level where a VariableDeclaration is possible - basically the closest parent function scope?