lcp

Compute the Longest Common Prefix from some strings

  • lcp

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
lcp
201.1.08 years ago9 years agoMinified + gzip package size for lcp in KB

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'