index.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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;