Avoid type="number" in AngularJS

The other day I got hit by a peculiar bug in Angular. Using type="number" on an input element wouldn't do any number validation. On top of this, when I entered an invalid number the only validation failing was required. After a little research, it turned out to be a "feature" of blocking access to…

Introducing Retest

If you've looked into testing your API in node before, you've probably run across supertest by the prolific TJ Holowaychuk. So have I and it's truly a fantastic library for testing APIs. However, I found it to be lacking a couple of features I sorely needed. And to my surprise, I struggled to find…

Enabling Generators in Mocha

Update: It's on npm. Just npm install co-mocha and --require co-mocha in your mocha script to test using generators. For the last week, I've been working on a new project that uses node 0.11 and generators. Aside from the numerous benefits with generators in the application, I also integrated…

Partial Application in JavaScript

Partial application is the act of pre-filling arguments of a function and returning a new function of smaller arity. The returned function can be called with additional parameters and in JavaScript, the this context can also be changed when called. Using a partially applied function is extremely…

Forcing Function Arity in JavaScript

Function arity in something in JavaScript that is usually overlooked. For the most part, that's perfectly understandable, it's just a number. Unfortunately, this number can be integral to many other functions working correctly. But first, what number am I talking about? As you can see, the length…