What is param-case?
The param-case package is a utility for converting text into 'param case', also known as 'kebab case', where words are lowercase and separated by hyphens. This is often used in URLs and file names.
What are param-case's main functionalities?
Convert to Param Case
Converts a string to param case (kebab case), making it lowercase with words separated by hyphens.
const { paramCase } = require('param-case');
const result = paramCase('stringToConvert');
// Output: 'string-to-convert'
Other packages similar to param-case
change-case
A comprehensive utility that includes param case conversion among other case transformations. It offers more general functionality compared to the focused approach of param-case.
lodash.kebabcase
Part of the Lodash library, this function converts strings to kebab case. It is similar to param-case but is part of a larger utility library with a wide range of functions.
slugify
Converts strings to URL slugs, which is similar to param case but also handles special characters and removes unwanted characters. It's more specialized for URL slug creation.
Param Case
Param case a string.
Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a toString
property, numbers and booleans. Empty values (null
and undefined
) will result in an empty string.
Installation
npm install param-case --save
Usage
var paramCase = require('param-case')
paramCase('string')
paramCase('camelCase')
paramCase('sentence case')
paramCase('MY STRING', 'tr')
Typings
Includes a TypeScript definition.
License
MIT