1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.validateQuality = void 0;
|
4 | const validateQuality = (q) => {
|
5 | if (typeof q !== 'undefined' && typeof q !== 'number') {
|
6 | throw new Error(`Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`);
|
7 | }
|
8 | if (typeof q === 'undefined') {
|
9 | return;
|
10 | }
|
11 | if (!Number.isFinite(q)) {
|
12 | throw new RangeError(`Quality must be a finite number, but is ${q}`);
|
13 | }
|
14 | if (Number.isNaN(q)) {
|
15 | throw new RangeError(`Quality is NaN, but must be a real number`);
|
16 | }
|
17 | if (q > 100 || q < 0) {
|
18 | throw new RangeError('Quality option must be between 0 and 100.');
|
19 | }
|
20 | };
|
21 | exports.validateQuality = validateQuality;
|