UNPKG

@tsed/cli

Version:
17 lines (16 loc) 595 B
import { camelCase } from "change-case"; import { mapUniqFeatures } from "./mapUniqFeatures.js"; export function mapToContext(options) { options = mapUniqFeatures(options); options.features.forEach((feature) => { const [base, type] = feature.split(":"); if (feature?.endsWith(":premium")) { feature = feature.replace(":premium", ""); options.premium = true; } options[camelCase(base)] = true; type && (options[camelCase(type)] = true); feature && (options[camelCase(feature)] = true); }); return options; }