Skip to content

asabya/string_to_case

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ported from https://github.com/ianstormtaylor/to-case

string_to_case

Build Status

Convert string to different cases

Usage

import { toNoCase,
        toSpaceCase,
        toCamelCase,
        toCapitalCase,
        toSnakeCase,
        toDotCase,
        toConstantCase,
        toPascalCase,
        toSentenceCase,
        toTitleCase } from "https://raw.githubusercontent.com/Sab94/string_to_case/master/mod.ts";

const a = toNoCase('this is a string');
console.log(a) //result: 'this is a string'

const b = toSpaceCase('thisIsAString');
console.log(b) //result: 'this is a string'

const c = toCamelCase('this is a string');
console.log(c) //result: 'thisIsAString'

const d = toCapitalCase('this is a string');
console.log(d) //result: 'This Is A String'

const e = toSnakeCase('this is a string');
console.log(e) //result: 'this_is_a_string'

const f = toDotCase('this is a string');
console.log(f) //result: 'this.is.a.string'

const g = toPascalCase('this is a string');
console.log(g) //result: 'ThisIsAString'

const h = toSentenceCase('This is a string');
console.log(h) //result: 'ThisIsAString'

const i = toTitleCase('aCamelCaseOfString');
console.log(i) //result: 'A Camel Case of String'

Tests

deno test.ts

License

MIT

About

Convert string to different cases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published