number.js 887 B

12345678910111213141516171819202122232425262728
  1. /*!
  2. {
  3. "name": "ES6 Number",
  4. "property": "es6number",
  5. "notes": [{
  6. "name": "unofficial ECMAScript 6 draft specification",
  7. "href": "https://web.archive.org/web/20180825202128/https://tc39.github.io/ecma262/"
  8. }],
  9. "polyfills": ["es6shim"],
  10. "authors": ["Ron Waldon (@jokeyrhyme)"],
  11. "warnings": ["ECMAScript 6 is still a only a draft, so this detect may not match the final specification or implementations."],
  12. "tags": ["es6"]
  13. }
  14. !*/
  15. /* DOC
  16. Check if browser implements ECMAScript 6 Number per specification.
  17. */
  18. define(['Modernizr'], function(Modernizr) {
  19. Modernizr.addTest('es6number', !!(Number.isFinite &&
  20. Number.isInteger &&
  21. Number.isSafeInteger &&
  22. Number.isNaN &&
  23. Number.parseInt &&
  24. Number.parseFloat &&
  25. Number.isInteger(Number.MAX_SAFE_INTEGER) &&
  26. Number.isInteger(Number.MIN_SAFE_INTEGER) &&
  27. Number.isFinite(Number.EPSILON)));
  28. });