Polyfill endsWith and add --group flag