camelcase
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -1,18 +0,63 @@ | ||
export interface Options { | ||
/** | ||
* Uppercase the first character: `foo-bar` → `FooBar`. | ||
* | ||
* @default false | ||
*/ | ||
readonly pascalCase?: boolean; | ||
declare namespace camelcase { | ||
interface Options { | ||
/** | ||
Uppercase the first character: `foo-bar` → `FooBar`. | ||
@default false | ||
*/ | ||
readonly pascalCase?: boolean; | ||
} | ||
} | ||
/** | ||
* Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. | ||
* | ||
* @param input - String to convert to camel case. | ||
*/ | ||
export default function camelcase( | ||
input: string | ReadonlyArray<string>, | ||
options?: Options | ||
): string; | ||
declare const camelcase: { | ||
/** | ||
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. | ||
@param input - String to convert to camel case. | ||
@example | ||
``` | ||
import camelCase = require('camelcase'); | ||
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' | ||
``` | ||
*/ | ||
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string; | ||
// 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; | ||
}; | ||
export = camelcase; |
@@ -23,5 +23,5 @@ 'use strict'; | ||
} else { | ||
isLastCharLower = character.toLowerCase() === character; | ||
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; | ||
isLastLastCharUpper = isLastCharUpper; | ||
isLastCharUpper = character.toUpperCase() === character; | ||
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; | ||
} | ||
@@ -79,2 +79,3 @@ } | ||
module.exports = camelCase; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = camelCase; |
{ | ||
"name": "camelcase", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -40,6 +40,6 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.2.1", | ||
"tsd-check": "^0.3.0", | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
7466
111