Commit c5f699e8 authored by GoshaZotov's avatar GoshaZotov

Array.fill() -> fillArray()

parent 80243848
......@@ -644,49 +644,6 @@ if (typeof Math.sign != 'function') {
};
}
if (!Array.prototype.fill) {
Array.prototype.fill = function(value) {
// Шаги 1-2.
if (this == null) {
throw new TypeError('this is null or not defined');
}
var O = Object(this);
// Шаги 3-5.
var len = O.length >>> 0;
// Шаги 6-7.
var start = arguments[1];
var relativeStart = start >> 0;
// Шаг 8.
var k = relativeStart < 0 ?
Math.max(len + relativeStart, 0) :
Math.min(relativeStart, len);
// Шаги 9-10.
var end = arguments[2];
var relativeEnd = end === undefined ?
len : end >> 0;
// Шаг 11.
var final = relativeEnd < 0 ?
Math.max(len + relativeEnd, 0) :
Math.min(relativeEnd, len);
// Шаг 12.
while (k < final) {
O[k] = value;
k++;
}
// Шаг 13.
return O;
};
}
RegExp.escape = function ( text ) {
return text.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" );
};
......
......@@ -1665,20 +1665,18 @@
{
// give various vectors size and initial value
this.mpBase = [];
this.mpBase.length = this.mnCount;
this.mpBase.fill(0);
fillArray(this.mpBase, 0, this.mnCount);
this.mpTrend = [];
this.mpTrend.length = this.mnCount;
this.mpTrend.fill(0);
fillArray(this.mpTrend, 0, this.mnCount);
if ( !this.bEDS ){
this.mpPerIdx = [];
this.mpPerIdx.length = this.mnCount;
this.mpPerIdx.fill(0);
fillArray(this.mpPerIdx, 0, this.mnCount);
}
this.mpForecast = [];
this.mpForecast.length = this.mnCount;
this.mpForecast.fill(0);
fillArray(this.mpForecast, 0, this.mnCount);
this.mpForecast[ 0 ] = this.maRange[ 0 ].Y;
if ( this.prefillTrendData() )
......@@ -2322,6 +2320,12 @@
return true;
}
function fillArray(array, val, length){
for(var i = 0; i < length - 1; i++){
array[i] = val;
}
}
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment