| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0a252c2 commit 6dd1c75
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,6 @@ const { | |||
| 52 | 52 | validateEncoding, | |
| 53 | 53 | validateString, | |
| 54 | 54 | validateUint32, | |
| 55 | - validateBuffer, | ||
| 56 | 55 | } = require('internal/validators'); | |
| 57 | 56 | ||
| 58 | 57 | const { | |
@@ -196,8 +195,8 @@ async function asyncDigest(algorithm, data) { | |||
| 196 | 195 | ||
| 197 | 196 | function hash(algorithm, input, outputEncoding = 'hex') { | |
| 198 | 197 | validateString(algorithm, 'algorithm'); | |
| 199 | - if (typeof input !== 'string') { | ||
| 200 | - validateBuffer(input, 'input'); | ||
| 198 | + if (typeof input !== 'string' && !isArrayBufferView(input)) { | ||
| 199 | + throw new ERR_INVALID_ARG_TYPE('input', ['Buffer', 'TypedArray', 'DataView', 'string'], input); | ||
| 201 | 200 | } | |
| 202 | 201 | let normalized = outputEncoding; | |
| 203 | 202 | // Fast case: if it's 'hex', we don't need to validate it further. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments