Easy ways to get jsConvert onto your website.
jsConvert is a simple library to convert string between cases (camelCase, snake_case, PascalCase, dot.case, path/case, text case, Sentence case, Header Case, UPPERCASE, lowercase).
Use for both Node.JS and Browser. Available on NPM.
git clone https://github.com/huynhsamha/js-convert-case.git
require
:const jsConvert = require('js-convert-case');
// or
const { toCamelCase, toDotCase, upperKeys, snakeKeys } = require('js-convert-case');
import
:import js-convert-case from 'js-convert-case';
// or
import { toPascalCase, toPathCase, lowerKeys, camelKeys } from 'js-convert-case';
js-convert-case.min.js
is loaded, object jsConvert
will be exported globally into window
object.console.log(window.jsConvert);
console.log(jsConvert);
jsConvert.toCamelCase('param-case'); // paramCase
jsConvert.toSnakeCase('param-case'); // param_case
jsConvert.toPascalCase('param-case'); // ParamCase
jsConvert.toDotCase('param-case'); // param.case
jsConvert.toPathCase('param-case'); // param/case
jsConvert.toTextCase('param-case'); // param case
jsConvert.toSentenceCase('param-case'); // Param case
jsConvert.toHeaderCase('param-case'); // Param Case
jsConvert.toLowerCase('param-case'); // param-case
jsConvert.toUpperCase('param-case'); // PARAM-CASE
const obj = {
camelCase: 1,
UPPERCASE: 2,
lowercase: 3,
snake_case: 4,
PascalCase: 5,
'Title Case': 6,
'dot.case': 7,
'param-case': 8,
'Sentence case': 9,
'path/case': 10,
'Header-Case': 11
};
jsConvert.lowerKeys(obj);
jsConvert.upperKeys(obj);
jsConvert.camelKeys(obj);
jsConvert.snakeKeys(obj);
jsConvert.pascalKeys(obj);
jsConvert.upperKeys(obj, { recursive: true });
jsConvert.lowerKeys(obj, { recursive: true });
jsConvert.snakeKeys(obj, { recursive: true });
jsConvert.camelKeys(obj, { recursive: true });
jsConvert.pascalKeys(obj, { recursive: true });