diff options
Diffstat (limited to 'plugins/coro-wrapper/init.lua')
-rw-r--r-- | plugins/coro-wrapper/init.lua | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/plugins/coro-wrapper/init.lua b/plugins/coro-wrapper/init.lua deleted file mode 100644 index aab2683baf3..00000000000 --- a/plugins/coro-wrapper/init.lua +++ /dev/null @@ -1,41 +0,0 @@ -local exports = {} -exports.name = "creationix/coro-wrapper" -exports.version = "1.0.0-1" -exports.homepage = "https://github.com/luvit/lit/blob/master/deps/coro-wrapper.lua" -exports.description = "An adapter for applying decoders to coro-streams." -exports.tags = {"coro", "decoder", "adapter"} -exports.license = "MIT" -exports.author = { name = "Tim Caswell" } - -function exports.reader(read, decode) - local buffer = "" - return function () - while true do - local item, extra = decode(buffer) - if item then - buffer = extra - return item - end - local chunk = read() - if not chunk then return end - buffer = buffer .. chunk - end - end, - function (newDecode) - decode = newDecode - end -end - -function exports.writer(write, encode) - return function (item) - if not item then - return write() - end - return write(encode(item)) - end, - function (newEncode) - encode = newEncode - end -end - -return exports |