intersection.js 715 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. var toArray = require("../../../array/to-array");
  3. module.exports = {
  4. "__generic": function (t, a) { a.deep(t.call(this, this, this), toArray(this)); },
  5. "": function (t, a) {
  6. var x = {}, y = {}, p, r;
  7. a.deep(t.call([], [2, 3, 4]), [], "Empty #1");
  8. a.deep(t.call([2, 3, 4], []), [], "Empty #2");
  9. a.deep(t.call([2, 3, x], [y, 5, 7]), [], "Different");
  10. p = t.call(
  11. [3, 5, "raz", {}, "dwa", x], [1, 3, "raz", "dwa", "trzy", x, {}], [3, "raz", x, 65]
  12. );
  13. r = [3, "raz", x];
  14. p.sort();
  15. r.sort();
  16. a.deep(p, r, "Same parts");
  17. a.deep(t.call(r, r), r, "Same");
  18. a.deep(
  19. t.call([1, 2, x, 4, 5, y, 7], [7, y, 5, 4, x, 2, 1]), [1, 2, x, 4, 5, y, 7],
  20. "Long reverse same"
  21. );
  22. }
  23. };