How to create module for bpmn-js modeler

I am trying to create a custom properties panel and using the existing example as inspiration. There’s quite a lot I don’t need however. I only need to be able to edit specific properties from tasks and sequence flows. I have already written the code, I just want to wrap it into a module for good practice. How would I do this?

Here’s the code:

var eventBus = BpmnJS.get('eventBus');

eventBus.on('selection.changed', e => {
    if (e.newSelection && e.newSelection.length === 1) {
        showPropertiesOf(e.newSelection[0]);
    } else {
        clearPanel();
    }
});

function showPropertiesOf(element) {
    switch(element.businessObject.$type) {
        case 'bpmn:sequenceFlow':
            var cExpr = element.businessObject.conditionExpression;
            if (cExpr === undefined) {
                cExpr = moddle.create('bpmn:FormalExpression', {
                    body: ''
                });
                modeling.updateProperties(element, {
                    conditionExpression: cExpr
                });
            }
            showTextProperty('Expression', element);
        case 'bpmn:ServiceTask':
        case 'bpmn:UserTask':
        case 'bpmn:Task':
            showTextProperty('Name', element);
            showTextProperty('Id', element);
            break;
        case 'bpmn:ServiceTask':
        case 'bpmn:UserTask':
        case 'bpmn:Task':
            showDropdownProperty('Task type', element)

}

function show___Property(property, element) {
    // DOM stuff
    // calls modeling.updateProperties on changes
}

This part of the walkthrough describes how to create custom modules. This should help you.