Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Aug 4, 2024
1 parent bf1bb04 commit ad38125
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ export function decodeURISafe(str) {
* Convert string or Buffer to string.
*
* @param {string|Buffer} data String or Buffer data.
* @param {Array} args Optional arguments to pass to Buffer toString method.
* @param {string} encoding Buffer encoding.
* @returns {string} String value.
*/
export function stringOrBufferCast(data, ...args) {
export function stringOrBufferCast(data, encoding = 'utf8') {
if (typeof data === 'string') {
return data;
}
return data.toString(...args);
return data.toString(encoding);
}

/**
Expand Down

0 comments on commit ad38125

Please sign in to comment.