todomvc
Version:
> Helping you select an MV\* framework
38 lines (30 loc) • 793 B
JavaScript
/**
* poly common functions
*
* (c) copyright 2011-2013 Brian Cavalier and John Hann
*
* This module is part of the cujo.js family of libraries (http://cujojs.com/).
*
* Licensed under the MIT License at:
* http://www.opensource.org/licenses/mit-license.php
*
*/
define(function (require, exports, module) {
var toString;
toString = ({}).toString;
exports.isFunction = function (o) {
return typeof o == 'function';
};
exports.isString = function (o) {
return toString.call(o) == '[object String]';
};
exports.toString = function (o) {
return toString.apply(o);
};
exports.createCaster = function (caster, name) {
return function cast (o) {
if (o == null) throw new TypeError(name + ' method called on null or undefined');
return caster(o);
}
}
});