You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB

4 years ago
  1. declare namespace camelcase {
  2. interface Options {
  3. /**
  4. Uppercase the first character: `foo-bar` `FooBar`.
  5. @default false
  6. */
  7. readonly pascalCase?: boolean;
  8. }
  9. }
  10. declare const camelcase: {
  11. /**
  12. Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` `fooBar`.
  13. @param input - String to convert to camel case.
  14. @example
  15. ```
  16. import camelCase = require('camelcase');
  17. camelCase('foo-bar');
  18. //=> 'fooBar'
  19. camelCase('foo_bar');
  20. //=> 'fooBar'
  21. camelCase('Foo-Bar');
  22. //=> 'fooBar'
  23. camelCase('Foo-Bar', {pascalCase: true});
  24. //=> 'FooBar'
  25. camelCase('--foo.bar', {pascalCase: false});
  26. //=> 'fooBar'
  27. camelCase('foo bar');
  28. //=> 'fooBar'
  29. console.log(process.argv[3]);
  30. //=> '--foo-bar'
  31. camelCase(process.argv[3]);
  32. //=> 'fooBar'
  33. camelCase(['foo', 'bar']);
  34. //=> 'fooBar'
  35. camelCase(['__foo__', '--bar'], {pascalCase: true});
  36. //=> 'FooBar'
  37. ```
  38. */
  39. (input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
  40. // TODO: Remove this for the next major release, refactor the whole definition to:
  41. // declare function camelcase(
  42. // input: string | ReadonlyArray<string>,
  43. // options?: camelcase.Options
  44. // ): string;
  45. // export = camelcase;
  46. default: typeof camelcase;
  47. };
  48. export = camelcase;