Longest Common Substring in node.js