summaryrefslogtreecommitdiff
path: root/lib/_tls_common.js
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2017-09-28 00:16:41 -0700
committerRuben Bridgewater <ruben@bridgewater.de>2017-10-01 23:58:59 -0300
commit7907534a8d867132957b823db8603a418d763e42 (patch)
treed3e5d17179fc7cca5364b2a25e193b28b0234b3e /lib/_tls_common.js
parent34dbc9e4e8725d5ff28be918a2cb608ff0668e16 (diff)
downloadandroid-node-v8-7907534a8d867132957b823db8603a418d763e42.tar.gz
android-node-v8-7907534a8d867132957b823db8603a418d763e42.tar.bz2
android-node-v8-7907534a8d867132957b823db8603a418d763e42.zip
lib: faster type checks for some types
PR-URL: https://github.com/nodejs/node/pull/15663 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_tls_common.js')
-rw-r--r--lib/_tls_common.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/_tls_common.js b/lib/_tls_common.js
index fa31fd7de6..54b27a7bca 100644
--- a/lib/_tls_common.js
+++ b/lib/_tls_common.js
@@ -22,6 +22,7 @@
'use strict';
const { parseCertString } = require('internal/tls');
+const { isArrayBufferView } = require('internal/util/types');
const tls = require('tls');
const errors = require('internal/errors');
@@ -55,7 +56,7 @@ function SecureContext(secureProtocol, secureOptions, context) {
}
function validateKeyCert(value, type) {
- if (typeof value !== 'string' && !ArrayBuffer.isView(value))
+ if (typeof value !== 'string' && !isArrayBufferView(value))
throw new errors.TypeError(
'ERR_INVALID_ARG_TYPE', type,
['string', 'Buffer', 'TypedArray', 'DataView']