machine-string
v2.0.1
Published
turn a string into a consistent machine readable string
Readme
machine-string
turn a string into a consistent machine readable string
npm install machine-stringvar machineString = require('machine-string');
var input = 'Hello, this is a test 1 2 3 4. Something!';
machineString(input); // > hello_this_is_a_test_1_2_3_4_something
var input = 'Mac OS X';
machineString(input, '-'); // > mac-os-xIt also transforms most diacriticals to their safe latin counterpart:
machineString('ÄÈÒÙÌÆ'); // > aeouiaeYou can define your own separator in the second argument of the function:
machineString('Hello, there!', '-'); // > hello-there