Skip to content

Commit

Permalink
fix: add case insensitivity support to scale tokenize (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-LC authored Apr 11, 2024
1 parent b3a3115 commit 37b59db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/scale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function tokenize(name: ScaleName): ScaleNameTokens {
return n.empty ? ["", name] : [n.name, ""];
}

const type = name.substring(tonic.name.length + 1);
const type = name.substring(tonic.name.length + 1).toLowerCase();
return [tonic.name, type.length ? type : ""];
}

Expand Down
1 change: 1 addition & 0 deletions packages/scale/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe("@tonaljs/scale", () => {
normalized: "100101001010",
});
expect(Scale.get("C4 major")).toEqual(Scale.get(["C4", "major"]));
expect(Scale.get("C4 Major")).toEqual(Scale.get("C4 major"));
});

test("tokenize", () => {
Expand Down

0 comments on commit 37b59db

Please sign in to comment.