1
0

validate.js 671 B

1234567891011121314151617181920
  1. 'use strict';
  2. var iteratorSymbol = require('es6-symbol').iterator;
  3. module.exports = function (t, a) {
  4. var x;
  5. a.throws(function () { t(0); }, TypeError, "0");
  6. a.throws(function () { t(false); }, TypeError, "false");
  7. a(t(''), '', "''");
  8. a.throws(function () { t({}); }, TypeError, "Plain Object");
  9. a.throws(function () { t(function () {}); }, TypeError, "Function");
  10. a(t(x = new String('raz')), x, "String object"); //jslint: ignore
  11. a(t(x = { length: 1 }), x, "Array like");
  12. a.throws(function () { t(); }, TypeError, "Undefined");
  13. a.throws(function () { t(null); }, TypeError, "null");
  14. x = {};
  15. x[iteratorSymbol] = function () {};
  16. a(t(x), x, "Iterable");
  17. };