utils.js 389 B

1234567891011121314151617181920
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /**
  6. * @module image/imageupload/utils
  7. */
  8. /**
  9. * Checks if a given file is an image.
  10. *
  11. * @param {File} file
  12. * @returns {Boolean}
  13. */
  14. export function isImageType( file ) {
  15. const types = /^image\/(jpeg|png|gif|bmp)$/;
  16. return types.test( file.type );
  17. }