Skip to content

Commit 6f12643

Browse files
committed
doc: use _Static method_ instead of _Class Method_
Our docs describe static methods as Class Methods which seems idiosyncratic for JavaScript. Align with MDN which calls them static methods. Refs: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Structures/API_references/What_does_an_API_reference_need JSON format for our docs will still use the key name `classMethods` for this. I would like to change it to `staticMethods` but I don't know if that will break things for consumers. So, leaving it alone. It's a machine-consumable label more than a human-readable so I can live with that. PR-URL: #34659 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 8825eb4 commit 6f12643

14 files changed

+43
-43
lines changed

doc/api/async_hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ class DBQuery extends AsyncResource {
729729
}
730730
```
731731

732-
#### Class Method: `AsyncResource.bind(fn[, type])`
732+
#### Static method: `AsyncResource.bind(fn[, type])`
733733
<!-- YAML
734734
added: REPLACEME
735735
-->

doc/api/buffer.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Additionally, the [`buf.values()`][], [`buf.keys()`][], and
284284
The `Buffer` class is a global type for dealing with binary data directly.
285285
It can be constructed in a variety of ways.
286286

287-
### Class Method: `Buffer.alloc(size[, fill[, encoding]])`
287+
### Static method: `Buffer.alloc(size[, fill[, encoding]])`
288288
<!-- YAML
289289
added: v5.10.0
290290
changes:
@@ -349,7 +349,7 @@ data that might not have been allocated for `Buffer`s.
349349

350350
A `TypeError` will be thrown if `size` is not a number.
351351

352-
### Class Method: `Buffer.allocUnsafe(size)`
352+
### Static method: `Buffer.allocUnsafe(size)`
353353
<!-- YAML
354354
added: v5.10.0
355355
changes:
@@ -398,7 +398,7 @@ pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
398398
difference is subtle but can be important when an application requires the
399399
additional performance that [`Buffer.allocUnsafe()`][] provides.
400400

401-
### Class Method: `Buffer.allocUnsafeSlow(size)`
401+
### Static method: `Buffer.allocUnsafeSlow(size)`
402402
<!-- YAML
403403
added: v5.12.0
404404
-->
@@ -446,7 +446,7 @@ socket.on('readable', () => {
446446

447447
A `TypeError` will be thrown if `size` is not a number.
448448

449-
### Class Method: `Buffer.byteLength(string[, encoding])`
449+
### Static method: `Buffer.byteLength(string[, encoding])`
450450
<!-- YAML
451451
added: v0.1.90
452452
changes:
@@ -485,7 +485,7 @@ When `string` is a `Buffer`/[`DataView`][]/[`TypedArray`][]/[`ArrayBuffer`][]/
485485
[`SharedArrayBuffer`][], the byte length as reported by `.byteLength`
486486
is returned.
487487

488-
### Class Method: `Buffer.compare(buf1, buf2)`
488+
### Static method: `Buffer.compare(buf1, buf2)`
489489
<!-- YAML
490490
added: v0.11.13
491491
changes:
@@ -513,7 +513,7 @@ console.log(arr.sort(Buffer.compare));
513513
// (This result is equal to: [buf2, buf1].)
514514
```
515515

516-
### Class Method: `Buffer.concat(list[, totalLength])`
516+
### Static method: `Buffer.concat(list[, totalLength])`
517517
<!-- YAML
518518
added: v0.7.11
519519
changes:
@@ -560,7 +560,7 @@ console.log(bufA.length);
560560
// Prints: 42
561561
```
562562

563-
### Class Method: `Buffer.from(array)`
563+
### Static method: `Buffer.from(array)`
564564
<!-- YAML
565565
added: v5.10.0
566566
-->
@@ -581,7 +581,7 @@ appropriate for `Buffer.from()` variants.
581581
`Buffer.from(array)` and [`Buffer.from(string)`][] may also use the internal
582582
`Buffer` pool like [`Buffer.allocUnsafe()`][] does.
583583

584-
### Class Method: `Buffer.from(arrayBuffer[, byteOffset[, length]])`
584+
### Static method: `Buffer.from(arrayBuffer[, byteOffset[, length]])`
585585
<!-- YAML
586586
added: v5.10.0
587587
-->
@@ -632,7 +632,7 @@ A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`][] or a
632632
[`SharedArrayBuffer`][] or another type appropriate for `Buffer.from()`
633633
variants.
634634

635-
### Class Method: `Buffer.from(buffer)`
635+
### Static method: `Buffer.from(buffer)`
636636
<!-- YAML
637637
added: v5.10.0
638638
-->
@@ -657,7 +657,7 @@ console.log(buf2.toString());
657657
A `TypeError` will be thrown if `buffer` is not a `Buffer` or another type
658658
appropriate for `Buffer.from()` variants.
659659

660-
### Class Method: `Buffer.from(object[, offsetOrEncoding[, length]])`
660+
### Static method: `Buffer.from(object[, offsetOrEncoding[, length]])`
661661
<!-- YAML
662662
added: v8.2.0
663663
-->
@@ -691,7 +691,7 @@ const buf = Buffer.from(new Foo(), 'utf8');
691691
A `TypeError` will be thrown if `object` does not have the mentioned methods or
692692
is not of another type appropriate for `Buffer.from()` variants.
693693

694-
### Class Method: `Buffer.from(string[, encoding])`
694+
### Static method: `Buffer.from(string[, encoding])`
695695
<!-- YAML
696696
added: v5.10.0
697697
-->
@@ -717,7 +717,7 @@ console.log(buf1.toString('latin1'));
717717
A `TypeError` will be thrown if `string` is not a string or another type
718718
appropriate for `Buffer.from()` variants.
719719

720-
### Class Method: `Buffer.isBuffer(obj)`
720+
### Static method: `Buffer.isBuffer(obj)`
721721
<!-- YAML
722722
added: v0.1.101
723723
-->
@@ -727,7 +727,7 @@ added: v0.1.101
727727

728728
Returns `true` if `obj` is a `Buffer`, `false` otherwise.
729729

730-
### Class Method: `Buffer.isEncoding(encoding)`
730+
### Static method: `Buffer.isEncoding(encoding)`
731731
<!-- YAML
732732
added: v0.9.1
733733
-->
@@ -3206,13 +3206,13 @@ introducing security vulnerabilities into an application.
32063206
[RFC 4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5
32073207
[WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/
32083208
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
3209-
[`Buffer.alloc()`]: #buffer_class_method_buffer_alloc_size_fill_encoding
3210-
[`Buffer.allocUnsafe()`]: #buffer_class_method_buffer_allocunsafe_size
3211-
[`Buffer.allocUnsafeSlow()`]: #buffer_class_method_buffer_allocunsafeslow_size
3212-
[`Buffer.from(array)`]: #buffer_class_method_buffer_from_array
3213-
[`Buffer.from(arrayBuf)`]: #buffer_class_method_buffer_from_arraybuffer_byteoffset_length
3214-
[`Buffer.from(buffer)`]: #buffer_class_method_buffer_from_buffer
3215-
[`Buffer.from(string)`]: #buffer_class_method_buffer_from_string_encoding
3209+
[`Buffer.alloc()`]: #buffer_static_method_buffer_alloc_size_fill_encoding
3210+
[`Buffer.allocUnsafe()`]: #buffer_static_method_buffer_allocunsafe_size
3211+
[`Buffer.allocUnsafeSlow()`]: #buffer_static_method_buffer_allocunsafeslow_size
3212+
[`Buffer.from(array)`]: #buffer_static_method_buffer_from_array
3213+
[`Buffer.from(arrayBuf)`]: #buffer_static_method_buffer_from_arraybuffer_byteoffset_length
3214+
[`Buffer.from(buffer)`]: #buffer_static_method_buffer_from_buffer
3215+
[`Buffer.from(string)`]: #buffer_static_method_buffer_from_string_encoding
32163216
[`Buffer.poolSize`]: #buffer_class_property_buffer_poolsize
32173217
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
32183218
[`ERR_INVALID_BUFFER_SIZE`]: errors.html#ERR_INVALID_BUFFER_SIZE

doc/api/crypto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
787787
// OK
788788
```
789789

790-
### Class Method: `ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])`
790+
### Static method: `ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])`
791791
<!-- YAML
792792
added: v10.0.0
793793
-->

doc/api/deprecations.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,10 +2778,10 @@ Type: Documentation-only
27782778

27792779
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
27802780
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
2781-
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
2782-
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
2783-
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
2784-
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
2781+
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_static_method_buffer_allocunsafeslow_size
2782+
[`Buffer.from(array)`]: buffer.html#buffer_static_method_buffer_from_array
2783+
[`Buffer.from(buffer)`]: buffer.html#buffer_static_method_buffer_from_buffer
2784+
[`Buffer.isBuffer()`]: buffer.html#buffer_static_method_buffer_isbuffer_obj
27852785
[`Cipher`]: crypto.html#crypto_class_cipher
27862786
[`Decipher`]: crypto.html#crypto_class_decipher
27872787
[`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname
@@ -2892,8 +2892,8 @@ Type: Documentation-only
28922892
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
28932893
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
28942894
[WHATWG URL API]: url.html#url_the_whatwg_url_api
2895-
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
2896-
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
2897-
[from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
2898-
[from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding
2895+
[alloc]: buffer.html#buffer_static_method_buffer_alloc_size_fill_encoding
2896+
[alloc_unsafe_size]: buffer.html#buffer_static_method_buffer_allocunsafe_size
2897+
[from_arraybuffer]: buffer.html#buffer_static_method_buffer_from_arraybuffer_byteoffset_length
2898+
[from_string_encoding]: buffer.html#buffer_static_method_buffer_from_string_encoding
28992899
[legacy `urlObject`]: url.html#url_legacy_urlobject

doc/api/dgram.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,4 +802,4 @@ and `udp6` sockets). The bound address and port can be retrieved using
802802
[`socket.bind()`]: #dgram_socket_bind_port_address_callback
803803
[IPv6 Zone Indices]: https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses
804804
[RFC 4007]: https://tools.ietf.org/html/rfc4007
805-
[byte length]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
805+
[byte length]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding

doc/api/fs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5879,7 +5879,7 @@ A call to `fs.ftruncate()` or `filehandle.truncate()` can be used to reset
58795879
the file contents.
58805880

58815881
[`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/
5882-
[`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
5882+
[`Buffer.byteLength`]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding
58835883
[`Buffer`]: buffer.html#buffer_buffer
58845884
[`FSEvents`]: https://developer.apple.com/documentation/coreservices/file_system_events
58855885
[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

doc/api/http.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ try {
26362636
[`'response'`]: #http_event_response
26372637
[`'upgrade'`]: #http_event_upgrade
26382638
[`Agent`]: #http_class_http_agent
2639-
[`Buffer.byteLength()`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
2639+
[`Buffer.byteLength()`]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding
26402640
[`Duplex`]: stream.html#stream_class_stream_duplex
26412641
[`HPE_HEADER_OVERFLOW`]: errors.html#errors_hpe_header_overflow
26422642
[`TypeError`]: errors.html#errors_class_typeerror

doc/api/util.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2414,7 +2414,7 @@ util.log('Timestamped message.');
24142414
[`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
24152415
[`ArrayBuffer.isView()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView
24162416
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
2417-
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
2417+
[`Buffer.isBuffer()`]: buffer.html#buffer_static_method_buffer_isbuffer_obj
24182418
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
24192419
[`Date`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
24202420
[`Error`]: errors.html#errors_class_error

doc/api/worker_threads.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ active handle in the event system. If the worker is already `unref()`ed calling
901901
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
902902
[`AsyncResource`]: async_hooks.html#async_hooks_class_asyncresource
903903
[`Buffer`]: buffer.html
904-
[`Buffer.allocUnsafe()`]: buffer.html#buffer_class_method_buffer_allocunsafe_size
904+
[`Buffer.allocUnsafe()`]: buffer.html#buffer_static_method_buffer_allocunsafe_size
905905
[`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: errors.html#errors_err_missing_message_port_in_transfer_list
906906
[`ERR_WORKER_NOT_RUNNING`]: errors.html#ERR_WORKER_NOT_RUNNING
907907
[`EventEmitter`]: events.html

test/doctool/test-doctool-html.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ const testData = [
6565
},
6666
{
6767
file: fixtures.path('order_of_end_tags_5873.md'),
68-
html: '<h3>ClassMethod: Buffer.from(array) <span> ' +
69-
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
70-
'id="foo_class_method_buffer_from_array">#</a> </span> </h3>' +
68+
html: '<h3>Static method: Buffer.from(array) <span> ' +
69+
'<a class="mark" href="#foo_static_method_buffer_from_array" ' +
70+
'id="foo_static_method_buffer_from_array">#</a> </span> </h3>' +
7171
'<ul><li><code>array</code><a ' +
7272
'href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
7373
'Reference/Global_Objects/Array" class="type">&#x3C;Array></a></li></ul>'

test/doctool/test-doctool-json.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const testData = [
6969
textRaw: 'Subsection',
7070
name: 'subsection',
7171
classMethods: [{
72-
textRaw: 'Class Method: Buffer.from(array)',
72+
textRaw: 'Static method: Buffer.from(array)',
7373
type: 'classMethod',
7474
name: 'from',
7575
signatures: [
@@ -181,7 +181,7 @@ const testData = [
181181
params: []
182182
}
183183
],
184-
textRaw: 'Class Method: `Fhqwhgads.again()`',
184+
textRaw: 'Static method: `Fhqwhgads.again()`',
185185
type: 'classMethod'
186186
}
187187
],

test/fixtures/doc_with_backticks_in_headings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
## Constructor: `new Fhqwhgads()`
1010

11-
## Class Method: `Fhqwhgads.again()`
11+
## Static method: `Fhqwhgads.again()`
1212

1313
## `Fqhqwhgads.fullName`

test/fixtures/order_of_end_tags_5873.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
## Subsection
44

5-
### Class Method: Buffer.from(array)
5+
### Static method: Buffer.from(array)
66
* `array` {Array}

tools/doc/json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ const r = String.raw;
436436
const eventPrefix = '^Event: +';
437437
const classPrefix = '^[Cc]lass: +';
438438
const ctorPrefix = '^(?:[Cc]onstructor: +)?`?new +';
439-
const classMethodPrefix = '^Class Method: +';
439+
const classMethodPrefix = '^Static method: +';
440440
const maybeClassPropertyPrefix = '(?:Class Property: +)?';
441441

442442
const maybeQuote = '[\'"]?';

0 commit comments

Comments
 (0)