selectionsort commonjs/node friendly