An implementation of the pipeline
operator in Lua
To install pipe
, run:
$ luarocks install pipe
pipe
function pipes the value of an expression into a function that allows the creation of chained function calls.
pipe
performs left-to-right function composition. See the example below:
local pipe = require('pipe')
function exclamation(str)
return str .. '!'
end
local wrapped = pipe(string.upper, exclamation)
wrapped('Lua is nice') -- LUA IS NICE!