mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Multiple miscellaneous fixes
This commit is contained in:
@@ -393,6 +393,10 @@ export const roundToPrecision = (value: number, digits: number) => {
|
||||
return Math.round(value * factor) / factor;
|
||||
};
|
||||
|
||||
export const roundToMultiple = (value: number, multiple: number) => {
|
||||
return Math.round(value / multiple) * multiple;
|
||||
};
|
||||
|
||||
export const ilog = (x: number) => {
|
||||
let ret = 0;
|
||||
while (x) {
|
||||
@@ -401,3 +405,8 @@ export const ilog = (x: number) => {
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
const ISO_639_2_REGEX = /^[a-z]{3}$/;
|
||||
export const isIso639Dash2LanguageCode = (x: string) => {
|
||||
return ISO_639_2_REGEX.test(x);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user