Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/okunishinishi/node-stringcase
String case converter for Node.js
https://github.com/okunishinishi/node-stringcase
converter string
Last synced: 2 months ago
JSON representation
String case converter for Node.js
- Host: GitHub
- URL: https://github.com/okunishinishi/node-stringcase
- Owner: okunishinishi
- License: mit
- Created: 2015-07-11T05:43:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:14:47.000Z (about 2 years ago)
- Last Synced: 2024-11-09T00:12:48.950Z (3 months ago)
- Topics: converter, string
- Language: JavaScript
- Homepage:
- Size: 852 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
stringcase
==========[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url][bd_repo_url]: https://github.com/okunishinishi/node-stringcase
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-stringcase
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-stringcase.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-stringcase
[bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-stringcase.svg?token=
[bd_license_url]: https://github.com/okunishinishi/node-stringcase/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-stringcase
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-stringcase.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-stringcase.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-stringcase
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-stringcase.svg
[bd_npm_url]: http://www.npmjs.org/package/stringcase
[bd_npm_shield_url]: http://img.shields.io/npm/v/stringcase.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svgConvert string cases between camel case, pascal case, snake case etc...
Installation
-----```bash
npm install stringcase --save
```Usage
-------```Javascript
'use strict'const {
camelcase,
capitalcase,
constcase,
cramcase,
decapitalcase,
dotcase,
enumcase,
lowercase,
pascalcase,
pathcase,
sentencecase,
snakecase,
spacecase,
spinalcase,
titlecase,
trimcase,
uppercase
} = require('stringcase')// ------------------------
// Convert to camelcase
// ------------------------
camelcase('foo_bar') // => "fooBar"
camelcase('FOO_BAR') // => "fooBar"
camelcase('fooBar') // => "fooBar"
camelcase('FooBar') // => "fooBar"// ------------------------
// Convert to capitalcase
// ------------------------
capitalcase('foo_bar') // => "Foo_bar"
capitalcase('FOO_BAR') // => "FOO_BAR"
capitalcase('fooBar') // => "FooBar"
capitalcase('FooBar') // => "FooBar"// ------------------------
// Convert to constcase
// ------------------------
constcase('foo_bar') // => "FOO_BAR"
constcase('FOO_BAR') // => "FOO_BAR"
constcase('fooBar') // => "FOO_BAR"
constcase('FooBar') // => "FOO_BAR"// ------------------------
// Convert to cramcase
// ------------------------
cramcase('foo_bar') // => "foobar"
cramcase('FOO_BAR') // => "foobar"
cramcase('fooBar') // => "foobar"
cramcase('FooBar') // => "foobar"// ------------------------
// Convert to decapitalcase
// ------------------------
decapitalcase('foo_bar') // => "foo_bar"
decapitalcase('FOO_BAR') // => "fOO_BAR"
decapitalcase('fooBar') // => "fooBar"
decapitalcase('FooBar') // => "fooBar"// ------------------------
// Convert to dotcase
// ------------------------
dotcase('foo_bar') // => "foo.bar"
dotcase('FOO_BAR') // => "foo.bar"
dotcase('fooBar') // => "foo.bar"
dotcase('FooBar') // => "foo.bar"// ------------------------
// Convert to enumcase
// ------------------------
enumcase('foo_bar') // => "foo:bar"
enumcase('FOO_BAR') // => "foo:bar"
enumcase('fooBar') // => "foo:bar"
enumcase('FooBar') // => "foo:bar"// ------------------------
// Convert to lowercase
// ------------------------
lowercase('foo_bar') // => "foo_bar"
lowercase('FOO_BAR') // => "foo_bar"
lowercase('fooBar') // => "foobar"
lowercase('FooBar') // => "foobar"// ------------------------
// Convert to pascalcase
// ------------------------
pascalcase('foo_bar') // => "FooBar"
pascalcase('FOO_BAR') // => "FooBar"
pascalcase('fooBar') // => "FooBar"
pascalcase('FooBar') // => "FooBar"// ------------------------
// Convert to pathcase
// ------------------------
pathcase('foo_bar') // => "foo/bar"
pathcase('FOO_BAR') // => "foo/bar"
pathcase('fooBar') // => "foo/bar"
pathcase('FooBar') // => "foo/bar"// ------------------------
// Convert to sentencecase
// ------------------------
sentencecase('foo_bar') // => "Foo bar"
sentencecase('FOO_BAR') // => "Foo bar"
sentencecase('fooBar') // => "Foo bar"
sentencecase('FooBar') // => "Foo bar"// ------------------------
// Convert to snakecase
// ------------------------
snakecase('foo_bar') // => "foo_bar"
snakecase('FOO_BAR') // => "foo_bar"
snakecase('fooBar') // => "foo_bar"
snakecase('FooBar') // => "foo_bar"// ------------------------
// Convert to spacecase
// ------------------------
spacecase('foo_bar') // => "foo bar"
spacecase('FOO_BAR') // => "foo bar"
spacecase('fooBar') // => "foo bar"
spacecase('FooBar') // => "foo bar"// ------------------------
// Convert to spinalcase
// ------------------------
spinalcase('foo_bar') // => "foo-bar"
spinalcase('FOO_BAR') // => "foo-bar"
spinalcase('fooBar') // => "foo-bar"
spinalcase('FooBar') // => "foo-bar"// ------------------------
// Convert to titlecase
// ------------------------
titlecase('foo_bar') // => "Foo Bar"
titlecase('FOO_BAR') // => "Foo Bar"
titlecase('fooBar') // => "Foo Bar"
titlecase('FooBar') // => "Foo Bar"// ------------------------
// Convert to trimcase
// ------------------------
trimcase('foo_bar') // => "foo_bar"
trimcase('FOO_BAR') // => "FOO_BAR"
trimcase('fooBar') // => "fooBar"
trimcase('FooBar') // => "FooBar"// ------------------------
// Convert to uppercase
// ------------------------
uppercase('foo_bar') // => "FOO_BAR"
uppercase('FOO_BAR') // => "FOO_BAR"
uppercase('fooBar') // => "FOOBAR"
uppercase('FooBar') // => "FOOBAR"```
License
-------
This software is released under the [MIT License](https://github.com/okunishinishi/node-stringcase/blob/master/LICENSE).