UNPKG

gatsby-source-prismic

Version:

Gatsby source plugin for building websites using Prismic as a data source

32 lines (31 loc) 798 B
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; } } }; export { shouldDownloadFile }; //# sourceMappingURL=shouldDownloadFile.js.map