decord/source/9737_usePropsErrorBoundary.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 9737
// Function ID: 75669
2026-07-20 16:05:17 +00:00
// Name: usePropsErrorBoundary
2026-07-23 10:11:24 +00:00
// Dependencies: [31]
2026-07-20 16:05:17 +00:00
// Exports: usePropsErrorBoundary
2026-07-24 07:16:23 +00:00
// Module 9737 (usePropsErrorBoundary)
2026-07-23 10:11:24 +00:00
import result from "result";
2026-07-20 16:05:17 +00:00
export const usePropsErrorBoundary = function usePropsErrorBoundary(arg0) {
const React = arg0;
const items = [arg0];
2026-07-23 10:11:24 +00:00
const effect = React.useEffect(() => {
2026-07-20 16:05:17 +00:00
let dataLength;
let defaultIndex;
2026-07-23 10:11:24 +00:00
({ defaultIndex, dataLength } = styles);
2026-07-20 16:05:17 +00:00
if ("number" === typeof defaultIndex) {
if (dataLength > 0) {
const _Error3 = Error;
const error = new Error("DefaultIndex must be in the range of data length.");
throw error;
}
}
2026-07-23 10:11:24 +00:00
if (!styles.mode) {
if (!styles.vertical) {
if (!styles.width) {
2026-07-20 16:05:17 +00:00
const _Error = Error;
const error1 = new Error("`width` must be specified for horizontal carousels.");
throw error1;
}
}
2026-07-23 10:11:24 +00:00
if (styles.vertical) {
if (!styles.height) {
2026-07-20 16:05:17 +00:00
const _Error2 = Error;
const error2 = new Error("`height` must be specified for vertical carousels.");
throw error2;
}
}
}
}, items);
};