UNPKG

yandex-cloud-functions-router

Version:
25 lines (24 loc) 911 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveCorsOptions = void 0; const resolveCorsOptions = (options) => { var _a, _b, _c, _d; if (options) { if (options.enable === true) { return { enable: true, allowedOrigins: (_a = options.allowedOrigins) !== null && _a !== void 0 ? _a : ['*'], allowedMethods: (_b = options.allowedMethods) !== null && _b !== void 0 ? _b : ['GET', 'HEAD', 'POST'], allowedHeaders: (_c = options.allowedHeaders) !== null && _c !== void 0 ? _c : [], allowCredentials: (_d = options.allowCredentials) !== null && _d !== void 0 ? _d : true }; } else { return { enable: false }; } } else { return { enable: false }; } }; exports.resolveCorsOptions = resolveCorsOptions;