1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.validateFrame = void 0;
|
4 | const validateFrame = (frame, durationInFrames) => {
|
5 | if (typeof frame === 'undefined') {
|
6 | throw new TypeError(`Argument missing for parameter "frame"`);
|
7 | }
|
8 | if (typeof frame !== 'number') {
|
9 | throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
10 | }
|
11 | if (frame < 0) {
|
12 | throw new RangeError(`Frame ${frame} cannot be negative`);
|
13 | }
|
14 | if (!Number.isFinite(frame)) {
|
15 | throw new RangeError(`Frame ${frame} is not finite`);
|
16 | }
|
17 | if (frame % 1 !== 0) {
|
18 | throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
19 | }
|
20 | if (frame > durationInFrames - 1) {
|
21 | throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
22 | }
|
23 | };
|
24 | exports.validateFrame = validateFrame;
|