import _arrayEachShortCircuitable from './internal/_arrayEachShortCircuitable'
import _curry2 from './internal/_curry2'

/**
 * cond : [[(a -> Boolean), (a -> *)]] -> a -> (a -> *)
 */
export default _curry2(function cond (conditions, x) {
  var _this = this
    , _res

  _arrayEachShortCircuitable(function (condition) {
    var pred = condition[0]
      , fn   = condition[1]

    if (pred.apply(_this, [x])) {
      _res = fn.apply(_this, [x])
      return true
    }
  }, conditions)
  return _res
})

@@ -386,29 +386,28 @@
 f (pred.
-apply
+call
 (_this, 
 %5Bx%5D)) %7B%0A
@@ -398,19 +398,17 @@
 (_this, 
-%5Bx%5D
+x
 )) %7B%0A   
@@ -424,21 +424,20 @@
  fn.
-apply
+call
 (_this, 
 %5Bx%5D)
@@ -436,11 +436,9 @@
 is, 
-%5Bx%5D
+x
 )%0A  

remove unnecessary array wrapper