Skip to content

matching ngrams

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Get matching n-grams between strings.

const matchingNgrams = require('@extra-string/matching-ngrams');
// matchingNgrams(<string-1>, <string-2>, <n>)

matchingNgrams('worm', 'storm', 2);
// ['or', 'rm']
matchingNgrams('astronaut', 'astronomer', 3);
// ['ast', 'str', 'tro', 'ron']
matchingNgrams('coconut', 'cotton', 2);
// ['co', 'on']

extra-string

Clone this wiki locally