1.0.0 • Published 2 years ago

parameterize-js v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Parameterize.js

This is a fork of node-parameterize by Fırat Yalavuz, rewritten in TypeScript.

This repository adds node.js and npm support for parameterize which is originally used in Ruby on Rails. It replaces special characters in a string so that it may be used as part of a 'pretty' URL.

parameterize.js is a port of django admin urlify.js

Installing

npm install parameterize.js

Supports

  • Turkish
  • Azerbaijani
  • Serbian
  • Greek
  • Georgian
  • Russian
  • Ukranian
  • Czech
  • Polish
  • Romanian
  • Latvanian
  • Lithuanian
  • Arabic
  • Latin special chars

Usage

import parameterize from 'parameterize.js';

// outputs
// parameterized-url-with-special-characters-ocisc
parameterize('parameterized url with special characters, öçıŞÇ');

// optional length limit
// outputs
// this-is-a-l
parameterize('this is a long text', {maxLength: 10});

// you can change separator character
// outputs
// this_is_a_l
parameterize('this is a long text', {maxLength: 10, separator: '_'});