flip
Creates a function that invokes fn with the first two arguments swapped.
Useful when adapting a function for use in higher-order pipelines where the
argument order is reversed (e.g. passing a binary callback to reduce).
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fn | function | The function to wrap. |
Returns
Section titled “Returns”function — A new function with the first two parameters swapped.
Examples
Section titled “Examples”Swap argument order
Section titled “Swap argument order”Returns a new function where the first two arguments are swapped.
Adapt a divide function
Section titled “Adapt a divide function”Useful for adapting binary callbacks in higher-order functions.
