botv12/util/parseNBT.js

11 lines
271 B
JavaScript
Raw Normal View History

2024-10-22 23:11:33 -04:00
import { processNbtMessage } from 'prismarine-chat'
2024-10-23 22:51:35 -04:00
export function parse (data) {
2024-10-22 23:11:33 -04:00
if (typeof data.type === 'string') {
return JSON.parse(processNbtMessage(data))
} else if (typeof data === 'string') {
return JSON.parse(data)
} else {
return data
}
}