function accumulator( x ) {
		var k;
		if ( arguments.length === 0 ) {
			if ( N === 0 ) {
				return null;
			}
			return sum;
		}
		// Update the index for managing the circular buffer:
		i = (i+1) % W;

		// Case: incoming value is NaN, the accumulated value is automatically NaN...
		if ( isnan( x ) ) {
			N = W; // explicitly set to avoid `N < W` branch
			sum = NaN;
		}
		// Case: initial window...
		else if ( N < W ) {
			N += 1;
			sum += x;
		}
		// Case: outgoing value is NaN, and, thus, we need to compute the accumulated value...
		else if ( isnan( buf[ i ] ) ) {
			N = 1;
			sum = x;
			for ( k = 0; k < W; k++ ) {
				if ( k !== i ) {
					if ( isnan( buf[ k ] ) ) {
						N = W; // explicitly set to avoid `N < W` branch
						sum = NaN;
						break; // sum is automatically NaN, so no need to continue
					}
					N += 1;
					sum += buf[ k ];
				}
			}
		}
		// Case: neither the current accumulated value nor the incoming value are NaN, so we need to update the accumulated value...
		else if ( isnan( sum ) === false ) {
			sum += x - buf[ i ];
		}
		// Case: the current accumulated value is NaN, so nothing to do until the buffer no longer contains NaN values...

		buf[ i ] = x;
		return sum;
	}
If provided a value, the accumulator function returns an updated sum. If not provided a value, the accumulator function returns the current sum.

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