15 lines
346 B
JavaScript
15 lines
346 B
JavaScript
/**
|
|
* @description Decode the comment from base64
|
|
* @param comment
|
|
* @returns {any|null}
|
|
*/
|
|
const decodeComment = (comment) => {
|
|
try {
|
|
return comment ? JSON.parse(Buffer.from(comment, "base64").toString()) : null;
|
|
} catch (error) {
|
|
return null; // Handle malformed base64 string gracefully
|
|
}
|
|
};
|
|
|
|
module.exports = decodeComment;
|