Skip to content

Commit 2dcce47

Browse files
committed
refactor(utils): remove unused apostrophize function
1 parent b2db9ed commit 2dcce47

3 files changed

Lines changed: 0 additions & 29 deletions

File tree

packages/utils/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export { isSemver, normalizeSemver, sortSemvers } from './lib/semver';
8686
export * from './lib/text-formats';
8787
export {
8888
CliArgsObject,
89-
apostrophize,
9089
capitalize,
9190
countOccurrences,
9291
distinct,

packages/utils/src/lib/transform.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,6 @@ export function capitalize<T extends string>(text: T): Capitalize<T> {
139139
)}` as Capitalize<T>;
140140
}
141141

142-
export function apostrophize(text: string, upperCase?: boolean) {
143-
const lastCharMatch = text.match(/(\w)\W*$/);
144-
const lastChar = lastCharMatch?.[1] ?? '';
145-
146-
return `${text}'${
147-
lastChar.toLocaleLowerCase() === 's' ? '' : upperCase ? 'S' : 's'
148-
}`;
149-
}
150-
151142
export function toNumberPrecision(
152143
value: number,
153144
decimalPlaces: number,

packages/utils/src/lib/transform.unit.test.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, it } from 'vitest';
22
import {
3-
apostrophize,
43
capitalize,
54
countOccurrences,
65
deepClone,
@@ -262,24 +261,6 @@ describe('capitalize', () => {
262261
});
263262
});
264263

265-
describe('apostrophize', () => {
266-
it("should add apostrophe and 's'", () => {
267-
expect(apostrophize('cli')).toBe("cli's");
268-
});
269-
270-
it("should add apostrophe without 's' for words ending with 's'", () => {
271-
expect(apostrophize('yargs')).toBe("yargs'");
272-
});
273-
274-
it("should add capital 'S' when upper case is defined", () => {
275-
expect(apostrophize('WORLD', true)).toBe("WORLD'S");
276-
});
277-
278-
it('should leave formatting if provided', () => {
279-
expect(apostrophize('`git`')).toBe("`git`'s");
280-
});
281-
});
282-
283264
describe('toNumberPrecision', () => {
284265
it.each([
285266
[12.1, 0, 12],

0 commit comments

Comments
 (0)