GeezerVison is showing github.com — tls: use `kEmptyObject` · nodejs/node@e31baca
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/_tls_common.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,6 +47,10 @@ const { | 47 | 47 | }, | 48 | 48 | } = internalBinding('constants'); | 49 | 49 |
| | 50 | +const { | | 51 | + kEmptyObject, | | 52 | +} = require('internal/util'); | | 53 | + | 50 | 54 | const { | 51 | 55 | validateInteger, | 52 | 56 | } = require('internal/validators'); | @@ -93,7 +97,7 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) { | 93 | 97 | } | 94 | 98 |
| 95 | 99 | function createSecureContext(options) { | 96 | | - if (!options) options = {}; | | 100 | + if (!options) options = kEmptyObject; | 97 | 101 |
| 98 | 102 | const { | 99 | 103 | honorCipherOrder, | |
Collapse file Copy file name to clipboardExpand all lines: lib/_tls_wrap.js +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,8 @@ const { | 40 | 40 |
| 41 | 41 | const { | 42 | 42 | assertCrypto, | 43 | | - deprecate | | 43 | + deprecate, | | 44 | + kEmptyObject, | 44 | 45 | } = require('internal/util'); | 45 | 46 |
| 46 | 47 | assertCrypto(); | @@ -1182,9 +1183,9 @@ function Server(options, listener) { | 1182 | 1183 |
| 1183 | 1184 | if (typeof options === 'function') { | 1184 | 1185 | listener = options; | 1185 | | - options = {}; | | 1186 | + options = kEmptyObject; | 1186 | 1187 | } else if (options == null || typeof options === 'object') { | 1187 | | - options = options || {}; | | 1188 | + options = options ?? kEmptyObject; | 1188 | 1189 | } else { | 1189 | 1190 | throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); | 1190 | 1191 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/tls/secure-context.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,6 +17,10 @@ const { | 17 | 17 | }, | 18 | 18 | } = require('internal/errors'); | 19 | 19 |
| | 20 | +const { | | 21 | + kEmptyObject, | | 22 | +} = require('internal/util'); | | 23 | + | 20 | 24 | const { | 21 | 25 | isArrayBufferView, | 22 | 26 | } = require('internal/util/types'); | @@ -117,7 +121,7 @@ function processCiphers(ciphers, name) { | 117 | 121 | return { cipherList, cipherSuites }; | 118 | 122 | } | 119 | 123 |
| 120 | | -function configSecureContext(context, options = {}, name = 'options') { | | 124 | +function configSecureContext(context, options = kEmptyObject, name = 'options') { | 121 | 125 | validateObject(options, name); | 122 | 126 |
| 123 | 127 | const { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/tls/secure-pair.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 |
| 3 | 3 | const EventEmitter = require('events'); | | 4 | +const { kEmptyObject } = require('internal/util'); | 4 | 5 | const { Duplex } = require('stream'); | 5 | 6 | const _tls_wrap = require('_tls_wrap'); | 6 | 7 | const _tls_common = require('_tls_common'); | @@ -57,7 +58,7 @@ class SecurePair extends EventEmitter { | 57 | 58 | isServer = false, | 58 | 59 | requestCert = !isServer, | 59 | 60 | rejectUnauthorized = false, | 60 | | - options = {}) { | | 61 | + options = kEmptyObject) { | 61 | 62 | super(); | 62 | 63 | const { socket1, socket2 } = new DuplexPair(); | 63 | 64 |
| |
|