   isEqual:   require 'lodash/lang/isEqual'
   isEmpty:   require 'lodash/lang/isEmpty'
   cloneDeep: require 'lodash/lang/cloneDeep'
+  first:     require 'lodash/array/first'
+  last:      require 'lodash/array/last'
   pick:      require 'lodash/object/pick'
   compact:   require 'lodash/array/compact'
   reject:    require 'lodash/collection/reject'

      if _.isEmpty @props.permittedProperties
        _.cloneDeep @props.value
      else
        (_.pick v, @props.permittedProperties for v in @props.value)

    @props.onChange @props.name, value


  removeItem: (index) ->
    (e) =>
      value = if @props.destroyWorkaround and @props.value[index]?.id
        id:       @props.value[index]?.id
        _destroy: '1'
      else
        null
