Underscore.js isType Alternatives (v5)

Revision 5 of this benchmark created by John-David Dalton on


Preparation HTML

<script src="https://documentcloud.github.com/underscore/underscore.js"></script>

Setup

var $ = window.jQuery,
      _ = window._,
      array = [1, 2, 3],
      func  = function(){},
      string = "string",
      number = 101,
      date   = new Date,
      regexp = /regexp/i;

Test runner

Ready to run.

Testing in
TestOps/sec
Current Implementation
_.isFunction(func);
_.isFunction(array);

_.isString(string);
_.isString(array);

_.isNumber(number);
_.isNumber(string);
ready
typeof
typeof func == 'function';
typeof array == 'function';

typeof string == 'string';
typeof array == 'string';

typeof number == 'number';
typeof string == 'number';
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Jeremy Ashkenas on
  • Revision 4: published by Paul Miller on
  • Revision 5: published by John-David Dalton on
  • Revision 7: published by Shane O'Sullivan on
  • Revision 9: published on
  • Revision 10: published on
  • Revision 11: published by Jesús Germade on
  • Revision 12: published by test on
  • Revision 13: published by Dan on
  • Revision 14: published by Jesús Germade on
  • Revision 15: published by Jesús Germade on
  • Revision 16: published by Jesús Germade on
  • Revision 17: published by mingc on
  • Revision 18: published by Eldar Abusalimov on