Ofcourse, this is not something hard to do with javascript.
Here is some example code that does that.
(function(){
function commonCode(){
//common code goes here.
}
var app = angular.module("app");
app.directive("first",function(){
return function(scope,element,attrs){
commonCode();
}
});
app.directive("second",function(){
return function(scope,element,attrs){
commonCode();
}
});
app.directive("third",function(){
return function(scope,element,attrs){
commonCode();
}
});
})();
And its even easier to do it with Angularjs.
If this common code is extremely generic, then you could refactor out this commonCode into a service and inject it into all your directives.