Pity js doesn't have a native trim function. Still, find a regex to reduce this step to one line.