How to use the ember-file-upload/system/uuid.short function in ember-file-upload

To help you get started, we’ve selected a few ember-file-upload 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 adopted-ember-addons / ember-file-upload / addon / mirage / shim.js View on Github external
import uuid from 'ember-file-upload/system/uuid';

const MAP = 'map_' + uuid.short();
const KEYS = 'keys_' + uuid.short();

// Handle support for FormData#get in browsers that don't
// support it, only be done when mirage is included.
// Specifically, PhantomJS 👻
if (FormData.prototype.get == null) {
  const append = FormData.prototype.append;
  FormData.prototype.append = function (...args) {
    if (this[MAP] == null) { this[MAP] = {}; }
    if (this[KEYS] == null) { this[KEYS] = []; }
    this[MAP][args[0]] = args[1];
    this[KEYS].push(args[0]);
    return append.call(this, ...args);
  };

  FormData.prototype.get = function (key) {