Last active
June 5, 2016 09:28
-
-
Save aduth/94d4014b3b96aa15070cb0cab48dfb32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* External dependencies | |
*/ | |
var kebabCase = require( 'lodash/kebabCase' ); | |
/** | |
* Constants | |
*/ | |
var ROOT_PATH = 'state/selectors'; | |
module.exports = function() { | |
return { | |
visitor: { | |
ImportSpecifier: function( path ) { | |
if ( 0 !== path.parent.source.value.indexOf( ROOT_PATH ) ) { | |
return; | |
} | |
path.parent.source.value += '/' + kebabCase( path.node.imported.name ); | |
} | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment