path: refactor normalizeArray()

The normalizeArray() function now avoids using the slow
Array#splice() method to improve performance and now
also filters out empty path parts.

Code that pre-filtered empty parts has been removed.