Replace any special characters in a string with an ASCII approximation.
npm install parameterize-stringReplace any special characters in a string with an ASCII approximation. Usefull for creating URL-friendly slugs.
This package is very similar to the ActiveSupport::Inflector parameterize method in Ruby on Rails.
npm install --save parameterize-stringjavascript
{
separator: '-',
preserveCase: false,
}
`$3
`javascript
import parameterize from 'parameterize-string';parameterize('Björk Guðmundsdóttir'); // bjork-gudmundsdottir
parameterize('Björk Guðmundsdóttir', { preserveCase: true }); // Bjork-Gudmundsdottir
parameterize('Björk Guðmundsdóttir', { separator: '_' }); // bjork_gudmundsdottir
`Test
npm test`