Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '0' of undefined #3

Closed
moroshko opened this issue May 30, 2015 · 2 comments
Closed

TypeError: Cannot read property '0' of undefined #3

moroshko opened this issue May 30, 2015 · 2 comments

Comments

@moroshko
Copy link

I get the following error:

var levenshtein = require('levenshtein-damerau');
var distance = levenshtein('mentoen', 'all australia');

TypeError: Cannot read property '0' of undefined

@epadz
Copy link

epadz commented Dec 1, 2015

I've also been experiencing this. I got it from ld("cat", "kitten")

@gilly3
Copy link

gilly3 commented Feb 25, 2016

Happens consistently when second arg is two characters or more longer than first arg. If the second char is one character longer, it returns NaN:

> var ld = require("levenshtein-damerau");
undefined
> ld("abc", "abc");
0
> ld("abcd", "abc");
1
> ld("abcde", "abc");
2
> ld("abc", "abcd");
NaN
> ld("abc", "abcde");
TypeError: Cannot read property '1' of undefined
    at ld (./node_modules/levenshtein-damerau/skodld.js:67:59)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:164:27)
    at bound (domain.js:250:14)
    at REPLServer.runBound [as eval] (domain.js:263:12)
    at REPLServer.<anonymous> (repl.js:393:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants