Skip to content

Instantly share code, notes, and snippets.

@aduth
Last active June 5, 2016 09:28
Show Gist options
  • Save aduth/94d4014b3b96aa15070cb0cab48dfb32 to your computer and use it in GitHub Desktop.
Save aduth/94d4014b3b96aa15070cb0cab48dfb32 to your computer and use it in GitHub Desktop.
/**
* 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