Generics in Practice
Write generic helpers that keep their types: zip, chunk, partition, curry, pipe and index lists and objects without losing a key.
- 01
Zip Two Lists into Typed Pairs
- easy
- Code
- 02
Chunk a List, Keeping the Item Type
- easy
- Code
- 03
Get the First Item, Typed by Length
- easy
- Code
- 04
Fill In Options So Every Key Is Set
- easy
- Code
- 05
Drop Duplicates by Key, Keeping Item Types
- easy
- Code
- 06
Partition a List with a Type Guard
- medium
- Code
- Pro
- 07
Index a List by a Computed Key
- medium
- Code
- 08
Map an Object's Values, Keeping Its Keys
- medium
- Code
- 09
Omit Keys from an Object, Typed
- medium
- Code
- 10
Curry a Two-Argument Function, Typed
- medium
- Code
- 11
Count Items by a Computed Key
- medium
- Code
- 12
Swap Keys and Literal Values, Typed
- medium
- Code
- Pro
- 13
Pipe a Value Through Typed Steps
- hard
- Code
- Pro
- 14
Build an Exact Object from Entries
- hard
- Code
- 15
Sort by a Key That Holds Numbers or Strings
- hard
- Code
- Pro