toMinimizedCase()
Minimize specific or general letters in a string.
Note:
range & at properties are 0-first.
all optional arguments are ordered by importance.
Arguments
Required:
s: <T extends string> // Could be a string, or a custom object that extends it
Optional:
at: number; // Minimize only that letter
range: [number, number]; // Minimize letters between this Range, both inclusive
forChars: "all" | "first" | "last" // Defaults to all
Returns
(string): Outputs the input string with desired minimization.
Example
const stringUpperCased = "HELLO WORLD";
const strBasic = toMinimizedCase(stringLowerCased); // Default will minimize entire string
// => "hello world";
const strMinimizedAt = toMinimizedCase(stringLowerCased, { at: 8 }); // 0-first based param
// => "HELLO WOrLD";
const strMinimizedRange = toMinimizedCase(stringLowerCased, { range: [0, 5] }); // 0-first based param
// => "hello WORLD";
const strMinimizedForChars = toMinimizedCase(stringLowerCased, { forChars: "first" });
// => "hELLO WORLD";