Sha256: 01482adbea51bf3068588fb99a9001014235d3408b873733389205cc7ab6fdeb

Contents?: true

Size: 1020 Bytes

Versions: 7

Compression:

Stored size: 1020 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 obj && typeof obj === 'object' && this.isBlob(obj.blob_to_upload);
    }
  };
})();
// -- PATCH ENDS HERE --

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
infopark_fiona7-1.5.5.5.1 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.5.5.0 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.5.4.1 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.5.4.0 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.2.0.1.3 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.5.3.1 app/assets/javascripts/scrivito_patches/binary_utils.js
infopark_fiona7-1.5.4.3.0 app/assets/javascripts/scrivito_patches/binary_utils.js