foolproof
v0.0.62-beta
Published
Project deprecated. Use lodash-node.
Downloads
4
Readme
Foolproof.js
not available on npm just yet...
Foolproof.js is a group of helper functions for type checking. You can pass any object to a foolproof helper function and be certain it will never throw a nasty error since typeof is the first check that is always done on any value given.
Prototype.toString is used to provide more specific object type info. Try typeOf() on any object.
How to Include Foolproof.js
Foolproof gives you a couple options. Mainly we want to make it easy to use the helper functions as you would any other native JS feature.
You could use it like this:
var bp = require('foolproof')()
alert( bp.isString('this is a demo') );
But it was intended to make the helper functions available natively in your app's context, like this:
var App = (function(){
require('foolproof').apply(this);
// does stuff...
alert( isString('this is a demo') );
return this
})()