Skip to content

Commit 9d7c238

Browse files
authored
Merge pull request #5598 from Zearin/issue-5139/utilities
docs(src/utilities): Use `describe()` instead of `@alt`
2 parents dcd4721 + 440ca42 commit 9d7c238

File tree

3 files changed

+20
-48
lines changed

3 files changed

+20
-48
lines changed

src/utilities/conversion.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ import p5 from '../core/main';
2424
* let str = '20';
2525
* let diameter = float(str);
2626
* ellipse(width / 2, height / 2, diameter, diameter);
27+
* describe('20-by-20 white ellipse in the center of the canvas');
2728
* </code></div>
2829
* <div class='norender'><code>
2930
* print(float('10.31')); // 10.31
3031
* print(float('Infinity')); // Infinity
3132
* print(float('-Infinity')); // -Infinity
3233
* </code></div>
33-
*
34-
* @alt
35-
* 20 by 20 white ellipse in the center of the canvas
3634
*/
3735
p5.prototype.float = function(str) {
3836
if (str instanceof Array) {

src/utilities/string_functions.js

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ import '../core/friendly_errors/fes_core';
2929
* let separator = ' ';
3030
* let message = join(array, separator);
3131
* text(message, 5, 50);
32+
* describe('“Hello world!” displayed middle left of canvas.');
3233
* </code>
3334
* </div>
34-
*
35-
* @alt
36-
* "hello world!" displayed middle left of canvas.
3735
*/
3836
p5.prototype.join = function(list, separator) {
3937
p5._validateParameters('join', arguments);
@@ -69,11 +67,9 @@ p5.prototype.join = function(list, separator) {
6967
* let regexp = 'p5js\\*';
7068
* let m = match(string, regexp);
7169
* text(m, 5, 50);
70+
* describe('“p5js*” displayed middle left of canvas.');
7271
* </code>
7372
* </div>
74-
*
75-
* @alt
76-
* "p5js*" displayed middle left of canvas.
7773
*/
7874
p5.prototype.match = function(str, reg) {
7975
p5._validateParameters('match', arguments);
@@ -166,12 +162,11 @@ p5.prototype.matchAll = function(str, reg) {
166162
* // Draw dividing line
167163
* stroke(120);
168164
* line(0, 50, width, 50);
165+
*
166+
* describe('“0321.00” middle top, “-1321.00” middle bottom canvas');
169167
* }
170168
* </code>
171169
* </div>
172-
*
173-
* @alt
174-
* "0321.00" middle top, -1321.00" middle bottom canvas
175170
*/
176171
/**
177172
* @method nf
@@ -249,12 +244,11 @@ function doNf(num, left, right) {
249244
* // Draw dividing line
250245
* stroke(120);
251246
* line(0, 50, width, 50);
247+
*
248+
* describe('“11,253,106.115” top middle and “1.00,1.00,2.00” displayed bottom mid');
252249
* }
253250
* </code>
254251
* </div>
255-
*
256-
* @alt
257-
* "11,253,106.115" top middle and "1.00,1.00,2.00" displayed bottom mid
258252
*/
259253
/**
260254
* @method nfc
@@ -326,12 +320,11 @@ function doNfc(num, right) {
326320
* // Draw dividing line
327321
* stroke(120);
328322
* line(0, 50, width, 50);
323+
*
324+
* describe('“+11253106.11” top middle and “-11253106.11” displayed bottom middle');
329325
* }
330326
* </code>
331327
* </div>
332-
*
333-
* @alt
334-
* "+11253106.11" top middle and "-11253106.11" displayed bottom middle
335328
*/
336329
/**
337330
* @method nfp
@@ -404,12 +397,11 @@ function addNfp(num) {
404397
* // Draw dividing line
405398
* stroke(120);
406399
* line(0, 50, width, 50);
400+
*
401+
* describe('“0321.00” top middle and “-1321.00” displayed bottom middle');
407402
* }
408403
* </code>
409404
* </div>
410-
*
411-
* @alt
412-
* "0321.00" top middle and "-1321.00" displayed bottom middle
413405
*/
414406
/**
415407
* @method nfs
@@ -454,11 +446,9 @@ function addNfs(num) {
454446
* text(splitString[0], 5, 30);
455447
* text(splitString[1], 5, 50);
456448
* text(splitString[2], 5, 70);
449+
* describe('“Pat” top left, “Xio” mid left, and “Alex” displayed bottom left');
457450
* </code>
458451
* </div>
459-
*
460-
* @alt
461-
* "pat" top left, "Xio" mid left and "Alex" displayed bottom left
462452
*/
463453
p5.prototype.split = function(str, delim) {
464454
p5._validateParameters('split', arguments);
@@ -532,11 +522,9 @@ p5.prototype.splitTokens = function(value, delims) {
532522
* <code>
533523
* let string = trim(' No new lines\n ');
534524
* text(string + ' here', 2, 50);
525+
* describe('“No new lines here” displayed center canvas');
535526
* </code>
536527
* </div>
537-
*
538-
* @alt
539-
* "No new lines here" displayed center canvas
540528
*/
541529
/**
542530
* @method trim

src/utilities/time_date.js

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ import p5 from '../core/main';
1818
* <code>
1919
* let d = day();
2020
* text('Current day: \n' + d, 5, 50);
21+
* describe('Current day is displayed');
2122
* </code>
2223
* </div>
23-
*
24-
* @alt
25-
* Current day is displayed
2624
*/
2725
p5.prototype.day = function() {
2826
return new Date().getDate();
@@ -39,11 +37,9 @@ p5.prototype.day = function() {
3937
* <code>
4038
* let h = hour();
4139
* text('Current hour:\n' + h, 5, 50);
40+
* describe('Current hour is displayed');
4241
* </code>
4342
* </div>
44-
*
45-
* @alt
46-
* Current hour is displayed
4743
*/
4844
p5.prototype.hour = function() {
4945
return new Date().getHours();
@@ -60,11 +56,9 @@ p5.prototype.hour = function() {
6056
* <code>
6157
* let m = minute();
6258
* text('Current minute: \n' + m, 5, 50);
59+
* describe('Current minute is displayed');
6360
* </code>
6461
* </div>
65-
*
66-
* @alt
67-
* Current minute is displayed
6862
*/
6963
p5.prototype.minute = function() {
7064
return new Date().getMinutes();
@@ -82,11 +76,9 @@ p5.prototype.minute = function() {
8276
* <code>
8377
* let millisecond = millis();
8478
* text('Milliseconds \nrunning: \n' + millisecond, 5, 40);
79+
* describe('number of milliseconds since sketch has started displayed');
8580
* </code>
8681
* </div>
87-
*
88-
* @alt
89-
* number of milliseconds since sketch has started displayed
9082
*/
9183
p5.prototype.millis = function() {
9284
if (this._millisStart === -1) {
@@ -108,11 +100,9 @@ p5.prototype.millis = function() {
108100
* <code>
109101
* let m = month();
110102
* text('Current month: \n' + m, 5, 50);
103+
* describe('Current month is displayed');
111104
* </code>
112105
* </div>
113-
*
114-
* @alt
115-
* Current month is displayed
116106
*/
117107
p5.prototype.month = function() {
118108
//January is 0!
@@ -130,11 +120,9 @@ p5.prototype.month = function() {
130120
* <code>
131121
* let s = second();
132122
* text('Current second: \n' + s, 5, 50);
123+
* describe('Current second is displayed');
133124
* </code>
134125
* </div>
135-
*
136-
* @alt
137-
* Current second is displayed
138126
*/
139127
p5.prototype.second = function() {
140128
return new Date().getSeconds();
@@ -151,11 +139,9 @@ p5.prototype.second = function() {
151139
* <code>
152140
* let y = year();
153141
* text('Current year: \n' + y, 5, 50);
142+
* describe('Current year is displayed');
154143
* </code>
155144
* </div>
156-
*
157-
* @alt
158-
* Current year is displayed
159145
*/
160146
p5.prototype.year = function() {
161147
return new Date().getFullYear();

0 commit comments

Comments
 (0)