| 1 | declare namespace camelcase {
|
|---|
| 2 | interface Options {
|
|---|
| 3 | /**
|
|---|
| 4 | Uppercase the first character: `foo-bar` → `FooBar`.
|
|---|
| 5 |
|
|---|
| 6 | @default false
|
|---|
| 7 | */
|
|---|
| 8 | readonly pascalCase?: boolean;
|
|---|
| 9 |
|
|---|
| 10 | /**
|
|---|
| 11 | Preserve the consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
|---|
| 12 |
|
|---|
| 13 | @default false
|
|---|
| 14 | */
|
|---|
| 15 | readonly preserveConsecutiveUppercase?: boolean;
|
|---|
| 16 |
|
|---|
| 17 | /**
|
|---|
| 18 | The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
|---|
| 19 |
|
|---|
| 20 | Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm.
|
|---|
| 21 |
|
|---|
| 22 | Default: The host environment’s current locale.
|
|---|
| 23 |
|
|---|
| 24 | @example
|
|---|
| 25 | ```
|
|---|
| 26 | import camelCase = require('camelcase');
|
|---|
| 27 |
|
|---|
| 28 | camelCase('lorem-ipsum', {locale: 'en-US'});
|
|---|
| 29 | //=> 'loremIpsum'
|
|---|
| 30 | camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
|---|
| 31 | //=> 'loremİpsum'
|
|---|
| 32 | camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
|---|
| 33 | //=> 'loremIpsum'
|
|---|
| 34 | camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
|---|
| 35 | //=> 'loremİpsum'
|
|---|
| 36 | ```
|
|---|
| 37 | */
|
|---|
| 38 | readonly locale?: false | string | readonly string[];
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | /**
|
|---|
| 43 | Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
|---|
| 44 |
|
|---|
| 45 | Correctly handles Unicode strings.
|
|---|
| 46 |
|
|---|
| 47 | @param input - String to convert to camel case.
|
|---|
| 48 |
|
|---|
| 49 | @example
|
|---|
| 50 | ```
|
|---|
| 51 | import camelCase = require('camelcase');
|
|---|
| 52 |
|
|---|
| 53 | camelCase('foo-bar');
|
|---|
| 54 | //=> 'fooBar'
|
|---|
| 55 |
|
|---|
| 56 | camelCase('foo_bar');
|
|---|
| 57 | //=> 'fooBar'
|
|---|
| 58 |
|
|---|
| 59 | camelCase('Foo-Bar');
|
|---|
| 60 | //=> 'fooBar'
|
|---|
| 61 |
|
|---|
| 62 | camelCase('розовый_пушистый_единорог');
|
|---|
| 63 | //=> 'розовыйПушистыйЕдинорог'
|
|---|
| 64 |
|
|---|
| 65 | camelCase('Foo-Bar', {pascalCase: true});
|
|---|
| 66 | //=> 'FooBar'
|
|---|
| 67 |
|
|---|
| 68 | camelCase('--foo.bar', {pascalCase: false});
|
|---|
| 69 | //=> 'fooBar'
|
|---|
| 70 |
|
|---|
| 71 | camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
|
|---|
| 72 | //=> 'fooBAR'
|
|---|
| 73 |
|
|---|
| 74 | camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true}));
|
|---|
| 75 | //=> 'FooBAR'
|
|---|
| 76 |
|
|---|
| 77 | camelCase('foo bar');
|
|---|
| 78 | //=> 'fooBar'
|
|---|
| 79 |
|
|---|
| 80 | console.log(process.argv[3]);
|
|---|
| 81 | //=> '--foo-bar'
|
|---|
| 82 | camelCase(process.argv[3]);
|
|---|
| 83 | //=> 'fooBar'
|
|---|
| 84 |
|
|---|
| 85 | camelCase(['foo', 'bar']);
|
|---|
| 86 | //=> 'fooBar'
|
|---|
| 87 |
|
|---|
| 88 | camelCase(['__foo__', '--bar'], {pascalCase: true});
|
|---|
| 89 | //=> 'FooBar'
|
|---|
| 90 |
|
|---|
| 91 | camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
|
|---|
| 92 | //=> 'FooBAR'
|
|---|
| 93 |
|
|---|
| 94 | camelCase('lorem-ipsum', {locale: 'en-US'});
|
|---|
| 95 | //=> 'loremIpsum'
|
|---|
| 96 | ```
|
|---|
| 97 | */
|
|---|
| 98 | declare function camelcase(
|
|---|
| 99 | input: string | readonly string[],
|
|---|
| 100 | options?: camelcase.Options
|
|---|
| 101 | ): string;
|
|---|
| 102 |
|
|---|
| 103 | export = camelcase;
|
|---|