tableshape
tableshape copied to clipboard
Test the shape or structure of a Lua table, inspired by React.PropTypes & LPeg
Currently, nodes are printing their description in case of check failure. That would be good to be able to access this description at will, for example, overriding the `__tostring()` method...
There are currently two nodes that control how a node is printed: * `describe` - overwrites the "describe" method which essentially is the `tostring` callback for a node * `annotate`...
Is this possible? I'm looking to replace lapis.validate with this but there doesn't appear to be a equivalent to the `{ keys = true }` option that validate takes in...
If you have a flat array of items: ```lua {1,2,2,3,4,5} ``` And you want to match for every n items starting from every position that yields n items. This will...
When the addition of tags, I added a state object that is passed down to type checkers as a object is checked. Currently state is internal only for tags, but...
It seems that the `array_of` type doesn't detect invalid keys in the top-level table. **Example**: ```lua local types = require("tableshape").types local oneof_shape = types.array_of( types.shape { foo = types.number} )...
this is like a really weird issue and i am sorry for even opening it but i kinda have a question. I somewhat know lua/luajit because i am a maintainer...
add to-lua compiler for type checkers for improved performance. Because performance is highest priority, optimize out error messages since they currently generate a lot of work when going down invalid...