doc + Mask

This commit is contained in:
JulienH2000
2023-09-21 22:02:58 +02:00

View File

@ -1,5 +1,6 @@
import { type UserAPI } from "./API"; import { type UserAPI } from "./API";
import { SCALES } from "./Scales"; import { SCALES } from "./Scales";
import { safeScale } from "zifferjs";
export { }; export { };
declare global { declare global {
@ -21,6 +22,8 @@ declare global {
pick(): T; pick(): T;
loop(index: number): T; loop(index: number): T;
shuffle(): this; shuffle(): this;
scale(name: string, base_note?: number): this;
arp(scaleName: string): this;
rotate(steps: number): this; rotate(steps: number): this;
unique(): this; unique(): this;
in(value: T): boolean; in(value: T): boolean;
@ -355,6 +358,7 @@ Array.prototype.scale = function <T>(this: T[], scaleName: string = "major", mas
let mask = maskLength; let mask = maskLength;
//input protect from unknow scale //input protect from unknow scale
if (!scale) { if (!scale) {
throw new Error(`Unknown scale ${scaleName}`); throw new Error(`Unknown scale ${scaleName}`);
} }