Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Commit

Permalink
refactor(compose): remove runtime type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
David Zukowski committed May 25, 2017
1 parent 36c5ced commit 90f2989
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
12 changes: 0 additions & 12 deletions src/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
7 changes: 0 additions & 7 deletions tests/compose.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
})

0 comments on commit 90f2989

Please sign in to comment.