Simply stated, a higher-order function takes one or more functions as an argument and/or returns a function as a result. Combined with predicates (functions that accept arbitrary inputs and return a boolean), we can construct a small library that replaces the functionality of literally hundreds of hand-coded functions. When combined with Javascript's ability to create functions at runtime by specifying the function body in a string, this process becomes exceptionally powerful.
This library represents my most commonly-used set of higher-order functions. I've used similar collections in the past across multiple environments ranging from C++ in the 1990s to ActionScript to native Javascript to Typescript. I hope you find the library to be useful.
NOTE: This library has been updated and is now part of the AMYR library.
Author: Jim Armstrong - The Algorithmist
@algorithmist
theAlgorithmist [at] gmail [dot] com
Typescript: 3.8.3
Jest: 25.5.3
Version: 1.0
Installation involves all the usual suspects
- npm installed globally
- Clone the repository
- npm install
- get coffee (this is the most important step)
-
npm test
-
Standalone compilation only (npm build)
Specs (_higher-order.spec.ts) reside in the test folder and serve as usage examples for the library.
Enjoy!
Apache 2.0
Free Software? Yeah, Homey plays that