// Thin wraper over Object used internally to keep lists of processors.


"use strict";


function ProcessorsMap() {
  this.data = {};
}


// Returns Array of processors registered for given `key`.
//
//    processors.get("text/css").push(DirectiveProcessor);
//
// Associates an empty array with requested key if it doesn't exist yet.
ProcessorsMap.prototype.get = function (key) {
  if (!this.data[key]) {
    this.data[key] = [];
  }

  return this.data[key];
};


// Makes a deep copy of processors collection.
//
//    processors.get("text/css").length;  // => 1
//
//    processors_copy = processors.clone();
//    processors_copy.get("text/css").push(MyMegaProcessor);
//
//    processors.get("text/css").length;      // => 1
//    processors_copy.get("text/css").length; // => 2
//
// Used upon Environment init - clone globally registered processors
ProcessorsMap.prototype.clone = function () {
  var clone = new ProcessorsMap;

  Object.keys(this.data).forEach(function (key) {
    clone.data[key] = this.data[key].slice();
  }, this);

  return clone;
};


module.exports = ProcessorsMap;

@@ -461,16 +461,340 @@
 %5D;%0A%7D;%0A%0A%0A
+// Set processors list to specific value%0A//%0A//    old_val = processors.get(%22text/css%22);%0A//    new_val = _.without(old_val, MyMegaProcessor);%0A//    processors.set(%22text/css%22, new_val);%0A//%0A// Used to reset lists and unregister processors.%0AProcessorsMap.prototype.set = function (key, val) %7B%0A  this.data%5Bkey%5D = val %7C%7C %5B%5D;%0A%7D;%0A%0A%0A
 // Makes
@@ -1316,27 +1316,24 @@
   clone.
-data%5Bkey%5D =
+set(key,
  this.da
@@ -1347,16 +1347,17 @@
 .slice()
+)
 ;%0A  %7D, t

Fix processors map struct.