some.js 423 B

123456789101112131415161718192021222324
  1. "use strict";
  2. var o = { 1: 1, 2: 2, 3: 3 };
  3. module.exports = function (t, a) {
  4. var o2 = {}, i = 0;
  5. t(o, function (value, name) {
  6. o2[name] = value;
  7. return false;
  8. });
  9. a(JSON.stringify(o2), JSON.stringify(o), "Iterates");
  10. a(
  11. t(o, function () {
  12. ++i;
  13. return true;
  14. }),
  15. true,
  16. "Succeeds"
  17. );
  18. a(i, 1, "Stops iteration after condition is met");
  19. a(t(o, function () { return false; }), false, "Fails");
  20. };