Skip to content

Commit 6a5d0aa

Browse files
committed
Mark array() method as deprecated with warning message
1 parent 095f220 commit 6a5d0aa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/math/p5.Vector.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,7 @@ class Vector {
29392939
/**
29402940
* Returns the vector's components as an array of numbers.
29412941
*
2942+
* @deprecated
29422943
* @return {Number[]} array with the vector's components.
29432944
* @example
29442945
* <div class = "norender">
@@ -2954,6 +2955,10 @@ class Vector {
29542955
* </div>
29552956
*/
29562957
array() {
2958+
p5._friendlyError(
2959+
'array() is deprecated and will be removed in a future version of p5.js.',
2960+
'p5.Vector.array'
2961+
);
29572962
return [this.x || 0, this.y || 0, this.z || 0];
29582963
}
29592964

@@ -3784,11 +3789,16 @@ class Vector {
37843789
* method to copy into your own vector.
37853790
*/
37863791
/**
3792+
* @deprecated
37873793
* @static
37883794
* @param {p5.Vector} v the vector to convert to an array
37893795
* @return {Number[]} an Array with the 3 values
37903796
*/
37913797
static array(v) {
3798+
p5._friendlyError(
3799+
'array() is deprecated and will be removed in a future version of p5.js.',
3800+
'p5.Vector.array'
3801+
);
37923802
return v.array();
37933803
}
37943804

0 commit comments

Comments
 (0)