petitviolet blog

    typescript (1 posts)

    icon
    Written by petitviolet

    Merge sorted arrays with ordering in some manner in TypeScript

    2022-02-14TypeScript
    Arrays can be concatnated with Array#concat method but there is no built-in function to concatnating sorted arrays with giving a certain order
    In Rust, iterable objects have peek method to get the next value without advancing the iterator. [Peekable in std::iter - Rust](https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html) This concept could be used to achieve the purpose. In merging 2 arrays with giving a certain order, peek