| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e0b1f09 commit be241ba
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1683,7 +1683,7 @@ If no arguments are passed in at all `message` will be set to the string: | |||
| 1683 | 1683 | Be aware that in the `repl` the error message will be different to the one | |
| 1684 | 1684 | thrown in a file! See below for further details. | |
| 1685 | 1685 | ||
| 1686 | - <!-- eslint-skip --> | ||
| 1686 | + <!-- eslint-disable no-restricted-syntax --> | ||
| 1687 | 1687 | ||
| 1688 | 1688 | ```mjs | |
| 1689 | 1689 | import assert from 'node:assert/strict'; | |
@@ -1720,7 +1720,7 @@ assert.ok(0); | |||
| 1720 | 1720 | // assert.ok(0) | |
| 1721 | 1721 | ``` | |
| 1722 | 1722 | ||
| 1723 | - <!-- eslint-skip --> | ||
| 1723 | + <!-- eslint-disable no-restricted-syntax --> | ||
| 1724 | 1724 | ||
| 1725 | 1725 | ```cjs | |
| 1726 | 1726 | const assert = require('node:assert/strict'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -240,9 +240,7 @@ added: v8.3.0 | |||
| 240 | 240 | Maintains an internal counter specific to `label` and outputs to `stdout` the | |
| 241 | 241 | number of times `console.count()` has been called with the given `label`. | |
| 242 | 242 | ||
| 243 | - <!-- eslint-skip --> | ||
| 244 | - | ||
| 245 | - ```js | ||
| 243 | + ```console | ||
| 246 | 244 | > console.count() | |
| 247 | 245 | default: 1 | |
| 248 | 246 | undefined | |
@@ -274,9 +272,7 @@ added: v8.3.0 | |||
| 274 | 272 | ||
| 275 | 273 | Resets the internal counter specific to `label`. | |
| 276 | 274 | ||
| 277 | - <!-- eslint-skip --> | ||
| 278 | - | ||
| 279 | - ```js | ||
| 275 | + ```console | ||
| 280 | 276 | > console.count('abc'); | |
| 281 | 277 | abc: 1 | |
| 282 | 278 | undefined | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,8 +53,6 @@ try { | |||
| 53 | 53 | } | |
| 54 | 54 | ``` | |
| 55 | 55 | ||
| 56 | - <!-- eslint-enable no-global-assign --> | ||
| 57 | - | ||
| 58 | 56 | When using the lexical ESM `import` keyword, the error can only be | |
| 59 | 57 | caught if a handler for `process.on('uncaughtException')` is registered | |
| 60 | 58 | _before_ any attempt to load the module is made (using, for instance, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,14 +205,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], | |||
| 205 | 205 | that are currently configured for DNS resolution. A string will include a port | |
| 206 | 206 | section if a custom port is used. | |
| 207 | 207 | ||
| 208 | - <!-- eslint-disable @stylistic/js/semi--> | ||
| 209 | - | ||
| 210 | - ```js | ||
| 208 | + ```json | ||
| 211 | 209 | [ | |
| 212 | - '8.8.8.8', | ||
| 213 | - '2001:4860:4860::8888', | ||
| 214 | - '8.8.8.8:1053', | ||
| 215 | - '[2001:4860:4860::8888]:1053', | ||
| 210 | + "8.8.8.8", | ||
| 211 | + "2001:4860:4860::8888", | ||
| 212 | + "8.8.8.8:1053", | ||
| 213 | + "[2001:4860:4860::8888]:1053", | ||
| 216 | 214 | ] | |
| 217 | 215 | ``` | |
| 218 | 216 | ||
@@ -559,8 +557,6 @@ will be present on the object: | |||
| 559 | 557 | ||
| 560 | 558 | Here is an example of the `ret` object passed to the callback: | |
| 561 | 559 | ||
| 562 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 563 | - | ||
| 564 | 560 | ```js | |
| 565 | 561 | [ { type: 'A', address: '127.0.0.1', ttl: 299 }, | |
| 566 | 562 | { type: 'CNAME', value: 'example.com' }, | |
@@ -574,7 +570,7 @@ Here is an example of the `ret` object passed to the callback: | |||
| 574 | 570 | refresh: 900, | |
| 575 | 571 | retry: 900, | |
| 576 | 572 | expire: 1800, | |
| 577 | - minttl: 60 } ] | ||
| 573 | + minttl: 60 } ]; | ||
| 578 | 574 | ``` | |
| 579 | 575 | ||
| 580 | 576 | DNS server operators may choose not to respond to `ANY` | |
@@ -678,17 +674,15 @@ function will contain an array of objects with the following properties: | |||
| 678 | 674 | * `order` | |
| 679 | 675 | * `preference` | |
| 680 | 676 | ||
| 681 | - <!-- eslint-skip --> | ||
| 682 | - | ||
| 683 | 677 | ```js | |
| 684 | - { | ||
| 678 | + ({ | ||
| 685 | 679 | flags: 's', | |
| 686 | 680 | service: 'SIP+D2U', | |
| 687 | 681 | regexp: '', | |
| 688 | 682 | replacement: '_sip._udp.example.com', | |
| 689 | 683 | order: 30, | |
| 690 | - preference: 100 | ||
| 691 | - } | ||
| 684 | + preference: 100, | ||
| 685 | + }); | ||
| 692 | 686 | ``` | |
| 693 | 687 | ||
| 694 | 688 | ## `dns.resolveNs(hostname, callback)` | |
@@ -763,18 +757,16 @@ be an object with the following properties: | |||
| 763 | 757 | * `expire` | |
| 764 | 758 | * `minttl` | |
| 765 | 759 | ||
| 766 | - <!-- eslint-skip --> | ||
| 767 | - | ||
| 768 | 760 | ```js | |
| 769 | - { | ||
| 761 | + ({ | ||
| 770 | 762 | nsname: 'ns.example.com', | |
| 771 | 763 | hostmaster: 'root.example.com', | |
| 772 | 764 | serial: 2013101809, | |
| 773 | 765 | refresh: 10000, | |
| 774 | 766 | retry: 2400, | |
| 775 | 767 | expire: 604800, | |
| 776 | - minttl: 3600 | ||
| 777 | - } | ||
| 768 | + minttl: 3600, | ||
| 769 | + }); | ||
| 778 | 770 | ``` | |
| 779 | 771 | ||
| 780 | 772 | ## `dns.resolveSrv(hostname, callback)` | |
@@ -803,15 +795,13 @@ be an array of objects with the following properties: | |||
| 803 | 795 | * `port` | |
| 804 | 796 | * `name` | |
| 805 | 797 | ||
| 806 | - <!-- eslint-skip --> | ||
| 807 | - | ||
| 808 | 798 | ```js | |
| 809 | - { | ||
| 799 | + ({ | ||
| 810 | 800 | priority: 10, | |
| 811 | 801 | weight: 5, | |
| 812 | 802 | port: 21223, | |
| 813 | - name: 'service.example.com' | ||
| 814 | - } | ||
| 803 | + name: 'service.example.com', | ||
| 804 | + }); | ||
| 815 | 805 | ``` | |
| 816 | 806 | ||
| 817 | 807 | ## `dns.resolveTlsa(hostname, callback)` | |
@@ -840,15 +830,13 @@ array of objects with these properties: | |||
| 840 | 830 | * `match` | |
| 841 | 831 | * `data` | |
| 842 | 832 | ||
| 843 | - <!-- eslint-skip --> | ||
| 844 | - | ||
| 845 | 833 | ```js | |
| 846 | - { | ||
| 834 | + ({ | ||
| 847 | 835 | certUsage: 3, | |
| 848 | 836 | selector: 1, | |
| 849 | 837 | match: 1, | |
| 850 | - data: [ArrayBuffer] | ||
| 851 | - } | ||
| 838 | + data: [ArrayBuffer], | ||
| 839 | + }); | ||
| 852 | 840 | ``` | |
| 853 | 841 | ||
| 854 | 842 | ## `dns.resolveTxt(hostname, callback)` | |
@@ -1081,14 +1069,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], | |||
| 1081 | 1069 | that are currently configured for DNS resolution. A string will include a port | |
| 1082 | 1070 | section if a custom port is used. | |
| 1083 | 1071 | ||
| 1084 | - <!-- eslint-disable @stylistic/js/semi--> | ||
| 1085 | - | ||
| 1086 | - ```js | ||
| 1072 | + ```json | ||
| 1087 | 1073 | [ | |
| 1088 | - '8.8.8.8', | ||
| 1089 | - '2001:4860:4860::8888', | ||
| 1090 | - '8.8.8.8:1053', | ||
| 1091 | - '[2001:4860:4860::8888]:1053', | ||
| 1074 | + "8.8.8.8", | ||
| 1075 | + "2001:4860:4860::8888", | ||
| 1076 | + "8.8.8.8:1053", | ||
| 1077 | + "[2001:4860:4860::8888]:1053" | ||
| 1092 | 1078 | ] | |
| 1093 | 1079 | ``` | |
| 1094 | 1080 | ||
@@ -1329,8 +1315,6 @@ present on the object: | |||
| 1329 | 1315 | ||
| 1330 | 1316 | Here is an example of the result object: | |
| 1331 | 1317 | ||
| 1332 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 1333 | - | ||
| 1334 | 1318 | ```js | |
| 1335 | 1319 | [ { type: 'A', address: '127.0.0.1', ttl: 299 }, | |
| 1336 | 1320 | { type: 'CNAME', value: 'example.com' }, | |
@@ -1344,7 +1328,7 @@ Here is an example of the result object: | |||
| 1344 | 1328 | refresh: 900, | |
| 1345 | 1329 | retry: 900, | |
| 1346 | 1330 | expire: 1800, | |
| 1347 | - minttl: 60 } ] | ||
| 1331 | + minttl: 60 } ]; | ||
| 1348 | 1332 | ``` | |
| 1349 | 1333 | ||
| 1350 | 1334 | ### `dnsPromises.resolveCaa(hostname)` | |
@@ -1407,17 +1391,15 @@ of objects with the following properties: | |||
| 1407 | 1391 | * `order` | |
| 1408 | 1392 | * `preference` | |
| 1409 | 1393 | ||
| 1410 | - <!-- eslint-skip --> | ||
| 1411 | - | ||
| 1412 | 1394 | ```js | |
| 1413 | - { | ||
| 1395 | + ({ | ||
| 1414 | 1396 | flags: 's', | |
| 1415 | 1397 | service: 'SIP+D2U', | |
| 1416 | 1398 | regexp: '', | |
| 1417 | 1399 | replacement: '_sip._udp.example.com', | |
| 1418 | 1400 | order: 30, | |
| 1419 | - preference: 100 | ||
| 1420 | - } | ||
| 1401 | + preference: 100, | ||
| 1402 | + }); | ||
| 1421 | 1403 | ``` | |
| 1422 | 1404 | ||
| 1423 | 1405 | ### `dnsPromises.resolveNs(hostname)` | |
@@ -1465,18 +1447,16 @@ following properties: | |||
| 1465 | 1447 | * `expire` | |
| 1466 | 1448 | * `minttl` | |
| 1467 | 1449 | ||
| 1468 | - <!-- eslint-skip --> | ||
| 1469 | - | ||
| 1470 | 1450 | ```js | |
| 1471 | - { | ||
| 1451 | + ({ | ||
| 1472 | 1452 | nsname: 'ns.example.com', | |
| 1473 | 1453 | hostmaster: 'root.example.com', | |
| 1474 | 1454 | serial: 2013101809, | |
| 1475 | 1455 | refresh: 10000, | |
| 1476 | 1456 | retry: 2400, | |
| 1477 | 1457 | expire: 604800, | |
| 1478 | - minttl: 3600 | ||
| 1479 | - } | ||
| 1458 | + minttl: 3600, | ||
| 1459 | + }); | ||
| 1480 | 1460 | ``` | |
| 1481 | 1461 | ||
| 1482 | 1462 | ### `dnsPromises.resolveSrv(hostname)` | |
@@ -1496,15 +1476,13 @@ the following properties: | |||
| 1496 | 1476 | * `port` | |
| 1497 | 1477 | * `name` | |
| 1498 | 1478 | ||
| 1499 | - <!-- eslint-skip --> | ||
| 1500 | - | ||
| 1501 | 1479 | ```js | |
| 1502 | - { | ||
| 1480 | + ({ | ||
| 1503 | 1481 | priority: 10, | |
| 1504 | 1482 | weight: 5, | |
| 1505 | 1483 | port: 21223, | |
| 1506 | - name: 'service.example.com' | ||
| 1507 | - } | ||
| 1484 | + name: 'service.example.com', | ||
| 1485 | + }); | ||
| 1508 | 1486 | ``` | |
| 1509 | 1487 | ||
| 1510 | 1488 | ### `dnsPromises.resolveTlsa(hostname)` | |
@@ -1526,15 +1504,13 @@ with these properties: | |||
| 1526 | 1504 | * `match` | |
| 1527 | 1505 | * `data` | |
| 1528 | 1506 | ||
| 1529 | - <!-- eslint-skip --> | ||
| 1530 | - | ||
| 1531 | 1507 | ```js | |
| 1532 | - { | ||
| 1508 | + ({ | ||
| 1533 | 1509 | certUsage: 3, | |
| 1534 | 1510 | selector: 1, | |
| 1535 | 1511 | match: 1, | |
| 1536 | - data: [ArrayBuffer] | ||
| 1537 | - } | ||
| 1512 | + data: [ArrayBuffer], | ||
| 1513 | + }); | ||
| 1538 | 1514 | ``` | |
| 1539 | 1515 | ||
| 1540 | 1516 | ### `dnsPromises.resolveTxt(hostname)` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -569,8 +569,6 @@ console.log(cjs === cjsSugar); | |||
| 569 | 569 | This Module Namespace Exotic Object can be directly observed either when using | |
| 570 | 570 | `import * as m from 'cjs'` or a dynamic import: | |
| 571 | 571 | ||
| 572 | - <!-- eslint-skip --> | ||
| 573 | - | ||
| 574 | 572 | ```js | |
| 575 | 573 | import * as m from 'cjs'; | |
| 576 | 574 | console.log(m); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,15 +39,13 @@ property, which is an array of `[key, value, key2, value2, ...]`. For | |||
| 39 | 39 | example, the previous message header object might have a `rawHeaders` | |
| 40 | 40 | list like the following: | |
| 41 | 41 | ||
| 42 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 43 | - | ||
| 44 | - ```js | ||
| 45 | - [ 'ConTent-Length', '123456', | ||
| 46 | - 'content-LENGTH', '123', | ||
| 47 | - 'content-type', 'text/plain', | ||
| 48 | - 'CONNECTION', 'keep-alive', | ||
| 49 | - 'Host', 'example.com', | ||
| 50 | - 'accepT', '*/*' ] | ||
| 42 | + ```json | ||
| 43 | + [ "ConTent-Length", "123456", | ||
| 44 | + "content-LENGTH", "123", | ||
| 45 | + "content-type", "text/plain", | ||
| 46 | + "CONNECTION", "keep-alive", | ||
| 47 | + "Host", "example.com", | ||
| 48 | + "accepT", "*/*" ] | ||
| 51 | 49 | ``` | |
| 52 | 50 | ||
| 53 | 51 | ## Class: `http.Agent` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4289,10 +4289,8 @@ Accept: text/plain | |||
| 4289 | 4289 | ||
| 4290 | 4290 | Then `request.url` will be: | |
| 4291 | 4291 | ||
| 4292 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 4293 | - | ||
| 4294 | - ```js | ||
| 4295 | - '/status?name=ryan' | ||
| 4292 | + ```json | ||
| 4293 | + "/status?name=ryan" | ||
| 4296 | 4294 | ``` | |
| 4297 | 4295 | ||
| 4298 | 4296 | To parse the url into its parts, `new URL()` can be used: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1118,21 +1118,17 @@ export async function load(url, context, nextLoad) { | |||
| 1118 | 1118 | Unlike synchronous hooks, the asynchronous hooks would not run for these modules loaded in the file | |
| 1119 | 1119 | that calls `register()`: | |
| 1120 | 1120 | ||
| 1121 | - <!-- eslint-disable no-restricted-globals --> | ||
| 1122 | - | ||
| 1123 | 1121 | ```mjs | |
| 1124 | 1122 | // register-hooks.js | |
| 1125 | 1123 | import { register, createRequire } from 'node:module'; | |
| 1126 | 1124 | register('./hooks.mjs', import.meta.url); | |
| 1127 | 1125 | ||
| 1128 | 1126 | // Asynchronous hooks does not affect modules loaded via custom require() | |
| 1129 | 1127 | // functions created by module.createRequire(). | |
| 1130 | - const userRequire = createRequire(__filename); | ||
| 1128 | + const userRequire = createRequire(import.meta.filename); | ||
| 1131 | 1129 | userRequire('./my-app-2.cjs'); // Hooks won't affect this | |
| 1132 | 1130 | ``` | |
| 1133 | 1131 | ||
| 1134 | - <!-- eslint-enable no-restricted-globals --> | ||
| 1135 | - | ||
| 1136 | 1132 | ```cjs | |
| 1137 | 1133 | // register-hooks.js | |
| 1138 | 1134 | const { register, createRequire } = require('node:module'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,8 +261,6 @@ the default export in the `.default` property, similar to the results returned b | |||
| 261 | 261 | To customize what should be returned by `require(esm)` directly, the ES Module can export the | |
| 262 | 262 | desired value using the string name `"module.exports"`. | |
| 263 | 263 | ||
| 264 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 265 | - | ||
| 266 | 264 | ```mjs | |
| 267 | 265 | // point.mjs | |
| 268 | 266 | export default class Point { | |
@@ -272,7 +270,7 @@ export default class Point { | |||
| 272 | 270 | // `distance` is lost to CommonJS consumers of this module, unless it's | |
| 273 | 271 | // added to `Point` as a static property. | |
| 274 | 272 | export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); } | |
| 275 | - export { Point as 'module.exports' } | ||
| 273 | + export { Point as 'module.exports' }; | ||
| 276 | 274 | ``` | |
| 277 | 275 | ||
| 278 | 276 | <!-- eslint-disable node-core/no-duplicate-requires --> | |
@@ -292,8 +290,6 @@ named exports, the module can make sure that the default export is an object wit | |||
| 292 | 290 | named exports attached to it as properties. For example with the example above, | |
| 293 | 291 | `distance` can be attached to the default export, the `Point` class, as a static method. | |
| 294 | 292 | ||
| 295 | - <!-- eslint-disable @stylistic/js/semi --> | ||
| 296 | - | ||
| 297 | 293 | ```mjs | |
| 298 | 294 | export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); } | |
| 299 | 295 | ||
@@ -302,7 +298,7 @@ export default class Point { | |||
| 302 | 298 | static distance = distance; | |
| 303 | 299 | } | |
| 304 | 300 | ||
| 305 | - export { Point as 'module.exports' } | ||
| 301 | + export { Point as 'module.exports' }; | ||
| 306 | 302 | ``` | |
| 307 | 303 | ||
| 308 | 304 | <!-- eslint-disable node-core/no-duplicate-requires --> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments