Types

Adds a basic type checking module to enforce types in a coherent way.
I opted not to use a external module for this because I didn't find one that was similar enough to what I wanted, without adding boiler plate code everywhere.

Open to that idea though if it exists already, as I'm not a huge fan of having this included.

**edit:** Note, this doesn't add or remove any type checking that wasn't already being done with `assert`.
What readability loss is there?  Its really quite straight forward no?
On Oct 7, 2014 4:19 PM, "Wei Lu" <notifications@github.com> wrote:

> In src/types.js:
>
> > @@ -0,0 +1,38 @@
> > +module.exports = function enforce(type, value) {
> > +  switch (type) {
> > +    // http://jsperf.com/array-typecheck-2
> > +    case 'Array': {
> > +      if (value != null && value.constructor === Array) return
>
> Does the performance gain justify the readability tradeoff here?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/bitcoinjs/bitcoinjs-lib/pull/288/files#r18500957>.
>