GeezerVison is showing github.com — lib: move kEnumerableProperty to internal/util · nodejs/node@5ede458
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/abort_controller.js +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,6 +25,7 @@ const { | 25 | 25 | } = require('internal/event_target'); | 26 | 26 | const { | 27 | 27 | customInspectSymbol, | | 28 | + kEnumerableProperty, | 28 | 29 | } = require('internal/util'); | 29 | 30 | const { inspect } = require('internal/util/inspect'); | 30 | 31 | const { | @@ -260,7 +261,7 @@ function ClonedAbortSignal() { | 260 | 261 | ClonedAbortSignal.prototype[kDeserialize] = () => {}; | 261 | 262 |
| 262 | 263 | ObjectDefineProperties(AbortSignal.prototype, { | 263 | | - aborted: { enumerable: true } | | 264 | + aborted: kEnumerableProperty, | 264 | 265 | }); | 265 | 266 |
| 266 | 267 | ObjectDefineProperty(AbortSignal.prototype, SymbolToStringTag, { | @@ -329,8 +330,8 @@ class AbortController { | 329 | 330 | } | 330 | 331 |
| 331 | 332 | ObjectDefineProperties(AbortController.prototype, { | 332 | | - signal: { enumerable: true }, | 333 | | - abort: { enumerable: true } | | 333 | + signal: kEnumerableProperty, | | 334 | + abort: kEnumerableProperty, | 334 | 335 | }); | 335 | 336 |
| 336 | 337 | ObjectDefineProperty(AbortController.prototype, SymbolToStringTag, { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/crypto/webcrypto.js +2-5Lines changed: 2 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | JSONParse, | 6 | 6 | JSONStringify, | 7 | 7 | ObjectDefineProperties, | 8 | | - ObjectGetOwnPropertyDescriptor, | 9 | 8 | SafeSet, | 10 | 9 | SymbolToStringTag, | 11 | 10 | StringPrototypeRepeat, | @@ -60,6 +59,7 @@ const { | 60 | 59 | } = require('internal/crypto/util'); | 61 | 60 |
| 62 | 61 | const { | | 62 | + kEnumerableProperty, | 63 | 63 | lazyDOMException, | 64 | 64 | } = require('internal/util'); | 65 | 65 |
| @@ -703,10 +703,7 @@ ObjectDefineProperties( | 703 | 703 | writable: false, | 704 | 704 | value: 'Crypto', | 705 | 705 | }, | 706 | | - subtle: { | 707 | | - ...ObjectGetOwnPropertyDescriptor(Crypto.prototype, 'subtle'), | 708 | | - enumerable: true, | 709 | | - }, | | 706 | + subtle: kEnumerableProperty, | 710 | 707 | getRandomValues: { | 711 | 708 | enumerable: true, | 712 | 709 | configurable: true, | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/encoding.js +6-5Lines changed: 6 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,7 +30,8 @@ const kEncoder = Symbol('encoder'); | 30 | 30 |
| 31 | 31 | const { | 32 | 32 | getConstructorOf, | 33 | | - customInspectSymbol: inspect | | 33 | + customInspectSymbol: inspect, | | 34 | + kEnumerableProperty, | 34 | 35 | } = require('internal/util'); | 35 | 36 |
| 36 | 37 | const { | @@ -358,9 +359,9 @@ class TextEncoder { | 358 | 359 |
| 359 | 360 | ObjectDefineProperties( | 360 | 361 | TextEncoder.prototype, { | 361 | | - 'encode': { enumerable: true }, | 362 | | - 'encodeInto': { enumerable: true }, | 363 | | - 'encoding': { enumerable: true }, | | 362 | + 'encode': kEnumerableProperty, | | 363 | + 'encodeInto': kEnumerableProperty, | | 364 | + 'encoding': kEnumerableProperty, | 364 | 365 | [SymbolToStringTag]: { configurable: true, value: 'TextEncoder' }, | 365 | 366 | }); | 366 | 367 |
| @@ -569,7 +570,7 @@ ObjectDefineProperties( | 569 | 570 | ); | 570 | 571 |
| 571 | 572 | ObjectDefineProperties(TextDecoder.prototype, { | 572 | | - decode: { enumerable: true }, | | 573 | + decode: kEnumerableProperty, | 573 | 574 | [inspect]: { enumerable: false }, | 574 | 575 | [SymbolToStringTag]: { | 575 | 576 | configurable: true, | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/event_target.js +1-5Lines changed: 1 addition & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | FunctionPrototypeCall, | 9 | 9 | NumberIsInteger, | 10 | 10 | ObjectAssign, | 11 | | - ObjectCreate, | 12 | 11 | ObjectDefineProperties, | 13 | 12 | ObjectDefineProperty, | 14 | 13 | ObjectGetOwnPropertyDescriptor, | @@ -36,7 +35,7 @@ const { | 36 | 35 | } = require('internal/errors'); | 37 | 36 | const { validateObject, validateString } = require('internal/validators'); | 38 | 37 |
| 39 | | -const { customInspectSymbol } = require('internal/util'); | | 38 | +const { customInspectSymbol, kEnumerableProperty } = require('internal/util'); | 40 | 39 | const { inspect } = require('util'); | 41 | 40 |
| 42 | 41 | const kIsEventTarget = SymbolFor('nodejs.event_target'); | @@ -298,9 +297,6 @@ class Event { | 298 | 297 | static BUBBLING_PHASE = 3; | 299 | 298 | } | 300 | 299 |
| 301 | | -const kEnumerableProperty = ObjectCreate(null); | 302 | | -kEnumerableProperty.enumerable = true; | 303 | | - | 304 | 300 | ObjectDefineProperties( | 305 | 301 | Event.prototype, { | 306 | 302 | [SymbolToStringTag]: { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/url.js +27-26Lines changed: 27 additions & 26 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,6 +43,7 @@ const { | 43 | 43 | getConstructorOf, | 44 | 44 | removeColors, | 45 | 45 | toUSVString, | | 46 | + kEnumerableProperty, | 46 | 47 | } = require('internal/util'); | 47 | 48 |
| 48 | 49 | const { | @@ -517,18 +518,18 @@ class URLSearchParams { | 517 | 518 | } | 518 | 519 |
| 519 | 520 | ObjectDefineProperties(URLSearchParams.prototype, { | 520 | | - append: { enumerable: true }, | 521 | | - delete: { enumerable: true }, | 522 | | - get: { enumerable: true }, | 523 | | - getAll: { enumerable: true }, | 524 | | - has: { enumerable: true }, | 525 | | - set: { enumerable: true }, | 526 | | - sort: { enumerable: true }, | 527 | | - entries: { enumerable: true }, | 528 | | - forEach: { enumerable: true }, | 529 | | - keys: { enumerable: true }, | 530 | | - values: { enumerable: true }, | 531 | | - toString: { enumerable: true }, | | 521 | + append: kEnumerableProperty, | | 522 | + delete: kEnumerableProperty, | | 523 | + get: kEnumerableProperty, | | 524 | + getAll: kEnumerableProperty, | | 525 | + has: kEnumerableProperty, | | 526 | + set: kEnumerableProperty, | | 527 | + sort: kEnumerableProperty, | | 528 | + entries: kEnumerableProperty, | | 529 | + forEach: kEnumerableProperty, | | 530 | + keys: kEnumerableProperty, | | 531 | + values: kEnumerableProperty, | | 532 | + toString: kEnumerableProperty, | 532 | 533 | [SymbolToStringTag]: { configurable: true, value: 'URLSearchParams' }, | 533 | 534 |
| 534 | 535 | // https://heycam.github.io/webidl/#es-iterable-entries | @@ -1044,20 +1045,20 @@ class URL { | 1044 | 1045 | ObjectDefineProperties(URL.prototype, { | 1045 | 1046 | [kFormat]: { configurable: false, writable: false }, | 1046 | 1047 | [SymbolToStringTag]: { configurable: true, value: 'URL' }, | 1047 | | - toString: { enumerable: true }, | 1048 | | - href: { enumerable: true }, | 1049 | | - origin: { enumerable: true }, | 1050 | | - protocol: { enumerable: true }, | 1051 | | - username: { enumerable: true }, | 1052 | | - password: { enumerable: true }, | 1053 | | - host: { enumerable: true }, | 1054 | | - hostname: { enumerable: true }, | 1055 | | - port: { enumerable: true }, | 1056 | | - pathname: { enumerable: true }, | 1057 | | - search: { enumerable: true }, | 1058 | | - searchParams: { enumerable: true }, | 1059 | | - hash: { enumerable: true }, | 1060 | | - toJSON: { enumerable: true }, | | 1048 | + toString: kEnumerableProperty, | | 1049 | + href: kEnumerableProperty, | | 1050 | + origin: kEnumerableProperty, | | 1051 | + protocol: kEnumerableProperty, | | 1052 | + username: kEnumerableProperty, | | 1053 | + password: kEnumerableProperty, | | 1054 | + host: kEnumerableProperty, | | 1055 | + hostname: kEnumerableProperty, | | 1056 | + port: kEnumerableProperty, | | 1057 | + pathname: kEnumerableProperty, | | 1058 | + search: kEnumerableProperty, | | 1059 | + searchParams: kEnumerableProperty, | | 1060 | + hash: kEnumerableProperty, | | 1061 | + toJSON: kEnumerableProperty, | 1061 | 1062 | }); | 1062 | 1063 |
| 1063 | 1064 | function update(url, params) { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util.js +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -477,6 +477,9 @@ const lazyDOMException = hideStackFrames((message, name) => { | 477 | 477 | return new _DOMException(message, name); | 478 | 478 | }); | 479 | 479 |
| | 480 | +const kEnumerableProperty = ObjectCreate(null); | | 481 | +kEnumerableProperty.enumerable = true; | | 482 | + | 480 | 483 | module.exports = { | 481 | 484 | assertCrypto, | 482 | 485 | cachedResult, | @@ -513,5 +516,7 @@ module.exports = { | 513 | 516 | // Used by the buffer module to capture an internal reference to the | 514 | 517 | // default isEncoding implementation, just in case userland overrides it. | 515 | 518 | kIsEncodingSymbol: Symbol('kIsEncodingSymbol'), | 516 | | - kVmBreakFirstLineSymbol: Symbol('kVmBreakFirstLineSymbol') | | 519 | + kVmBreakFirstLineSymbol: Symbol('kVmBreakFirstLineSymbol'), | | 520 | + | | 521 | + kEnumerableProperty, | 517 | 522 | }; |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/compression.js +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,13 +16,11 @@ const { | 16 | 16 | newReadableWritablePairFromDuplex, | 17 | 17 | } = require('internal/webstreams/adapters'); | 18 | 18 |
| 19 | | -const { | 20 | | - customInspect, | 21 | | - kEnumerableProperty, | 22 | | -} = require('internal/webstreams/util'); | | 19 | +const { customInspect } = require('internal/webstreams/util'); | 23 | 20 |
| 24 | 21 | const { | 25 | 22 | customInspectSymbol: kInspect, | | 23 | + kEnumerableProperty, | 26 | 24 | } = require('internal/util'); | 27 | 25 |
| 28 | 26 | let zlib; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/encoding.js +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,10 +14,7 @@ const { | 14 | 14 | TransformStream, | 15 | 15 | } = require('internal/webstreams/transformstream'); | 16 | 16 |
| 17 | | -const { | 18 | | - customInspect, | 19 | | - kEnumerableProperty, | 20 | | -} = require('internal/webstreams/util'); | | 17 | +const { customInspect } = require('internal/webstreams/util'); | 21 | 18 |
| 22 | 19 | const { | 23 | 20 | codes: { | @@ -26,7 +23,8 @@ const { | 26 | 23 | } = require('internal/errors'); | 27 | 24 |
| 28 | 25 | const { | 29 | | - customInspectSymbol: kInspect | | 26 | + customInspectSymbol: kInspect, | | 27 | + kEnumerableProperty, | 30 | 28 | } = require('internal/util'); | 31 | 29 |
| 32 | 30 | const kHandle = Symbol('kHandle'); | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/queuingstrategies.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,14 +14,14 @@ const { | 14 | 14 |
| 15 | 15 | const { | 16 | 16 | customInspectSymbol: kInspect, | | 17 | + kEnumerableProperty, | 17 | 18 | } = require('internal/util'); | 18 | 19 |
| 19 | 20 | const { | 20 | 21 | customInspect, | 21 | 22 | isBrandCheck, | 22 | 23 | kType, | 23 | 24 | kState, | 24 | | - kEnumerableProperty, | 25 | 25 | } = require('internal/webstreams/util'); | 26 | 26 |
| 27 | 27 | const { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/readablestream.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,6 +50,7 @@ const { | 50 | 50 | const { | 51 | 51 | createDeferredPromise, | 52 | 52 | customInspectSymbol: kInspect, | | 53 | + kEnumerableProperty, | 53 | 54 | } = require('internal/util'); | 54 | 55 |
| 55 | 56 | const { | @@ -109,7 +110,6 @@ const { | 109 | 110 | nonOpStart, | 110 | 111 | kType, | 111 | 112 | kState, | 112 | | - kEnumerableProperty, | 113 | 113 | } = require('internal/webstreams/util'); | 114 | 114 |
| 115 | 115 | const { | |
|