ut2
Version:
一个现代 JavaScript 实用工具库。[点击查看在线文档]。
36 lines (32 loc) • 1.11 kB
JavaScript
;
var isObjectLike = require('../isObjectLike.js');
var getTag = require('./getTag.js');
var native = require('./native.js');
var VERSION = "1.21.2";
var isBrowser = typeof window !== native.stringUndefined && isObjectLike(window) && typeof document !== native.stringUndefined && isObjectLike(document) && window.document === document;
var supportedArgumentsType = getTag((function () { return arguments; })()) === native.argumentsTag;
var FUNC_ERROR_TEXT = 'Expected a function';
function toSource(func) {
if (func !== null) {
try {
return native.functionProtoToString.call(func);
}
catch (err) {
}
try {
return func + '';
}
catch (err) {
}
}
return '';
}
var stubFlase = function () { return false; };
var stubTrue = function () { return true; };
exports.FUNC_ERROR_TEXT = FUNC_ERROR_TEXT;
exports.VERSION = VERSION;
exports.isBrowser = isBrowser;
exports.stubFlase = stubFlase;
exports.stubTrue = stubTrue;
exports.supportedArgumentsType = supportedArgumentsType;
exports.toSource = toSource;