]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/array/#/concat/shim.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / array / # / concat / shim.js
1 'use strict';
2
3 var isPlainArray = require('../../is-plain-array')
4   , toPosInt     = require('../../../number/to-pos-integer')
5   , isObject     = require('../../../object/is-object')
6
7   , isArray = Array.isArray, concat = Array.prototype.concat
8   , forEach = Array.prototype.forEach
9
10   , isSpreadable;
11
12 isSpreadable = function (value) {
13         if (!value) return false;
14         if (!isObject(value)) return false;
15         if (value['@@isConcatSpreadable'] !== undefined) {
16                 return Boolean(value['@@isConcatSpreadable']);
17         }
18         return isArray(value);
19 };
20
21 module.exports = function (item/*, …items*/) {
22         var result;
23         if (!this || !isArray(this) || isPlainArray(this)) {
24                 return concat.apply(this, arguments);
25         }
26         result = new this.constructor(this.length);
27         forEach.call(this, function (val, i) { result[i] = val; });
28         forEach.call(arguments, function (arg) {
29                 var base;
30                 if (isSpreadable(arg)) {
31                         base = result.length;
32                         result.length += toPosInt(arg.length);
33                         forEach.call(arg, function (val, i) { result[base + i] = val; });
34                         return;
35                 }
36                 result.push(arg);
37         });
38         return result;
39 };