UNPKG

@mdf.js/utils

Version:

MMS - API Core - Common utils tools

50 lines 1.66 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { Options } from './Options.i'; /** * Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: * - `foo-bar` → `fooBar`. * Correctly handles Unicode strings. * @param input - String to convert to camel case. * @example * ``` * import camelCase from 'camelcase'; * camelCase('foo-bar'); * //=> 'fooBar' * camelCase('foo_bar'); * //=> 'fooBar' * camelCase('Foo-Bar'); * //=> 'fooBar' * camelCase('розовый_пушистый_единорог'); * //=> 'розовыйПушистыйЕдинорог' * camelCase('Foo-Bar', {pascalCase: true}); * //=> 'FooBar' * camelCase('--foo.bar', {pascalCase: false}); * //=> 'fooBar' * camelCase('Foo-BAR', {preserveConsecutiveUppercase: true}); * //=> 'fooBAR' * camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true})); * //=> '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' * camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true}) * //=> 'FooBAR' * camelCase('lorem-ipsum', {locale: 'en-US'}); * //=> 'loremIpsum' * ``` * @returns */ export declare function camelCase(input: string | string[], options?: Options): string; //# sourceMappingURL=camelCase.d.ts.map