Git Product home page Git Product logo

js-dotcase's Introduction

js-dotcase

NPM version NPM downloads

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

Installation

$ npm install --save js-dotcase

or

$ yarn add js-dotcase

Usage

Node.JS

const todDotcCase = require('js-dotcase');

console.log(toDotCase('string')); // => string
console.log(toDotCase('camelCase')); // => camel.case
console.log(toDotCase('param-case')); // => param.case
console.log(toDotCase('PascalCase')); // => pascal.case
console.log(toDotCase('UPPER_CASE')); // => upper.case
console.log(toDotCase('snake_case')); // => snake.case
console.log(toDotCase('sentence case')); // => sentence.case
console.log(toDotCase('Title Case')); // => title.case
console.log(toDotCase('dot.case')); // => // dot.case

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

console.log(toDotCase('Abc ___ 123 ___ xYz')); // => abc.123.x.yz
console.log(toDotCase('123__abc  ... ?// {#} def 12')); // => 123.abc.def.12
console.log(toDotCase('	tab space ??? ________')); // => tab.space
console.log(toDotCase('___?||123  abc|| 123..123')); // => 123.abc.123.123
console.log(toDotCase('!@#$%  {}|":;" ABC XyZ G123H')); // => abc.xy.z.g123h
console.log(toDotCase(' ^&* #DEFine x: 15 + ==')); // => define.x.15
console.log(toDotCase('123456789')); // => 123456789

Browser

1. NPM Package
<script src="./node_modules/js-dotcase/dist/js-dotcase.js"></script>
<!-- Or use minified -->
<script src="./node_modules/js-dotcase/dist/js-dotcase.min.js"></script>
2. Download from source
<script src="path/to/js-dotcase"></script>
Usage
<script>
	console.log(toDotCase('string')); // => string
	console.log(toDotCase('camelCase')); // => camel.case
	console.log(toDotCase('param-case')); // => param.case
	console.log(toDotCase('PascalCase')); // => pascal.case
	console.log(toDotCase('UPPER_CASE')); // => upper.case
	console.log(toDotCase('snake_case')); // => snake.case
	console.log(toDotCase('sentence case')); // => sentence.case
	console.log(toDotCase('Title Case')); // => title.case
	console.log(toDotCase('dot.case')); // => // dot.case

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

	console.log(toDotCase('Abc ___ 123 ___ xYz')); // => abc.123.x.yz
	console.log(toDotCase('123__abc  ... ?// {#} def 12')); // => 123.abc.def.12
	console.log(toDotCase('	tab space ??? ________')); // => tab.space
	console.log(toDotCase('___?||123  abc|| 123..123')); // => 123.abc.123.123
	console.log(toDotCase('!@#$%  {}|":;" ABC XyZ G123H')); // => abc.xy.z.g123h
	console.log(toDotCase(' ^&* #DEFine x: 15 + ==')); // => define.x.15
	console.log(toDotCase('123456789')); // => 123456789
</script>

API

toDotCase(str)

Returns a new string which is dotcase format of str.

Dependencies

No dependencies

Related

js-dotcase's People

Contributors

huynhsamha avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.