Mastering JavaScript functional programming : write clean, robust, and maintainable web and server code using functional JavaScript and TypeScript /
Functional programming is a programming paradigm that uses functions for developing software. This book is filled with examples that enable you to leverage the latest JavaScript and TypeScript versions to produce modern and clean code, as well as teach you to how apply functional programming techniq...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham, UK :
Packt Publishing Ltd.,
2023.
|
Edición: | Third edition. |
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Contributors
- About the reviewers
- Table of Contents
- Preface
- Chapter 1: Becoming Functional
- Several Questions
- What is functional programming?
- Theory versus practice
- A different way of thinking
- FP and other programming paradigms
- What FP is not
- Why use FP?
- What we need
- What we get
- Not all is gold
- Is JavaScript functional?
- JavaScript as a tool
- Going functional with JavaScript
- Key features of JavaScript
- How do we work with JavaScript?
- Using transpilers
- Working online
- A step further
- TypeScript
- Testing
- Summary
- Questions
- Chapter 2: Thinking Functionally
- A First Example
- Our problem
- doing something only once
- Solution 1
- hoping for the best!
- Solution 2
- using a global flag
- Solution 3
- removing the handler
- Solution 4
- changing the handler
- Solution 5
- disabling the button
- Solution 6
- redefining the handler
- Solution 7
- using a local flag
- A functional solution to our problem
- A higher-order solution
- Testing the solution manually
- Testing the solution automatically
- Producing an even better solution
- Summary
- Questions
- Chapter 3: Starting Out with Functions
- A Core Concept
- All about functions
- Of lambdas and functions
- Arrow functions
- the modern way
- Functions as objects
- Using functions in FP ways
- Injection
- sorting it out
- Callbacks and promises
- Continuation-passing style
- Polyfills
- Stubbing
- Immediate invocation (IIFE)
- Summary
- Questions
- Chapter 4: Behaving Properly
- Pure Functions
- Pure functions
- Referential transparency
- Side effects
- Advantages of pure functions
- Impure functions
- Avoiding impure functions
- Is your function pure?
- Testing
- pure versus impure
- Testing pure functions
- Testing purified functions
- Testing impure functions
- Summary
- Questions
- Chapter 5: Programming Declaratively
- A Better Style
- Transformations
- Reducing an array to a value
- Applying an operation
- map()
- Dealing with arrays of arrays
- More general looping
- Logical HOFs
- Filtering an array
- Searching an array
- Higher-level predicates
- every() and some()
- Checking negatives
- none()
- Working with async functions
- Some strange behaviors
- Async-ready looping
- Working with parallel functions
- Unresponsive pages
- A frontend worker
- A backend worker
- Workers, FP style
- Long-living pooled workers
- Summary
- Questions
- Chapter 6: Producing Functions
- Higher-Order Functions
- Wrapping functions
- keeping behavior
- Logging
- Timing functions
- Memoizing functions
- Altering a function's behavior
- Doing things once, revisited
- Logically negating a function
- Inverting the results
- Arity changing
- Throttling and debouncing
- Changing functions in other ways
- Turning operations into functions
- Turning functions into promises