Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 7, 2020
1 parent 878bc44 commit b071922
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 55 deletions.
77 changes: 35 additions & 42 deletions index.d.ts
Expand Up @@ -9,60 +9,53 @@ declare namespace camelcase {
}
}

declare const camelcase: {
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
Correctly handles Unicode strings.
Correctly handles Unicode strings.
@param input - String to convert to camel case.
@param input - String to convert to camel case.
@example
```
import camelCase = require('camelcase');
@example
```
import camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('розовый_пушистый_единороги');
//=> 'розовыйПушистыйЕдинороги'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('розовый_пушистый_единороги');
//=> 'розовыйПушистыйЕдинороги'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('foo bar');
//=> 'fooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
*/
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
camelCase(['foo', 'bar']);
//=> 'fooBar'
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function camelcase(
// input: string | ReadonlyArray<string>,
// options?: camelcase.Options
// ): string;
// export = camelcase;
default: typeof camelcase;
};
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
*/
declare function camelcase(
input: string | readonly string[],
options?: camelcase.Options
): string;

export = camelcase;
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -4,10 +4,11 @@
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
"license": "MIT",
"repository": "sindresorhus/camelcase",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
Expand Down Expand Up @@ -37,7 +38,7 @@
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
"tsd": "^0.11.0",
"xo": "^0.28.3"
}
}
13 changes: 4 additions & 9 deletions readme.md
Expand Up @@ -4,14 +4,12 @@
Correctly handles Unicode strings.


## Install

```
$ npm install camelcase
```


## Usage

```js
Expand Down Expand Up @@ -50,36 +48,33 @@ camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```


## API

### camelCase(input, [options])
### camelCase(input, options?)

#### input

Type: `string` `string[]`
Type: `string | string[]`

String to convert to camel case.

#### options

Type: `Object`
Type: `object`

##### pascalCase

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Uppercase the first character: `foo-bar``FooBar`


## camelcase for enterprise

Available as part of the Tidelift Subscription.

The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)


## Related

- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
Expand Down

0 comments on commit b071922

Please sign in to comment.