Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denolib/camelcase
Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar
https://github.com/denolib/camelcase
Last synced: about 1 month ago
JSON representation
Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar
- Host: GitHub
- URL: https://github.com/denolib/camelcase
- Owner: denolib
- License: mit
- Created: 2018-12-23T11:27:18.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-17T12:41:42.000Z (almost 6 years ago)
- Last Synced: 2024-08-03T10:20:04.553Z (4 months ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 8
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - camelcase - 将破折号/点号/下划线/空格分隔的字符串转换为camelCase:foo-bar→fooBar。 (Uncategorized / Uncategorized)
- awesome-deno-cn - @denolib/camelcase - bar→fooBar。 (基础设施 / Deno 源)
- awesome-deno - camelcase - Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar (Libraries)
- awesome-deno - camelcase - Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar. ![GitHub stars](https://img.shields.io/github/stars/denolib/camelcase?style=plastic&logoWidth=1) (Modules / Online Playgrounds)
- awesome-deno - camelcase - Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar. (Modules / String utils)
README
Ported from https://github.com/sindresorhus/camelcase
# camelcase
![DenoLib](https://denolib.com/badge?scope=denolib&repo=camelcase)
[![Build Status](https://img.shields.io/travis/denolib/camelcase.svg?style=flat-square)](https://travis-ci.org/denolib/camelcase)> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
## Usage
```ts
import { camelCase } from "https://denolib.com/denolib/camelcase/mod.ts";camelCase("foo-bar");
//=> "fooBar"camelCase("foo_bar");
//=> "fooBar"camelCase("Foo-Bar");
//=> "fooBar"camelCase("Foo-Bar", { pascalCase: true });
//=> "FooBar"camelCase("--foo.bar", { pascalCase: false });
//=> "fooBar"camelCase("foo bar");
//=> "fooBar"console.log(process.argv[3]);
//=> "--foo-bar"
camelCase(process.argv[3]);
//=> "fooBar"camelCase(["foo", "bar"]);
//=> "fooBar"camelCase(["__foo__", "--bar"], { pascalCase: true });
//=> "FooBar"
```## API
### camelCase(input, [options])
#### input
Type: `string` `string[]`
String to convert to camel case.
#### options
Type: `Object`
##### pascalCase
Type: `boolean`
Default: `false`Uppercase the first character: `foo-bar` → `FooBar`