$.classof.js 565 B

12345678910111213141516
  1. // getting tag from 19.1.3.6 Object.prototype.toString()
  2. var cof = require('./$.cof')
  3. , TAG = require('./$.wks')('toStringTag')
  4. // ES3 wrong here
  5. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  6. module.exports = function(it){
  7. var O, T, B;
  8. return it === undefined ? 'Undefined' : it === null ? 'Null'
  9. // @@toStringTag case
  10. : typeof (T = (O = Object(it))[TAG]) == 'string' ? T
  11. // builtinTag case
  12. : ARG ? cof(O)
  13. // ES3 arguments fallback
  14. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  15. };