lcp
v1.1.0
Published
Compute the Longest Common Prefix from some strings
Downloads
552
Readme
LCP - Longest Common Prefix
Computes the longest common prefix for strings using a Trie
API
var LCP = require('lcp')
var lcp = new LCP(['fooseball', 'foobar', 'foam'])
lcp.addWord('foobar')
lcp.lcp() // 'fo'
or if you don't like classes
LCP.findLCP(['fooseball', 'foobar', 'foam']) // 'fo'