trying to use https://www.npmjs.org/package/to-uri, but it says toURI function is not defined, how do I make it global or call it from package directly?
Asked
Active
Viewed 22 times
1 Answers
1
It's a weird module, but this seems to work:
String.prototype.toURI = require('to-uri');
...
var text = 'Тест: Проверим текст на русском языке';
console.log(text.toURI());
This produces the following:
'test-proverim-text-na-russkom-yazyke'

robertklep
- 198,204
- 35
- 394
- 381
-
actually I had a typo at first, used it via .call(text) then – Herokiller Oct 09 '14 at 14:33