Skip to content

Commit

Permalink
fix: update Utils.LowerDashed function (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
wnvko authored Nov 14, 2023
1 parent 2eacc6e commit 2254ecc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/core/util/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ export class Util {
* lower-dashed string
*/
public static lowerDashed(text: string) {
return text.replace(/\s+/g, "-").toLowerCase();
const regex = new RegExp("[\\s]+|([\\p{Ll}](?=[\\p{Lu}\\p{Nd}]))", "gu");
const result = text.trim()
.replace(regex, "$1-")
.toLowerCase();
return result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/new-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("New command", () => {
expect(fs.existsSync("./jQuery Proj")).toBeTruthy();
expect(filesDiff("../templates/jquery/js/projects/empty/files", "./jQuery Proj")).toEqual([]);
const packageText = fs.readFileSync("./jQuery Proj/package.json", "utf-8");
expect(JSON.parse(packageText).name).toEqual("jquery-proj");
expect(JSON.parse(packageText).name).toEqual("j-query-proj");
expect(fs.existsSync("./jQuery Proj/.gitignore")).toBeTruthy();
testFolder = "./jQuery Proj";

Expand Down

0 comments on commit 2254ecc

Please sign in to comment.