mirror of
https://github.com/denoland/deno.git
synced 2024-12-29 02:29:06 -05:00
2 lines
52 KiB
JSON
2 lines
52 KiB
JSON
|
{"_id":"camelcase","_rev":"67-3c23ff2ea060a6f90508b3f2e8f42a6b","name":"camelcase","time":{"modified":"2022-06-13T05:30:29.295Z","created":"2013-10-30T20:39:45.449Z","0.0.0":"2013-10-30T20:39:50.719Z","1.0.0":"2014-10-12T11:06:54.223Z","1.0.1":"2014-10-12T12:07:56.522Z","1.0.2":"2014-11-25T07:46:37.286Z","1.1.0":"2015-05-15T23:13:02.556Z","1.2.0":"2015-07-30T15:11:19.077Z","1.2.1":"2015-08-01T10:38:13.833Z","2.0.0":"2015-11-15T12:49:16.601Z","2.0.1":"2015-11-17T14:12:18.285Z","2.1.0":"2016-01-24T18:40:18.240Z","2.1.1":"2016-03-12T17:30:36.527Z","3.0.0":"2016-05-04T17:33:27.903Z","4.0.0":"2016-11-08T15:54:49.686Z","4.1.0":"2017-03-30T09:16:02.724Z","5.0.0":"2018-03-28T11:08:34.664Z","5.1.0":"2019-03-04T05:21:30.689Z","5.2.0":"2019-03-05T05:33:09.693Z","5.3.0":"2019-04-01T08:20:50.223Z","5.3.1":"2019-04-03T13:34:32.701Z","6.0.0":"2020-04-07T03:23:00.391Z","6.1.0":"2020-10-10T17:04:08.402Z","6.2.0":"2020-10-28T22:19:50.567Z","6.2.1":"2021-11-15T02:48:10.463Z","6.3.0":"2022-01-01T20:29:34.388Z","7.0.0":"2022-06-06T05:08:17.147Z"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"dist-tags":{"latest":"7.0.0"},"description":"Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`","readme":"# camelcase\n\n> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`\n\nCorrectly handles Unicode strings.\n\nIf you use this on untrusted user input, don't forget to limit the length to something reasonable.\n\n## Install\n\n```sh\nnpm install camelcase\n```\n\n## Usage\n\n```js\nimport camelCase from 'camelcase';\n\ncamelCase('foo-bar');\n//=> 'fooBar'\n\ncamelCase('foo_bar');\n//=> 'fooBar'\n\ncamelCase('Foo-Bar');\n//=> 'fooBar'\n\ncamelCase('розовый_пушистый_единорог');\n//=> 'розовыйПушистыйЕдинорог'\n\ncamelCase('Foo-Bar', {pascalCase: true});\n//=> 'FooBar'\n\ncamelCase('--foo.bar', {pascalCase: false});\n//=> 'fooBar'\n\ncamelCase('Foo-BAR', {preserveConsecutiveUppercase: true});\n//=> 'fooBAR'\n\ncamelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true}));\n//=> 'FooBAR'\n\ncamelCase('foo bar');\n//=> 'fooBar'\n\nconsole.log(process.argv[3]);\n//=> '--foo-bar'\ncamelCase(process.argv[3]);\n//=> 'fooBar'\n\ncamelCase(['foo', 'bar']);\n//=> 'fooBar'\n\ncamelCase(['__foo__', '--bar'], {pascalCase: true});\n//=> 'FooBar'\n\ncamelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})\n//=> 'FooBAR'\n\ncamelCase('lorem-ipsum', {locale: 'en-US'});\n//=> 'loremIpsum'\n```\n\n## API\n\n### camelCase(input, options?)\n\n#### input\n\nType: `string | string[]`\n\nString to convert to camel case.\n\n#### options\n\nType: `object`\n\n##### pascalCase\n\nType: `boolean`\\\nDefault: `false`\n\nUppercase the first character: `foo-bar` → `FooBar`\n\n##### preserveConsecutiveUppercase\n\nType: `boolean`\\\nDefault: `false`\n\nPreserve consecutive uppercase characters: `foo-BAR` → `FooBAR`.\n\n##### locale\n\nType: `false | string | string[]`\\\nDefault: The host environment’s current locale.\n\nThe 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.\n\n```js\nimport camelCase from 'camelcase';\n\ncamelCase('lorem-ipsum', {locale: 'en-US'});\n//=> 'loremIpsum'\n\ncamelCase('lorem-ipsum', {locale: 'tr-TR'});\n//=> 'loremİpsum'\n\ncamelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});\n//=> 'loremIpsum'\n\ncamelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});\n//=> 'loremİpsum'\n```\n\nSetting `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:\n\n```js\nimport camelCase from 'camelcase';\n\n// On a platform with 'tr-TR'\n\ncamelCase('lorem-ipsum');\n//=> 'loremİpsum'\n\ncamelCase('lorem-ipsum', {locale: false});\n//=> 'l
|