/**
* Created by zhangmike on 16/10/19.
*/
function isType(type){
return function(obj){
return Object.prototype.toString.call(obj) === '[object '+type+']';
};
}
export default {
isFunction(name) {
return isType('Function')(name);
},
isObject(name) {
return isType('Object')(name);
},
has(obj, key) {
return obj != null && Object.prototype.hasOwnProperty.call(obj, key);
},
create(proto, props) {
if (this.isObject(props)) {
Object.keys(props).forEach(key => {
proto[key] = props[key];
});
}
return proto;
}
};