Added dynamic type check to determine a factory vs an object to export for UMD case. Fix for UMD chopping off statements nested in if statement.