hiddentao / fast-levenshtein

Efficient Javascript implementation of Levenshtein algorithm with locale-specific collator support.
MIT License
596 stars 56 forks source link

Use import instead of require #28

Open kunjesh1 opened 4 years ago

kunjesh1 commented 4 years ago

I want to import the npm in the client side instead of require.How to do that?

ironprice91 commented 4 years ago

@kunjesh1 I was facing a similar issue as well. I was able to import with the following code

import { get as levenshtein } from 'fast-levenshtein';
levenshtein('cat', 'bat');

Hope that helps!

KonkretneKosteczki commented 4 years ago

Why not just do

import * as levenshtein from 'fast-levenshtein';

And use it the same way as with require

levenshtein.get('cat', 'bat');