The partialRight
function from the Lodash library creates a new function with partially applied arguments from the right side of the original function.
Here is an example of how to use this function in JavaScript:
index.tsx314 chars12 lines
In this example, we imported the partialRight
function from the Lodash library using ES6 destructuring. We defined a simple greet
function that takes two arguments: a greeting and a name, and logs the message to the console.
We then used the partialRight
function to create two new functions: greetNamaste
and greetHola
. The first one has the greeting 'Namaste'
partially applied from the right side of the greet
function, and the second one has the greeting 'Hola'
partially applied.
Finally, we called the two new functions with a name argument to see the console output.
This is just one example of how to use the partialRight
function from Lodash in JavaScript.
gistlibby LogSnag