From b071922697420054003328b68a41a7478f5cf904 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 7 Apr 2020 11:06:40 +0800 Subject: [PATCH] Meta tweaks --- index.d.ts | 77 ++++++++++++++++++++++++---------------------------- license | 2 +- package.json | 7 +++-- readme.md | 13 +++------ 4 files changed, 44 insertions(+), 55 deletions(-) diff --git a/index.d.ts b/index.d.ts index 0d4aeed..51d2ba2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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, 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, - // 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; diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (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: diff --git a/package.json b/package.json index 028c2e2..c2f1a69 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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" } } diff --git a/readme.md b/readme.md index 38eda30..7252905 100644 --- a/readme.md +++ b/readme.md @@ -4,14 +4,12 @@ Correctly handles Unicode strings. - ## Install ``` $ npm install camelcase ``` - ## Usage ```js @@ -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`
+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