This package has been deprecated

Author message:

Package no longer supporteed. Use at your own risk. Please refer to using package https://www.npmjs.com/package/js-convert-case.

js-sentencecase

1.2.1 • Public • Published

js-sentencecase

NPM version NPM downloads

JavaScript convert string to Sentence case - Use for both Node.JS and Browser.

Installation

$ npm install --save js-sentencecase

or

$ yarn add js-sentencecase

Usage

Node.JS

const toSentenceCase = require('js-sentencecase');
 
console.log(toSentenceCase('string')); // => String
console.log(toSentenceCase('camelCase')); // => Camel case
console.log(toSentenceCase('param-case')); // => Param case
console.log(toSentenceCase('PascalCase')); // => Pascal case
console.log(toSentenceCase('UPPER_CASE')); // => Upper case
console.log(toSentenceCase('snake_case')); // => Snake case
console.log(toSentenceCase('sentence case')); // => Sentence case
console.log(toSentenceCase('Title Case')); // => Title case
console.log(toSentenceCase('dot.case')); // => // Dot case
 
console.log(toSentenceCase('')); // => ''
console.log(toSentenceCase(null)); // => ''
console.log(toSentenceCase(undefined)); // => ''
 
console.log(toSentenceCase('Abc ___ 123 ___ xYz')); // => Abc 123 x yz
console.log(toSentenceCase('123__abc  ... ?// {#} def 12')); // => 123 abc def 12
console.log(toSentenceCase(' tab space ??? ________')); // => Tab space
console.log(toSentenceCase('___?||123  abc|| 123..123')); // => 123 abc 123 123
console.log(toSentenceCase('!@#$%  {}|":;" ABC XyZ G123H')); // => Abc xy z g123h
console.log(toSentenceCase(' ^&* #DEFine x: 15 + ==')); // => Define x 15
console.log(toSentenceCase('123456789')); // => 123456789

Browser

1. NPM Package
<script src="./node_modules/js-sentencecase/dist/js-sentencecase.js"></script>
<!-- Or use minified -->
<script src="./node_modules/js-sentencecase/dist/js-sentencecase.min.js"></script>
2. Download from source
<script src="path/to/js-sentencecase"></script>
Usage
<script>
    console.log(toSentenceCase('string')); // => String
    console.log(toSentenceCase('camelCase')); // => Camel case
    console.log(toSentenceCase('param-case')); // => Param case
    console.log(toSentenceCase('PascalCase')); // => Pascal case
    console.log(toSentenceCase('UPPER_CASE')); // => Upper case
    console.log(toSentenceCase('snake_case')); // => Snake case
    console.log(toSentenceCase('sentence case')); // => Sentence case
    console.log(toSentenceCase('Title Case')); // => Title case
    console.log(toSentenceCase('dot.case')); // => // Dot case
 
    console.log(toSentenceCase('')); // => ''
    console.log(toSentenceCase(null)); // => ''
    console.log(toSentenceCase(undefined)); // => ''
 
    console.log(toSentenceCase('Abc ___ 123 ___ xYz')); // => Abc 123 x yz
    console.log(toSentenceCase('123__abc  ... ?// {#} def 12')); // => 123 abc def 12
    console.log(toSentenceCase(' tab space ??? ________')); // => Tab space
    console.log(toSentenceCase('___?||123  abc|| 123..123')); // => 123 abc 123 123
    console.log(toSentenceCase('!@#$%  {}|":;" ABC XyZ G123H')); // => Abc xy z g123h
    console.log(toSentenceCase(' ^&* #DEFine x: 15 + ==')); // => Define x 15
    console.log(toSentenceCase('123456789')); // => 123456789
</script> 

API

toSentenceCase(str)

Returns a new string which is sentencecase format of str.

Dependencies

No dependencies

Related

Package Sidebar

Install

npm i js-sentencecase

Weekly Downloads

29

Version

1.2.1

License

ISC

Unpacked Size

5.9 kB

Total Files

5

Last publish

Collaborators

  • huynhsamha