shim
A clean Lua Utility library, support for basic and useful function, inspired by loDash and Underscore
$ opm get chunpu/shim
Shim.lua
[![build status][travis-image]][travis-url]
A clean utility library, support for basic and useful function, make it easy to write lua code neatly
Shim.lua
was deeply inspired by Underscore.js, Lodash.js, Moses
Install
Use opm
opm get chunpu/shim
Download directly
wget --no-check-certificate https://raw.githubusercontent.com/chunpu/Shim/master/shim.lua
Usage
local _ = require 'shim'
_.isArray({1, 2, 3}) -- => true
_.isEqual({a = 1, b = 2}, {a = 1, b = 2}) -- => true
basic wrapper for oo style
_({1, 2, 3}):map(function(x) return x * 2 end)
-- => {2, 4, 6}
chain support
_({1, 0, 2, 4})
:chain()
:sort()
:map(function(x) return x * 2 end)
:filter(function(x) return x < 6 end)
:value()
-- => {0, 2, 4}
pretty print
print(_.dump({
a = 1,
b = {
a = 1,
b = {2, 3, 4}
}
}))
--[[ =>
{
'b': {
'b': [2, 3, 4],
'a': 1
},
'a': 1
}
]]
Api
<http://chunpu.github.io/shim-doc/>
License
Shim.lua is under MIT
Copyright (c) 2012-2014 Chunpu
[travis-image]: https://img.shields.io/travis/chunpu/Shim.svg?style=flat [travis-url]: https://travis-ci.org/chunpu/Shim
Authors
chunpu
License
mit
Versions
-
chunpu/shim 1.0.2A clean Lua Utility library, support for basic and useful function, inspired by loDash and Underscore 2016-10-16 10:08:09
-
chunpu/shim 1.0.0A clean Lua utility library, support for basic and useful function, make it easy to write lua code neatly 2016-10-13 11:14:51