@augment-vir/common 31.51.1 → 31.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
- import { type CasingOptions } from './casing.js';
2
1
  /**
3
2
  * Capitalize the first letter of the input _only if_ the given options specifies doing so.
4
3
  *
4
+ * @deprecated Prefer `setFirstLetterCasing`.
5
5
  * @category String
6
6
  * @category Package : @augment-vir/common
7
7
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
8
8
  */
9
- export declare function maybeCapitalize(input: string, casingOptions: Pick<CasingOptions, 'capitalizeFirstLetter'>): string;
9
+ export declare function maybeCapitalize(input: string, casingOptions: {
10
+ capitalizeFirstLetter: boolean;
11
+ }): string;
10
12
  /**
11
13
  * Capitalize the first letter of the input.
12
14
  *
@@ -1,6 +1,8 @@
1
+ /* node:coverage disable */
1
2
  /**
2
3
  * Capitalize the first letter of the input _only if_ the given options specifies doing so.
3
4
  *
5
+ * @deprecated Prefer `setFirstLetterCasing`.
4
6
  * @category String
5
7
  * @category Package : @augment-vir/common
6
8
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
@@ -1,4 +1,15 @@
1
1
  import { type FirstLetterLowercase, type FirstLetterUppercase, type PartialWithUndefined } from '@augment-vir/core';
2
+ /**
3
+ * The different string cases.
4
+ *
5
+ * @category String
6
+ * @category Package : @augment-vir/common
7
+ * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
8
+ */
9
+ export declare enum StringCase {
10
+ Upper = "upper",
11
+ Lower = "lower"
12
+ }
2
13
  /**
3
14
  * Options for casing functions in `@augment-vir/common`.
4
15
  *
@@ -10,9 +21,9 @@ export type CasingOptions = {
10
21
  /**
11
22
  * Capitalize the first letter of the string.
12
23
  *
13
- * @default false
24
+ * @default StringCase.Lower
14
25
  */
15
- capitalizeFirstLetter: boolean;
26
+ firstLetterCase: StringCase;
16
27
  };
17
28
  /**
18
29
  * Default options for {@link CasingOptions}.
@@ -22,17 +33,6 @@ export type CasingOptions = {
22
33
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
23
34
  */
24
35
  export declare const defaultCasingOptions: Required<CasingOptions>;
25
- /**
26
- * The different string cases.
27
- *
28
- * @category String
29
- * @category Package : @augment-vir/common
30
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
31
- */
32
- export declare enum StringCase {
33
- Upper = "upper",
34
- Lower = "lower"
35
- }
36
36
  /**
37
37
  * Convert the first letter of a string to either lower or uppercase.
38
38
  *
@@ -1,13 +1,3 @@
1
- /**
2
- * Default options for {@link CasingOptions}.
3
- *
4
- * @category String
5
- * @category Package : @augment-vir/common
6
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
7
- */
8
- export const defaultCasingOptions = {
9
- capitalizeFirstLetter: false,
10
- };
11
1
  /**
12
2
  * The different string cases.
13
3
  *
@@ -20,6 +10,16 @@ export var StringCase;
20
10
  StringCase["Upper"] = "upper";
21
11
  StringCase["Lower"] = "lower";
22
12
  })(StringCase || (StringCase = {}));
13
+ /**
14
+ * Default options for {@link CasingOptions}.
15
+ *
16
+ * @category String
17
+ * @category Package : @augment-vir/common
18
+ * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
19
+ */
20
+ export const defaultCasingOptions = {
21
+ firstLetterCase: StringCase.Lower,
22
+ };
23
23
  /**
24
24
  * Set the first letter of the input to uppercase or lowercase.
25
25
  *
@@ -1,3 +1,4 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/core';
1
2
  import { type CasingOptions } from './casing.js';
2
3
  /**
3
4
  * Converts a kebab-case string to CamelCase.
@@ -6,7 +7,7 @@ import { type CasingOptions } from './casing.js';
6
7
  * @category Package : @augment-vir/common
7
8
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
8
9
  */
9
- export declare function kebabCaseToCamelCase(rawKebabCase: string, casingOptions?: Partial<CasingOptions> | undefined): string;
10
+ export declare function kebabCaseToCamelCase(rawKebabCase: string, casingOptions?: PartialWithUndefined<CasingOptions> | undefined): string;
10
11
  /**
11
12
  * Converts a CamelCase string to kebab-case.
12
13
  *
@@ -1,6 +1,5 @@
1
1
  import { mergeDefinedProperties } from '../../object/merge-defined-properties.js';
2
- import { maybeCapitalize } from './capitalization.js';
3
- import { defaultCasingOptions, isCase, StringCase } from './casing.js';
2
+ import { defaultCasingOptions, isCase, setFirstLetterCasing, StringCase, } from './casing.js';
4
3
  /**
5
4
  * Converts a kebab-case string to CamelCase.
6
5
  *
@@ -25,7 +24,8 @@ export function kebabCaseToCamelCase(rawKebabCase, casingOptions = {}) {
25
24
  return '';
26
25
  }
27
26
  });
28
- return maybeCapitalize(camelCase, mergeDefinedProperties(defaultCasingOptions, casingOptions));
27
+ const options = mergeDefinedProperties(defaultCasingOptions, casingOptions);
28
+ return setFirstLetterCasing(camelCase, options.firstLetterCase);
29
29
  }
30
30
  /**
31
31
  * Converts a CamelCase string to kebab-case.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "31.51.1",
3
+ "version": "31.52.0",
4
4
  "description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
5
5
  "keywords": [
6
6
  "augment",
@@ -40,8 +40,8 @@
40
40
  "test:web": "virmator --no-deps test web"
41
41
  },
42
42
  "dependencies": {
43
- "@augment-vir/assert": "^31.51.1",
44
- "@augment-vir/core": "^31.51.1",
43
+ "@augment-vir/assert": "^31.52.0",
44
+ "@augment-vir/core": "^31.52.0",
45
45
  "@date-vir/duration": "^8.0.0",
46
46
  "ansi-styles": "^6.2.3",
47
47
  "deepcopy-esm": "^2.1.1",