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

Commit

Permalink
refactor(compact): use identity as predicate to save bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Zukowski committed Jan 23, 2017
1 parent c795831 commit ef4c6d3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/compact.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import filter from './filter'
import identity from './identity'

/**
* @name compact
Expand All @@ -14,6 +15,4 @@ import filter from './filter'
* compact({ a: false, b: null, c: true }) // => { c: true }
* compact(['', 0, {}, [], '0']) // => [{}, [], '0']
*/
export default filter(function (x) {
return !!x
})
export default filter(identity)

0 comments on commit ef4c6d3

Please sign in to comment.