Remove opt_this param in forEach function
This commit is contained in:
@@ -11,21 +11,19 @@
|
|||||||
* @param {number} offset Offset.
|
* @param {number} offset Offset.
|
||||||
* @param {number} end End.
|
* @param {number} end End.
|
||||||
* @param {number} stride Stride.
|
* @param {number} stride Stride.
|
||||||
* @param {function(this: S, import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
|
* @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
|
||||||
* called for each segment.
|
* called for each segment.
|
||||||
* @param {S=} opt_this The object to be used as the value of 'this'
|
|
||||||
* within callback.
|
|
||||||
* @return {T|boolean} Value.
|
* @return {T|boolean} Value.
|
||||||
* @template T,S
|
* @template T
|
||||||
*/
|
*/
|
||||||
export function forEach(flatCoordinates, offset, end, stride, callback, opt_this) {
|
export function forEach(flatCoordinates, offset, end, stride, callback) {
|
||||||
const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
||||||
const point2 = [];
|
const point2 = [];
|
||||||
let ret;
|
let ret;
|
||||||
for (; (offset + stride) < end; offset += stride) {
|
for (; (offset + stride) < end; offset += stride) {
|
||||||
point2[0] = flatCoordinates[offset + stride];
|
point2[0] = flatCoordinates[offset + stride];
|
||||||
point2[1] = flatCoordinates[offset + stride + 1];
|
point2[1] = flatCoordinates[offset + stride + 1];
|
||||||
ret = callback.call(opt_this, point1, point2);
|
ret = callback(point1, point2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user