pid / speakingurl

Generate a slug – transliteration with a lot of options
http://pid.github.io/speakingurl/
BSD 3-Clause "New" or "Revised" License
1.12k stars 84 forks source link

An ampersand at the end will cause a TypeError #17

Closed danielcha closed 11 years ago

danielcha commented 11 years ago

While I can not think of many cases where you would want an ampersand at the end of something... it should not break speakingurl.

getSlug('test &');

/test/node_modules/speakingurl/lib/index.js:86
            ch += input[i + 1].match(/[A-Za-z0-9]/) ? separator : '';
                               ^
TypeError: Cannot call method 'match' of undefined
    at getSlug (/test/node_modules/speakingurl/lib/index.js:86:36)
    at Object.<anonymous> (/test/test.js:39:3)
    at Object.<anonymous> (/test/test.js:3137:4)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:245:9)
pid commented 11 years ago

thanks @danielcha

pid commented 11 years ago

v0.2.21 is published