uncover the concepts of functional programming with EcmaScript 8 /
Anto Aravinth, Srikanth Machiraju.
Second edition.
[Berkeley, California] :
Apress,
[2018]
1 online resource (319 pages)
ITpro collection
Word of Caution: Pointed Functor
Includes bibliographical references.
Intro; Table of Contents; About the Authors; About the Technical Reviewer; Acknowledgments; Introduction; Chapter 1: Functional Programming in Simple Terms; What Is Functional Programming? Why Does It Matter?; Referential Transparency; Imperative, Declarative, Abstraction; Functional Programming Benefits; Pure Functions; Pure Functions Lead to Testable Code; Reasonable Code; Parallel Code; Cachable; Pipelines and Composable; A Pure Function Is a Mathematical Function; What We Are Going to Build; Is JavaScript a Functional Programming Language?; Summary
Chapter 2: Fundamentals of JavaScript Functions ECMAScript: A Bit of History; Creating and Executing Functions; First Function; Strict Mode; Return Statement Is Optional; Multiple Statement Functions; Function Arguments; ES5 Functions Are Valid in ES6 and Above; Setting Up Our Project; Initial Setup; Our First Functional Approach to the Loop Problem; Gist on Exports; Gist on Imports; Running the Code Using Babel-Node; Creating Script in Npm; Running the Source Code from Git; Summary; Chapter 3: Higher Order Functions; Understanding Data; Understanding JavaScript Data Types; Storing a Function
Composition in General Terms Unix Philosophy; Functional Composition; Revisiting map, filter; compose Function; Playing with the compose Function; curry and partial to the Rescue; compose Many Functions; Pipelines and Sequence; Implementing pipe; Odds on Composition; Composition Is Associative; The Pipeline Operator; Debugging Using the tap Function; Summary; Chapter 8: Fun with Functors; What Is a Functor?; Functor Is a Container; Implementing map; MayBe; Implementing MayBe; Simple Use Cases; Real-World Use Cases; Either Functor; Implementing Either; Reddit Example Either Version
Passing a FunctionReturning a Function; Abstraction and Higher Order Functions; Abstraction Definitions; Abstraction via Higher Order Functions; Higher Order Functions in the Real World; every Function; some Function; sort Function; Summary; Chapter 4: Closures and Higher Order Functions; Understanding Closures; What Are Closures?; Remembering Where It Is Born; Revisiting sortBy Function; Higher Order Functions in the Real World (Continued); tap Function; unary Function; once Function; memoize Function; assign function; Summary; Chapter 5: Being Functional on Arrays
Working Functionally on Arraysmap; filter; Chaining Operations; concat All; Reducing Function; reduce Function; Zipping Arrays; zip Function; Summary; Chapter 6: Currying and Partial Application; A Few Notes on Terminology; Unary Function; Binary Function; Variadic Functions; Currying; Currying Use Cases; A logger Function: Using Currying; Revisit Curry; Back to logger Function; Currying in Action; Finding a Number in Array Contents; Squaring an Array; Data Flow; Partial Application; Implementing partial Function; Currying vs. Partial Application; Summary; Chapter 7: Composition and Pipelines
0
8
8
8
8
Understand functional programming concepts and the functional nature of the JavaScript language. Starting with an introduction to functional programming concepts, you will learn the key differences between imperative and functional programming. Diving straight into JavaScript functions, you will learn to write them with ES8. Followed by this you will move to higher order functions and learn how 'Function as Data' opens up a world of possibilities. You will then build higher order functions with closures. Arrays will then be introduced, followed by a set of APIs you can use with them. You will learn how to transform one function to another using currying and partial application. The compose function will be discussed in detail, followed by functors and monads. After having an in-depth look at applicative functors, you will learn the new features offered in ES8. The concluding chapters of Beginning Functional JavaScript will show you how to use a functional toolkit to build a small library that allows you to develop web applications, followed by tips on testing your functional code. You will: Discover functional programming concepts such as string padding and async functions Identify how functions are treated in JavaScript Create a functional library that mimics Underscore. JS Deep dive into ES8 functional features such as spread operators and generators Create a library that works like the react-redux pattern by following the functional paradigm.