Typescript Split Array Based On Condition