Commit 0418a471 authored by 好多大米's avatar 好多大米 Committed by GitHub

fix: update isFunction (#20912)

parent 0606cb8f
import Vue from 'vue';
export function isString(obj) { export function isString(obj) {
return Object.prototype.toString.call(obj) === '[object String]'; return Object.prototype.toString.call(obj) === '[object String]';
} }
...@@ -10,11 +12,25 @@ export function isHtmlElement(node) { ...@@ -10,11 +12,25 @@ export function isHtmlElement(node) {
return node && node.nodeType === Node.ELEMENT_NODE; return node && node.nodeType === Node.ELEMENT_NODE;
} }
export const isFunction = (functionToCheck) => { /**
* - Inspired:
* https://github.com/jashkenas/underscore/blob/master/modules/isFunction.js
*/
let isFunction = (functionToCheck) => {
var getType = {}; var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}; };
if (typeof /./ !== 'function' && typeof Int8Array !== 'object' && (Vue.prototype.$isServer || typeof document.childNodes !== 'function')) {
isFunction = function(obj) {
return typeof obj === 'function' || false;
};
}
export {
isFunction
};
export const isUndefined = (val)=> { export const isUndefined = (val)=> {
return val === void 0; return val === void 0;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment