Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Transformation, Util, Configuration } from "cloudinary-core";
import { formatObject, normalizeObject, pick, omit, merge } from "../utils";
export const configuration = Configuration.CONFIG_PARAMS.map(Util.camelCase);
export const transformation = Transformation.PARAM_NAMES.map(
Util.camelCase
).filter(name => configuration.indexOf(name) < 0);
export function normalizeConfiguration(cfg) {
return Util.withSnakeCaseKeys(
formatObject(normalizeObject(pick(cfg, configuration)), {
secure: v => (typeof v === "boolean" ? v : v === "true")
})
);
}
export function normalizeTransformation(cfg) {
return Util.withSnakeCaseKeys(normalizeObject(pick(cfg, transformation)));
}
import { Transformation, Util, Configuration } from "cloudinary-core";
import { formatObject, compact, pick, omit } from "../utils";
/** List of all configuration fields as they are needed in components attributes */
export const configuration = Configuration.CONFIG_PARAMS.map(Util.camelCase);
/** List of all transformation fields as they are needed in components attributes */
export const transformation = Transformation.methods;
/** Extract configuration options for provided object */
export function normalizeConfiguration(cfg) {
return Util.withSnakeCaseKeys(
formatObject(compact(pick(cfg, configuration)), {
secure: v => (typeof v === "boolean" ? v : v === "true")
})
);
}
/** Extract transformation options for provided object */
export function normalizeTransformation(cfg) {
return Util.withSnakeCaseKeys(compact(pick(cfg, transformation)));