Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14d4bfa

Browse filesBrowse files
Trottaddaleax
authored andcommitted
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 <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent d05f615 commit 14d4bfa
Copy full SHA for 14d4bfa

File tree

Expand file treeCollapse file tree

14 files changed

+43
-43
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

14 files changed

+43
-43
lines changed
Open diff view settings
Collapse file

‎doc/api/async_hooks.md‎

Copy file name to clipboardExpand all lines: doc/api/async_hooks.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ class DBQuery extends AsyncResource {
733733
}
734734
```
735735

736-
#### Class Method: `AsyncResource.bind(fn[, type])`
736+
#### Static method: `AsyncResource.bind(fn[, type])`
737737
<!-- YAML
738738
added: REPLACEME
739739
-->
Collapse file

‎doc/api/buffer.md‎

Copy file name to clipboardExpand all lines: doc/api/buffer.md
+20-20Lines changed: 20 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
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
-->
@@ -3198,13 +3198,13 @@ introducing security vulnerabilities into an application.
31983198
[RFC 4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5
31993199
[WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/
32003200
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
3201-
[`Buffer.alloc()`]: #buffer_class_method_buffer_alloc_size_fill_encoding
3202-
[`Buffer.allocUnsafe()`]: #buffer_class_method_buffer_allocunsafe_size
3203-
[`Buffer.allocUnsafeSlow()`]: #buffer_class_method_buffer_allocunsafeslow_size
3204-
[`Buffer.from(array)`]: #buffer_class_method_buffer_from_array
3205-
[`Buffer.from(arrayBuf)`]: #buffer_class_method_buffer_from_arraybuffer_byteoffset_length
3206-
[`Buffer.from(buffer)`]: #buffer_class_method_buffer_from_buffer
3207-
[`Buffer.from(string)`]: #buffer_class_method_buffer_from_string_encoding
3201+
[`Buffer.alloc()`]: #buffer_static_method_buffer_alloc_size_fill_encoding
3202+
[`Buffer.allocUnsafe()`]: #buffer_static_method_buffer_allocunsafe_size
3203+
[`Buffer.allocUnsafeSlow()`]: #buffer_static_method_buffer_allocunsafeslow_size
3204+
[`Buffer.from(array)`]: #buffer_static_method_buffer_from_array
3205+
[`Buffer.from(arrayBuf)`]: #buffer_static_method_buffer_from_arraybuffer_byteoffset_length
3206+
[`Buffer.from(buffer)`]: #buffer_static_method_buffer_from_buffer
3207+
[`Buffer.from(string)`]: #buffer_static_method_buffer_from_string_encoding
32083208
[`Buffer.poolSize`]: #buffer_class_property_buffer_poolsize
32093209
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
32103210
[`ERR_INVALID_BUFFER_SIZE`]: errors.html#ERR_INVALID_BUFFER_SIZE
Collapse file

‎doc/api/crypto.md‎

Copy file name to clipboardExpand all lines: doc/api/crypto.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
786786
// OK
787787
```
788788

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

‎doc/api/deprecations.md‎

Copy file name to clipboardExpand all lines: doc/api/deprecations.md
+8-8Lines changed: 8 additions & 8 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2598,10 +2598,10 @@ const moduleParents = Object.values(require.cache)
25982598
[`--http-parser=legacy`]: cli.html#cli_http_parser_library
25992599
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
26002600
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
2601-
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
2602-
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
2603-
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
2604-
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
2601+
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_static_method_buffer_allocunsafeslow_size
2602+
[`Buffer.from(array)`]: buffer.html#buffer_static_method_buffer_from_array
2603+
[`Buffer.from(buffer)`]: buffer.html#buffer_static_method_buffer_from_buffer
2604+
[`Buffer.isBuffer()`]: buffer.html#buffer_static_method_buffer_isbuffer_obj
26052605
[`Cipher`]: crypto.html#crypto_class_cipher
26062606
[`Decipher`]: crypto.html#crypto_class_decipher
26072607
[`EventEmitter.listenerCount(emitter, eventName)`]: events.html#events_eventemitter_listenercount_emitter_eventname
@@ -2702,8 +2702,8 @@ const moduleParents = Object.values(require.cache)
27022702
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
27032703
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
27042704
[WHATWG URL API]: url.html#url_the_whatwg_url_api
2705-
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
2706-
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
2707-
[from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
2708-
[from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding
2705+
[alloc]: buffer.html#buffer_static_method_buffer_alloc_size_fill_encoding
2706+
[alloc_unsafe_size]: buffer.html#buffer_static_method_buffer_allocunsafe_size
2707+
[from_arraybuffer]: buffer.html#buffer_static_method_buffer_from_arraybuffer_byteoffset_length
2708+
[from_string_encoding]: buffer.html#buffer_static_method_buffer_from_string_encoding
27092709
[legacy `urlObject`]: url.html#url_legacy_urlobject
Collapse file

‎doc/api/dgram.md‎

Copy file name to clipboardExpand all lines: doc/api/dgram.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -798,4 +798,4 @@ and `udp6` sockets). The bound address and port can be retrieved using
798798
[`socket.bind()`]: #dgram_socket_bind_port_address_callback
799799
[IPv6 Zone Indices]: https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses
800800
[RFC 4007]: https://tools.ietf.org/html/rfc4007
801-
[byte length]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
801+
[byte length]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -5710,7 +5710,7 @@ A call to `fs.ftruncate()` or `filehandle.truncate()` can be used to reset
57105710
the file contents.
57115711

57125712
[`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/
5713-
[`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
5713+
[`Buffer.byteLength`]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding
57145714
[`Buffer`]: buffer.html#buffer_buffer
57155715
[`FSEvents`]: https://developer.apple.com/documentation/coreservices/file_system_events
57165716
[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,7 @@ not abort the request or do anything besides add a `'timeout'` event.
23922392
[`'response'`]: #http_event_response
23932393
[`'upgrade'`]: #http_event_upgrade
23942394
[`Agent`]: #http_class_http_agent
2395-
[`Buffer.byteLength()`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding
2395+
[`Buffer.byteLength()`]: buffer.html#buffer_static_method_buffer_bytelength_string_encoding
23962396
[`Duplex`]: stream.html#stream_class_stream_duplex
23972397
[`TypeError`]: errors.html#errors_class_typeerror
23982398
[`URL`]: url.html#url_the_whatwg_url_api
Collapse file

‎doc/api/util.md‎

Copy file name to clipboardExpand all lines: doc/api/util.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ util.log('Timestamped message.');
23992399
[`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
24002400
[`ArrayBuffer.isView()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView
24012401
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
2402-
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
2402+
[`Buffer.isBuffer()`]: buffer.html#buffer_static_method_buffer_isbuffer_obj
24032403
[`DataView`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
24042404
[`Date`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
24052405
[`Error`]: errors.html#errors_class_error
Collapse file

‎doc/api/worker_threads.md‎

Copy file name to clipboardExpand all lines: doc/api/worker_threads.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ active handle in the event system. If the worker is already `unref()`ed calling
801801
[`'exit'` event]: #worker_threads_event_exit
802802
[`AsyncResource`]: async_hooks.html#async_hooks_class_asyncresource
803803
[`Buffer`]: buffer.html
804-
[`Buffer.allocUnsafe()`]: buffer.html#buffer_class_method_buffer_allocunsafe_size
804+
[`Buffer.allocUnsafe()`]: buffer.html#buffer_static_method_buffer_allocunsafe_size
805805
[`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: errors.html#errors_err_missing_message_port_in_transfer_list
806806
[`ERR_WORKER_NOT_RUNNING`]: errors.html#ERR_WORKER_NOT_RUNNING
807807
[`EventEmitter`]: events.html
Collapse file

‎test/doctool/test-doctool-html.js‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ function toHTML({ input, filename, nodeVersion, versions }) {
6060
const testData = [
6161
{
6262
file: fixtures.path('order_of_end_tags_5873.md'),
63-
html: '<h3>ClassMethod: Buffer.from(array) <span> ' +
64-
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
65-
'id="foo_class_method_buffer_from_array">#</a> </span> </h3>' +
63+
html: '<h3>Static method: Buffer.from(array) <span> ' +
64+
'<a class="mark" href="#foo_static_method_buffer_from_array" ' +
65+
'id="foo_static_method_buffer_from_array">#</a> </span> </h3>' +
6666
'<ul><li><code>array</code><a ' +
6767
'href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
6868
'Reference/Global_Objects/Array" class="type">&#x3C;Array></a></li></ul>'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.