Annotator JS - abstract class details extraction into a function