function accumulator( x ) {
		var k;
		var v;
		if ( arguments.length === 0 ) {
			if ( N === 0 ) {
				return null;
			}
			meanstdev[ 0 ] = mu;
			if ( N === 1 ) {
				if ( isnan( M2 ) ) {
					meanstdev[ 1 ] = NaN;
				} else {
					meanstdev[ 1 ] = 0.0;
				}
			} else if ( N < W ) {
				meanstdev[ 1 ] = sqrt( M2/(N-1) );
			} else {
				meanstdev[ 1 ] = sqrt( M2/n );
			}
			return meanstdev;
		}
		// Update the index for managing the circular buffer:
		i = (i+1) % W;

		// Case: incoming value is NaN, the sliding second moment is automatically NaN...
		if ( isnan( x ) ) {
			N = W; // explicitly set to avoid `N < W` branch
			mu = NaN;
			M2 = NaN;
		}
		// Case: initial window...
		else if ( N < W ) {
			buf[ i ] = x; // update buffer
			N += 1;
			delta = x - mu;
			mu += delta / N;
			M2 += delta * (x - mu);

			meanstdev[ 0 ] = mu;
			if ( N === 1 ) {
				meanstdev[ 1 ] = 0.0;
			} else {
				meanstdev[ 1 ] = sqrt( M2/(N-1) );
			}
			return meanstdev;
		}
		// Case: N = W = 1
		else if ( N === 1 ) {
			mu = x;
			M2 = 0.0;
			meanstdev[ 0 ] = x;
			meanstdev[ 1 ] = 0.0;
			return meanstdev;
		}
		// Case: outgoing value is NaN, and, thus, we need to compute the accumulated values...
		else if ( isnan( buf[ i ] ) ) {
			N = 1;
			mu = x;
			M2 = 0.0;
			for ( k = 0; k < W; k++ ) {
				if ( k !== i ) {
					v = buf[ k ];
					if ( isnan( v ) ) {
						N = W; // explicitly set to avoid `N < W` branch
						mu = NaN;
						M2 = NaN;
						break; // second moment is automatically NaN, so no need to continue
					}
					N += 1;
					delta = v - mu;
					mu += delta / N;
					M2 += delta * (v - mu);
				}
			}
		}
		// Case: neither the current second moment nor the incoming value are NaN, so we need to update the accumulated values...
		else if ( isnan( M2 ) === false ) {
			tmp = buf[ i ];
			delta = x - tmp;
			d1 = tmp - mu;
			mu += delta / W;
			d2 = x - mu;
			M2 += delta * (d1 + d2);
		}
		// Case: the current second moment is NaN, so nothing to do until the buffer no longer contains NaN values...
		buf[ i ] = x;

		meanstdev[ 0 ] = mu;
		meanstdev[ 1 ] = sqrt( M2/n );
		return meanstdev;
	}
If provided a value, the accumulator function returns updated accumulated values. If not provided a value, the accumulator function returns the current accumulated values.

@private
@param {number} [x] - input value
@returns {(ArrayLikeObject|null)} output array or null