From: Feross Aboukhadijeh Date: Mon, 8 Aug 2016 08:16:12 +0000 (-0700) Subject: Add explanatory comment X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=50b05261fd4bb08b643ef0f31b9d8ad8390a9258;p=buffer.git Add explanatory comment In response to @dcposch's feedback --- diff --git a/index.js b/index.js index 834bea0..d5347f3 100644 --- a/index.js +++ b/index.js @@ -231,6 +231,9 @@ function fromString (that, string, encoding) { var actual = that.write(string, encoding) if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual) }