2016-10-10 03:43:44 +02:00
|
|
|
'use strict';
|
2017-08-14 05:01:11 +02:00
|
|
|
var $export = require('./_export');
|
|
|
|
var createProperty = require('./_create-property');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
// WebKit Array.of isn't generic
|
2017-08-14 05:01:11 +02:00
|
|
|
$export($export.S + $export.F * require('./_fails')(function () {
|
|
|
|
function F() { /* empty */ }
|
2016-10-10 03:43:44 +02:00
|
|
|
return !(Array.of.call(F) instanceof F);
|
|
|
|
}), 'Array', {
|
|
|
|
// 22.1.2.3 Array.of( ...items)
|
2017-08-14 05:01:11 +02:00
|
|
|
of: function of(/* ...args */) {
|
|
|
|
var index = 0;
|
|
|
|
var aLen = arguments.length;
|
|
|
|
var result = new (typeof this == 'function' ? this : Array)(aLen);
|
|
|
|
while (aLen > index) createProperty(result, index, arguments[index++]);
|
2017-05-27 17:36:13 +02:00
|
|
|
result.length = aLen;
|
2016-10-10 03:43:44 +02:00
|
|
|
return result;
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
});
|