 
 #=====================================================================
 
+$map = (options) ->
+  options.init = []
+
+  $watch this, options, (entered, exited) ->
+    $each entered, (value, key) => @value[key] = value
+    $each exited, (value, key) => delete @value[key]
+
+#---------------------------------------------------------------------
+
 # Creates a set of value from various items.
 $set = (options) ->
   # Contrary to other helpers, the default value is the key.

  $watch this, options, (entered, exited) ->
    prev = @value

    @value = add @value, value for value in entered
    @value = sub @value, value for value in exited

    @value isnt prev


  $watch this, options, (entered, exited) ->
    prev = @value

    @value = $first entered, (if keepLast then @value else def)

    @value isnt prev

