UNPKG

968 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const Errors_1 = require("./Errors");
4function serializeAndEvaluate(val) {
5 if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {
6 return val;
7 }
8 else if (typeof val === 'function') {
9 // TODO: Bacon: Should we support async methods?
10 return val();
11 }
12 else if (Array.isArray(val)) {
13 return val.map(serializeAndEvaluate);
14 }
15 else if (typeof val === 'object') {
16 const output = {};
17 for (const property in val) {
18 if (val.hasOwnProperty(property)) {
19 output[property] = serializeAndEvaluate(val[property]);
20 }
21 }
22 return output;
23 }
24 // symbol
25 throw new Errors_1.ConfigError(`Expo config doesn't support \`Symbols\`: ${val}`, 'INVALID_CONFIG');
26}
27exports.serializeAndEvaluate = serializeAndEvaluate;
28//# sourceMappingURL=Serialize.js.map
\No newline at end of file