machine-string

2.0.1 • Public • Published

machine-string

build status

turn a string into a consistent machine readable string

npm install machine-string
var 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-x

It also transforms most diacriticals to their safe latin counterpart:

machineString('ÄÈÒÙÌÆ'); // > aeouiae

You can define your own separator in the second argument of the function:

machineString('Hello, there!', '-'); // > hello-there

Readme

Keywords

none

Package Sidebar

Install

npm i machine-string

Weekly Downloads

0

Version

2.0.1

License

ISC

Last publish

Collaborators

  • thomaslindstr_m