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

Get n-grams of string.

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

ngrams('card', 2);
// ['ca', 'ar', 'rd']
ngrams('triple-h', 3);
// ['tri', 'rip', 'ipl', 'ple', 'le-', 'e-h']
ngrams('brocklesner', 10);
// ['brocklesne', 'rocklesner']

extra-string

Clone this wiki locally