mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-22 16:31:05 +01:00
11 lines
No EOL
274 B
TypeScript
11 lines
No EOL
274 B
TypeScript
export const isJSON = (data: any): boolean => {
|
|
if (typeof data !== 'string') return false;
|
|
try {
|
|
const result = JSON.parse(data);
|
|
const type = result.toString();
|
|
|
|
return type === '[object Object]' || type === '[object Array]';
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}; |