Generics in Practice

Write generic helpers that keep their types: zip, chunk, partition, curry, pipe and index lists and objects without losing a key.

  1. 01

    Zip Two Lists into Typed Pairs

    • easy
    • Code
  2. 02

    Chunk a List, Keeping the Item Type

    • easy
    • Code
  3. 03

    Get the First Item, Typed by Length

    • easy
    • Code
  4. 04

    Fill In Options So Every Key Is Set

    • easy
    • Code
  5. 05

    Drop Duplicates by Key, Keeping Item Types

    • easy
    • Code
  6. 06

    Partition a List with a Type Guard

    • medium
    • Code
    • Pro
  7. 07

    Index a List by a Computed Key

    • medium
    • Code
  8. 08

    Map an Object's Values, Keeping Its Keys

    • medium
    • Code
  9. 09

    Omit Keys from an Object, Typed

    • medium
    • Code
  10. 10

    Curry a Two-Argument Function, Typed

    • medium
    • Code
  11. 11

    Count Items by a Computed Key

    • medium
    • Code
  12. 12

    Swap Keys and Literal Values, Typed

    • medium
    • Code
    • Pro
  13. 13

    Pipe a Value Through Typed Steps

    • hard
    • Code
    • Pro
  14. 14

    Build an Exact Object from Entries

    • hard
    • Code
  15. 15

    Sort by a Key That Holds Numbers or Strings

    • hard
    • Code
    • Pro