Skip to content

Commit

Permalink
optimize Array methods call
Browse files Browse the repository at this point in the history
  • Loading branch information
futurist committed Jul 8, 2018
1 parent 6deba9b commit b0bcb7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
@@ -1,9 +1,10 @@
const isString = x => typeof x === 'string'
const isArray = x => Array.isArray(x)
const isArray = Array.isArray
const arrayPush = Array.prototype.push
const isObject = x => typeof x === 'object' && !isArray(x)

const clean = (arr, n) => (
n && Array.prototype.push.apply(arr, isString(n[0]) ? [n] : n), arr
n && arrayPush.apply(arr, isString(n[0]) ? [n] : n), arr
)

const child = (n, cb) =>
Expand Down

0 comments on commit b0bcb7a

Please sign in to comment.