source: trip-planner-front/node_modules/arr-union/index.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 527 bytes
Line 
1'use strict';
2
3module.exports = function union(init) {
4 if (!Array.isArray(init)) {
5 throw new TypeError('arr-union expects the first argument to be an array.');
6 }
7
8 var len = arguments.length;
9 var i = 0;
10
11 while (++i < len) {
12 var arg = arguments[i];
13 if (!arg) continue;
14
15 if (!Array.isArray(arg)) {
16 arg = [arg];
17 }
18
19 for (var j = 0; j < arg.length; j++) {
20 var ele = arg[j];
21
22 if (init.indexOf(ele) >= 0) {
23 continue;
24 }
25 init.push(ele);
26 }
27 }
28 return init;
29};
Note: See TracBrowser for help on using the repository browser.