gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
32 lines (31 loc) • 902 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const shouldDownloadFile = async (args) => {
const fieldDotPath = args.path.join(".");
switch (typeof args.pluginOptions.shouldDownloadFiles) {
case "boolean": {
return args.pluginOptions.shouldDownloadFiles;
}
case "function": {
return await args.pluginOptions.shouldDownloadFiles(args.field);
}
case "object": {
const predicate = args.pluginOptions.shouldDownloadFiles[fieldDotPath];
if (predicate) {
switch (typeof predicate) {
case "boolean": {
return predicate;
}
case "function": {
return await predicate(args.field);
}
}
}
}
default: {
return false;
}
}
};
exports.shouldDownloadFile = shouldDownloadFile;
//# sourceMappingURL=shouldDownloadFile.cjs.map
;