Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
* This module serves as a proxy to the cloudinary core. In addition
* it adds some extra functionality based on the runtime configuration
* file cloudinaryrc.json.
*/
const _has = require("lodash/has");
const cloudinary = require("cloudinary-core");
// https://cloudinary.com/documentation/solution_overview#configuration_parameters
const runConfig = require(`${process.env.INIT_CWD}/cloudinaryrc.json`);
if (!_has(runConfig, "native.cloud_name")) {
throw new Error("You need to provide a **native** object with the mandatory **cloud_name** field");
}
const CALLEE_NAME = "__buildCloudinaryUrl";
const cl = new cloudinary.Cloudinary(runConfig.native);
const BASE_URL_PLACEHOLDER = new RegExp(`res.cloudinary.com/${runConfig.native.cloud_name}/image/upload`, "gi");
/**
* This method invokes the cloudinary core to build the asset URL.
* It also performs additional operations upon the URL based on
* the client runtime configs.
* @param {string} assetName - name of the asset.
* @param {Object} transforms - plain object that contains the cloudinary transformations.
* @returns {string} base image URL for the provided assetName.
*/
function getBaseImageUrl(assetName, transforms) {
const enrichedTransforms = runConfig.defaultTransforms
? { ...runConfig.defaultTransforms, ...transforms }
: transforms;
let url = cl.url(assetName, enrichedTransforms);
function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
import {Transformation, Util} from 'cloudinary-core';
const CLOUDINARY_REACT_PROPS = {includeOwnBody: true};
// Map Cloudinary props from array to object for efficient lookup
const CLOUDINARY_PROPS = Transformation.PARAM_NAMES.map(Util.camelCase).reduce(
(accumulator, cloudinaryPropName) => {
accumulator[cloudinaryPropName] = true;
return accumulator;
},
{}
);
const isDefined = (props, key) => {
return (props[key] !== undefined && props[key] !== null);
};
/**
* Extracts cloudinaryProps and nonCloudinaryProps from given props
*
* @param props
* @returns {{children: *, cloudinaryReactProps: {}, cloudinaryProps: {}, nonCloudinaryProps: {}}}
export function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
export function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
function install(Vue, options) {
configuration = new cloudinary.Configuration(options);
// if (cloudinary.CloudinaryJQuery && jQuery) {
// // cloudinary is attached to the global `jQuery` object
// jQuery.cloudinary.config(configuration.config());
// cloudinaryInstance = jQuery.cloudinary;
// } else {
cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
// }
cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
Vue.directive('cl-image', clImage);
}
calc_breakpoint(width, steps) {
var breakpoints, point;
breakpoints = (this.state && this.state.breakpoints) || defaultBreakpoints;
if (Util.isFunction(breakpoints)) {
return breakpoints(width, steps);
} else {
if (Util.isString(breakpoints)) {
breakpoints = ((function () {
var j, len, ref, results;
ref = breakpoints.split(',');
results = [];
for (j = 0, len = ref.length; j < len; j++) {
point = ref[j];
results.push(parseInt(point));
}
return results;
})()).sort(function (a, b) {
return a - b;
});
}
calc_breakpoint(width, steps) {
var breakpoints, point;
breakpoints = (this.state && this.state.breakpoints) || defaultBreakpoints;
if (Util.isFunction(breakpoints)) {
return breakpoints(width, steps);
} else {
if (Util.isString(breakpoints)) {
breakpoints = ((function () {
var j, len, ref, results;
ref = breakpoints.split(',');
results = [];
for (j = 0, len = ref.length; j < len; j++) {
point = ref[j];
results.push(parseInt(point));
}
return results;
})()).sort(function (a, b) {
return a - b;
});
}
return closestAbove(breakpoints, width);
}
};