JS port of a subset my Modelbuilder Processing library