Skip to Content
Mastering JavaScript Functional Programming
book

Mastering JavaScript Functional Programming

by Federico Kereki
November 2017
Intermediate to advanced
386 pages
9h 22m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming

Extending current data types

If we want to add mapping to basic JS data types, let's start by considering our options:

  • With null, undefined, and Symbol, applying maps doesn't sound too interesting
  • With the Boolean, Number, and String data types, we have some interesting possibilities, so we can examine some of those
  • Applying mapping to an object would be trivial: you just have to add a .map() method, which must return a new object
  • Finally, despite not being basic data types, we could also consider special cases, such as dates or functions, to which we could also add .map() methods
As in the rest of the book, we are sticking to plain JS, but you should look into libraries such as LoDash, Underscore, or Ramda, which already provide functionalities ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming - Second Edition

Mastering JavaScript Functional Programming - Second Edition

Federico Kereki

Publisher Resources

ISBN: 9781787287440Supplemental Content