Files
bodyshop/server/intellipay/lib/decodeComment.js
2025-08-19 16:23:29 -04:00

15 lines
338 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 {
return null; // Handle malformed base64 string gracefully
}
};
module.exports = decodeComment;