Front end of the Slack clone application.

some-right.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. "use strict";
  2. module.exports = {
  3. "__generic": function (t, a) {
  4. var count = 0, first, last, x, icount = this.length;
  5. t.call(this, function (item, index, col) {
  6. ++count;
  7. if (!first) {
  8. first = item;
  9. }
  10. last = item;
  11. x = col;
  12. a(index, --icount, "Index");
  13. });
  14. a(count, this.length, "Iterated");
  15. a(first, this[this.length - 1], "First is last");
  16. a(last, this[0], "Last is first");
  17. a.deep(x, Object(this), "Collection as third argument"); // Jslint: skip
  18. },
  19. "": function (t, a) {
  20. var x = {}, y, count;
  21. t.call(
  22. [1],
  23. function () {
  24. y = this;
  25. },
  26. x
  27. );
  28. a(y, x, "Scope");
  29. y = 0;
  30. t.call([3, 4, 4], function (a, i) {
  31. y += i;
  32. });
  33. a(y, 3, "Indexes");
  34. x = [1, 3];
  35. x[5] = "x";
  36. y = 0;
  37. count = 0;
  38. a(
  39. t.call(x, function (a, i) {
  40. ++count;
  41. y += i;
  42. }),
  43. false,
  44. "Return"
  45. );
  46. a(y, 6, "Misssing Indexes");
  47. a(count, 3, "Misssing Indexes, count");
  48. count = 0;
  49. a(
  50. t.call([-2, -3, -4, 2, -5], function (item) {
  51. ++count;
  52. return item > 0;
  53. }),
  54. true,
  55. "Return"
  56. );
  57. a(count, 2, "Break after true is returned");
  58. }
  59. };