Map

beginner1 of 8

Learn about map in fp-ts record

Code Editor

01-map.exercise.ts

💻
Loading editor...
Preparing Monaco Editor with TypeScript support

Test Results

Requirements

describe('Record map operations', () => {
  it('doubles all values', () => {
    const input = { a: 1, b: 2, c: 3 }
    const result = doubleValues(input)
    expect(result).toEqual({ a: 2, b: 4, c: 6 })
  })

  it('handles empty record', () => {
    const result = doubleValues({})
    expect(result).toEqual({})
  })

  it('uppercases all values', () => {
    const input = { name: 'alice', city: 'paris' }
    const result = uppercaseValues(input)
    expect(result).toEqual({ name: 'ALICE', city: 'PARIS' })
  })
})
🧪

Ready to Test?

Click "Run Tests" to see how your code performs

Pro Tips

💡 Stuck? Here's what to try:

  • • Read the comments in the code carefully
  • • Run tests frequently to get feedback
  • • Check the fp-ts documentation
  • • Use the solution if you need help

🚀 Learning Approach:

  • • Focus on understanding, not just solving
  • • Experiment with different approaches
  • • Think about real-world applications
  • • Build on previous exercises