Performance microoptimisations

I made some changes that improve performance by 10%:

- change try/catch to return true/false
- use native isArray method
- don't use shift()
- don't pass `undefined` parameter (it is implicit)