Skip to content

Commit 5003655

Browse files
authored
toArray type overloading (#7808)
1 parent c7aff5b commit 5003655

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

src/core/math/color.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,22 @@ class Color {
294294
return s;
295295
}
296296

297+
/**
298+
* @overload
299+
* @param {number[]} [arr] - The array to populate with the color's number
300+
* components. If not specified, a new array is created.
301+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
302+
* array. Default is 0.
303+
* @returns {number[]} The color as an array.
304+
*/
305+
/**
306+
* @overload
307+
* @param {ArrayBufferView} arr - The array to populate with the color's number
308+
* components. If not specified, a new array is created.
309+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
310+
* array. Default is 0.
311+
* @returns {ArrayBufferView} The color as an array.
312+
*/
297313
/**
298314
* Converts the color to an array.
299315
*

src/core/math/quat.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,22 @@ class Quat {
816816
return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`;
817817
}
818818

819+
/**
820+
* @overload
821+
* @param {number[]} [arr] - The array to populate with the quaternion's number
822+
* components. If not specified, a new array is created.
823+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
824+
* array. Default is 0.
825+
* @returns {number[]} The quaternion as an array.
826+
*/
827+
/**
828+
* @overload
829+
* @param {ArrayBufferView} arr - The array to populate with the quaternion's number
830+
* components. If not specified, a new array is created.
831+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
832+
* array. Default is 0.
833+
* @returns {ArrayBufferView} The quaternion as an array.
834+
*/
819835
/**
820836
* Converts the quaternion to an array.
821837
*

src/core/math/vec2.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,22 @@ class Vec2 {
688688
return `[${this.x}, ${this.y}]`;
689689
}
690690

691+
/**
692+
* @overload
693+
* @param {number[]} [arr] - The array to populate with the vector's number
694+
* components. If not specified, a new array is created.
695+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
696+
* array. Default is 0.
697+
* @returns {number[]} The vector as an array.
698+
*/
699+
/**
700+
* @overload
701+
* @param {ArrayBufferView} arr - The array to populate with the vector's number
702+
* components. If not specified, a new array is created.
703+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
704+
* array. Default is 0.
705+
* @returns {ArrayBufferView} The vector as an array.
706+
*/
691707
/**
692708
* Converts the vector to an array.
693709
*

src/core/math/vec3.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,22 @@ class Vec3 {
707707
return `[${this.x}, ${this.y}, ${this.z}]`;
708708
}
709709

710+
/**
711+
* @overload
712+
* @param {number[]} [arr] - The array to populate with the vector's number
713+
* components. If not specified, a new array is created.
714+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
715+
* array. Default is 0.
716+
* @returns {number[]} The vector as an array.
717+
*/
718+
/**
719+
* @overload
720+
* @param {ArrayBufferView} arr - The array to populate with the vector's number
721+
* components. If not specified, a new array is created.
722+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
723+
* array. Default is 0.
724+
* @returns {ArrayBufferView} The vector as an array.
725+
*/
710726
/**
711727
* Converts the vector to an array.
712728
*

src/core/math/vec4.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,22 @@ class Vec4 {
672672
return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`;
673673
}
674674

675+
/**
676+
* @overload
677+
* @param {number[]} [arr] - The array to populate with the vector's number
678+
* components. If not specified, a new array is created.
679+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
680+
* array. Default is 0.
681+
* @returns {number[]} The vector as an array.
682+
*/
683+
/**
684+
* @overload
685+
* @param {ArrayBufferView} arr - The array to populate with the vector's number
686+
* components. If not specified, a new array is created.
687+
* @param {number} [offset] - The zero-based index at which to start copying elements to the
688+
* array. Default is 0.
689+
* @returns {ArrayBufferView} The vector as an array.
690+
*/
675691
/**
676692
* Converts the vector to an array.
677693
*

0 commit comments

Comments
 (0)