Sha256: 2557a57bda98d104bc0243bfa36fdda496dcd7b6a08026d1a668b0078e22114d

Contents?: true

Size: 1013 Bytes

Versions: 4

Compression:

Stored size: 1013 Bytes

Contents

'use strict';

(function () {
  scrivito.BinaryUtils = {
    validateBinaryOptions: function validateBinaryOptions(options) {
      if (_.has(options, 'filename') && !options.filename) {
        throw new scrivito.ArgumentError('filename cannot be blank');
      }

      if (_.has(options, 'content_type') && !options.content_type) {
        throw new scrivito.ArgumentError('content_type cannot be blank');
      }

      if (_.has(options, 'contentType') && !options.contentType) {
        throw new scrivito.ArgumentError('contentType cannot be blank');
      }
    },

    isBlob: function isBlob(obj) {
      return !!obj && _.isNumber(obj.size) && _.isString(obj.type);
    },

    isFile: function isFile(obj) {
      return this.isBlob(obj) && _.isDate(obj.lastModifiedDate) && _.isString(obj.name);
    },

    // -- PATCH BEGINS HERE --
    isBlobWithName: function isBlobWithName(obj) {
      return typeof obj === 'object' && this.isBlob(obj.blob_to_upload);
    }
  };
})();
// -- PATCH ENDS HERE --

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infopark_fiona7-1.5.3.2.0 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.3.2.0.pre.beta1 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.2.1.0.pre.beta1 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.2.0.0 app/assets/javascripts/scrivito_patches/binary_utils.js