Skip to content

Commit e5f1b15

Browse files
refact: Migrate $helper.string to TypeScript (#7979)
* refact: Migrate `$helper.string` to TypeScript * refact: Type input as `unknown`
1 parent a5a4877 commit e5f1b15

24 files changed

+169
-116
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

33
return [
4-
'source' => 'panel/src/helpers/string.js'
4+
'source' => 'panel/src/helpers/string.ts'
55
];

panel/src/helpers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import object from "./object.js";
1414
import page from "./page.js";
1515
import ratio from "./ratio.js";
1616
import sort from "./sort.js";
17-
import string from "./string.js";
17+
import string from "./string";
1818
import throttle from "./throttle";
1919
import upload from "./upload.js";
2020
import url from "./url.js";

panel/src/helpers/string.camelToKebab.test.js renamed to panel/src/helpers/string.camelToKebab.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe.concurrent("$helper.string.camelToKebab", () => {
55
it("should convert camelCase", () => {

panel/src/helpers/string.escapeHTML.test.js renamed to panel/src/helpers/string.escapeHTML.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe.concurrent("$helper.string.escapeHTML", () => {
55
it("should escape HTML", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe.concurrent("$helper.string.hasEmoji", () => {
55
it("should identify emojis", () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe.concurrent("$helper.string.isEmpty", () => {
55
it("should work with null", () => {
@@ -8,7 +8,7 @@ describe.concurrent("$helper.string.isEmpty", () => {
88
});
99

1010
it("should work with undefined", () => {
11-
const result = string.isEmpty();
11+
const result = string.isEmpty(undefined);
1212
expect(result).toStrictEqual(true);
1313
});
1414

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe.concurrent("$helper.string.lcfirst", () => {
55
it("should convert first character to lowercase", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe("$helper.string.ltrim", () => {
55
it("should trim the character", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { pad } from "./string.js";
2+
import { pad } from "./string";
33

44
describe.concurrent("$helper.string.pad()", () => {
55
it("should add default padding", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import string from "./string.js";
2+
import string from "./string";
33

44
describe("$helper.string.random", () => {
55
it("should create a random string", () => {

0 commit comments

Comments
 (0)