This package has been deprecated

Author message:

use 'lodash' instead

capitalization
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Capitalization

Contains capitalize <=> hyphenate, camelCase <=> underline functions.

Example

const assert = require("assert");
var capitalization = require("capitalization");
var assert = require("assert");
var capitalize = capitalization.capitalize;
var hyphenate = capitalization.hyphenate;
var camelCase = capitalization.camelCase;
var underline = capitalization.underline;
 
assert.equal(capitalize("x-requested-with"), "X-Requested-With");
assert.equal(capitalize("x-requested-with", true), "XRequestedWith");
assert.equal(capitalize("test string"), "Test String");
assert.equal(hyphenate("XRequestedWith"), "X-Requested-With");
assert.equal(hyphenate("XRequestedWith", true), "x-requested-with");
assert.equal(camelCase("var_name"), "varName");
assert.equal(camelCase("var_name", true), "VarName");
assert.equal(underline("varName"), "var_name");
assert.equal(underline("varName", true), "var_Name");
assert.equal(underline("VarName", true), "Var_Name");
 
console.log("All tests passed!");

Package Sidebar

Install

npm i capitalization

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

5.12 kB

Total Files

7

Last publish

Collaborators

  • ayonli