Skip to content

Instantly share code, notes, and snippets.

@brycepj
Last active February 19, 2016 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycepj/820b053d3501e1a7b489 to your computer and use it in GitHub Desktop.
Save brycepj/820b053d3501e1a7b489 to your computer and use it in GitHub Desktop.
monkeyface API 1.0
1.0
All Types
- is(type)
- ensures that type matches
- string, object, array, function, Boolean
- collection types 'string[]'
- takes literals as well ({}, [])
- returns value
Objects, Arrays
- implements(interface)
- prevents names being a type ('string', etc)
- returns value
Functions
- params typechecking
- called when function is executed.
- Support Function return values (avaiable in toString of function) or void
Interface(cfg)
- this should be placed on the global scope
- create()
- validate input
- return InterfaceInstance
- this.props: {required, optional} , methods : {required, optional},
- validate()
- can take a vlaue and check if it passes
- ensureImplements(value, type)
- basically can do everything is() or implements() does
Push to 2.0
Type checking for errors
Return values for functions (maybe 'is' will work)
Support tests written in (takes a function that is applied to a value, and value is returned)
Support for Generics?
MaybeCall TestApply TestCall
Figure out a solution for undefined/null values --
Support Any type?
Support multiple types or matchers being passed
Consider looking into changes over time of values
Default vs Individualized Error Status
Support for Classes (implements, subclassing, etc)
es6??
support for not()
takes an object, or an array of properties
support optional or required properties/methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment