Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.
/ js-headercase Public archive

πŸ›‘ [deprecated] πŸ›‘ JavaScript Headercase for both node.js and browser

Notifications You must be signed in to change notification settings

huynhsamha/js-headercase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

js-headercase

NPM version NPM downloads

JavaScript convert string to Header Case - Use for both Node.JS and Browser.

Installation

$ npm install --save js-headercase

or

$ yarn add js-headercase

Usage

Node.JS

const toHeaderCase = require('js-headercase');

console.log(toHeaderCase('string')); // => String
console.log(toHeaderCase('camelCase')); // => Camel Case
console.log(toHeaderCase('param-case')); // => Param Case
console.log(toHeaderCase('PascalCase')); // => Pascal Case
console.log(toHeaderCase('UPPER_CASE')); // => Upper Case
console.log(toHeaderCase('snake_case')); // => Snake Case
console.log(toHeaderCase('sentence case')); // => Sentence Case
console.log(toHeaderCase('Title Case')); // => Title Case
console.log(toHeaderCase('dot.case')); // => // Dot Case

console.log(toHeaderCase('')); // => ''
console.log(toHeaderCase(null)); // => ''
console.log(toHeaderCase(undefined)); // => ''

console.log(toHeaderCase('Abc ___ 123 ___ xYz')); // => Abc 123 X Yz
console.log(toHeaderCase('123__abc  ... ?// {#} def 12')); // => 123 Abc Def 12
console.log(toHeaderCase('	tab space ??? ________')); // => Tab Space
console.log(toHeaderCase('___?||123  abc|| 123..123')); // => 123 Abc 123 123
console.log(toHeaderCase('!@#$%  {}|":;" ABC XyZ G123H')); // => Abc Xy z G123h
console.log(toHeaderCase(' ^&* #DEFine x: 15 + ==')); // => Define X 15
console.log(toHeaderCase('123456789')); // => 123456789

Browser

1. NPM Package
<script src="./node_modules/js-headercase/dist/js-headercase.js"></script>
<!-- Or use minified -->
<script src="./node_modules/js-headercase/dist/js-headercase.min.js"></script>
2. Download from source
<script src="path/to/js-headercase"></script>
Usage
<script>
	console.log(toHeaderCase('string')); // => String
	console.log(toHeaderCase('camelCase')); // => Camel Case
	console.log(toHeaderCase('param-case')); // => Param Case
	console.log(toHeaderCase('PascalCase')); // => Pascal Case
	console.log(toHeaderCase('UPPER_CASE')); // => Upper Case
	console.log(toHeaderCase('snake_case')); // => Snake Case
	console.log(toHeaderCase('sentence case')); // => Sentence Case
	console.log(toHeaderCase('Title Case')); // => Title Case
	console.log(toHeaderCase('dot.case')); // => // Dot Case

	console.log(toHeaderCase('')); // => ''
	console.log(toHeaderCase(null)); // => ''
	console.log(toHeaderCase(undefined)); // => ''

	console.log(toHeaderCase('Abc ___ 123 ___ xYz')); // => Abc 123 X Yz
	console.log(toHeaderCase('123__abc  ... ?// {#} def 12')); // => 123 Abc Def 12
	console.log(toHeaderCase('	tab space ??? ________')); // => Tab Space
	console.log(toHeaderCase('___?||123  abc|| 123..123')); // => 123 Abc 123 123
	console.log(toHeaderCase('!@#$%  {}|":;" ABC XyZ G123H')); // => Abc Xy z G123h
	console.log(toHeaderCase(' ^&* #DEFine x: 15 + ==')); // => Define X 15
	console.log(toHeaderCase('123456789')); // => 123456789
</script>

API

toHeaderCase(str)

Returns a new string which is headercase format of str.

Dependencies

No dependencies

Related

About

πŸ›‘ [deprecated] πŸ›‘ JavaScript Headercase for both node.js and browser

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published