Using node path module instead of regexes