How to use the cloudinary-core.Util.isEmpty function in cloudinary-core

To help you get started, we’ve selected a few cloudinary-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudinary / cloudinary-react / src / components / CloudinaryComponent / CloudinaryComponent.js View on Github external
getTransformation(extendedProps) {
    let {children, ...rest} = extendedProps;
    let ownTransformation = only(Util.withCamelCaseKeys(rest), Transformation.methods) || {};
    let childrenOptions = this.getChildTransformations(children);
    if (!Util.isEmpty(childrenOptions)) {
      ownTransformation.transformation = childrenOptions;
    }
    return ownTransformation;
  }
github cloudinary / cloudinary-react / src / components / Image / Image.js View on Github external
let updatedOptions = {};

    if (extendedProps.breakpoints !== undefined) {
      state.breakpoints = extendedProps.breakpoints;
    }
    if (extendedProps.responsive) {
      state.responsive = true;
      updatedOptions = this.cloudinaryUpdate(url, state);
      url = updatedOptions.url;
    }

    let currentState = this.state || {};

    state.width = updatedOptions.width;

    if (!Util.isEmpty(url) && url !== currentState.url) {
      state.url = url;
    }

    return state;
  }
github cloudinary / cloudinary-react / src / components / Video / Video.js View on Github external
this.props);
    sourceTransformations = sourceTransformations || {};
    sourceTypes = sourceTypes || Cloudinary.DEFAULT_VIDEO_PARAMS.source_types;
    options = CloudinaryComponent.normalizeOptions(options, {});
    let cld = Cloudinary.new(Util.withSnakeCaseKeys(options));
    let sources = [];
    let tagAttributes = Transformation.new(options).toHtmlAttributes();
    let childTransformations = this.getTransformation(options);
    if (Util.isPlainObject(poster)) {
      let defaults = poster.publicId !== undefined && poster.publicId !== null ? Cloudinary.DEFAULT_IMAGE_PARAMS : DEFAULT_POSTER_OPTIONS;
      poster = cld.url(poster.publicId || publicId, Util.defaults({}, Util.withSnakeCaseKeys(poster), defaults));
    }
    if (!Util.isEmpty(poster)) {
      tagAttributes.poster = poster;
    }
    if (!Util.isEmpty(this.state.poster)) {
      tagAttributes.poster = this.state.poster;
    }

    if (Util.isArray(sourceTypes)) {
      sources = sourceTypes.map(srcType => {
          let sourceTransformation = sourceTransformations[srcType] || {};
          let src = cld.url(publicId, Util.defaults({}, sourceTransformation, childTransformations, {resource_type: 'video', format: srcType}));
          let mimeType = 'video/' + (srcType === 'ogv' ? 'ogg' : srcType);
          return <source type="{mimeType}/" src="{src}">;
        }
      );
    } else {
      let sourceTransformation = sourceTransformations[sourceTypes] || {};
      tagAttributes.src = cld.url(publicId, Util.defaults({}, sourceTransformation, childTransformations, {resource_type: 'video', format: sourceTypes}));
    }
github cloudinary / cloudinary-react / src / components / Video / Video.js View on Github external
render() {
    let {publicId, poster, sourceTypes, fallback, sourceTransformation: sourceTransformations, innerRef, ...options} = Object.assign({},
      this.getContext(),
      this.props);
    sourceTransformations = sourceTransformations || {};
    sourceTypes = sourceTypes || Cloudinary.DEFAULT_VIDEO_PARAMS.source_types;
    options = CloudinaryComponent.normalizeOptions(options, {});
    let cld = Cloudinary.new(Util.withSnakeCaseKeys(options));
    let sources = [];
    let tagAttributes = Transformation.new(options).toHtmlAttributes();
    let childTransformations = this.getTransformation(options);
    if (Util.isPlainObject(poster)) {
      let defaults = poster.publicId !== undefined &amp;&amp; poster.publicId !== null ? Cloudinary.DEFAULT_IMAGE_PARAMS : DEFAULT_POSTER_OPTIONS;
      poster = cld.url(poster.publicId || publicId, Util.defaults({}, Util.withSnakeCaseKeys(poster), defaults));
    }
    if (!Util.isEmpty(poster)) {
      tagAttributes.poster = poster;
    }
    if (!Util.isEmpty(this.state.poster)) {
      tagAttributes.poster = this.state.poster;
    }

    if (Util.isArray(sourceTypes)) {
      sources = sourceTypes.map(srcType =&gt; {
          let sourceTransformation = sourceTransformations[srcType] || {};
          let src = cld.url(publicId, Util.defaults({}, sourceTransformation, childTransformations, {resource_type: 'video', format: srcType}));
          let mimeType = 'video/' + (srcType === 'ogv' ? 'ogg' : srcType);
          return <source type="{mimeType}/" src="{src}">;
        }
      );
    } else {
      let sourceTransformation = sourceTransformations[sourceTypes] || {};