From 90f29896704574c7500fd02906cd95943cb41a45 Mon Sep 17 00:00:00 2001 From: David Zukowski Date: Thu, 25 May 2017 18:10:25 -0500 Subject: [PATCH] refactor(compose): remove runtime type checking --- src/compose.js | 12 ------------ tests/compose.spec.js | 7 ------- 2 files changed, 19 deletions(-) diff --git a/src/compose.js b/src/compose.js index 21e1eba..6cfdd73 100644 --- a/src/compose.js +++ b/src/compose.js @@ -31,17 +31,5 @@ import pipe from './pipe' * isSqrtEven(16) // => true */ export default _defn('compose', function (fns) { - var i = 0 - - // TODO(zuko): abstract for use in other functions and disable in production. - for (; i < fns.length; i++) { - if (!isType('function', fns[i])) { - throw new TypeError( - 'Invalid argument supplied to `compose`. The value at index ' + - '[' + i + '] was not a function; what was received was of type: ' + - type(fns[i]) + '.' - ) - } - } return pipe(_reverse.call(fns)) }) diff --git a/tests/compose.spec.js b/tests/compose.spec.js index 499adc0..6f4afd9 100644 --- a/tests/compose.spec.js +++ b/tests/compose.spec.js @@ -53,10 +53,3 @@ test('invokes the functions from right to left', (t) => { t.true(s2.calledBefore(s1)) t.true(s1.calledOnce) }) - -test('throws early if a non-function is passed', (t) => { - t.throws( - () => compose([() => {}, undefined]), - 'Invalid argument supplied to `compose`. The value at index [1] was not a function; ' + - 'what was received was of type: Nil.') -})