From 724e3ccda6f1c9a926ceb53c698e4cff91855d59 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 1 Oct 2021 21:00:53 -0400 Subject: [PATCH] fixup! util: expose stripVTControlCharacters() --- lib/internal/util/inspect.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index b221b084275867..4936ab761ddccb 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -140,6 +140,7 @@ const assert = require('internal/assert'); const { NativeModule } = require('internal/bootstrap/loaders'); const { validateObject, + validateString, } = require('internal/validators'); let hexSlice; @@ -2114,9 +2115,7 @@ if (internalBinding('config').hasIntl) { * Remove all VT control characters. Use to estimate displayed string width. */ function stripVTControlCharacters(str) { - if (typeof str !== 'string') { - throw new ERR_INVALID_ARG_TYPE('str', 'string', str); - } + validateString(str, 'str'); return str.replace(ansi, ''); }