判断源是否是string
这个api在YUI上的判断是这样
var L = Y.Lang || (Y.Lang = {}); /** * Determines whether or not the provided item is a string. * @method isString * @static * @param o The object to test. * @return {boolean} true if o is a string. */ L.isString = function(o) { return typeof o === 'string'; };
个人的凤凰lib还是采用类似的开源框架tangram的做法
/* *isString-judge the source is or not string* *@function* *@param source* *@return {boolean}* */ ZYC.lang.isString = function(source){ return Object.prototype.toString.call(source) === "[object String]"; };