wip: simplify formatMessage internal logic

pull/34/head
legobt 2 years ago
parent 6b26e52ce5
commit d12d2563d8
No known key found for this signature in database
GPG Key ID: AB99C6D5F471E4E6

@ -64,12 +64,10 @@
if (type === 'string') {
return [message, false];
}
if (type !== 'object') {
if (type !== 'object' || message === null) {
throw new Error(INPUT_ERROR);
}
if (message === null) {
throw new Error(INPUT_ERROR);
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
} else if (!isArray(message) && !isView(message)) {
throw new Error(INPUT_ERROR);

Loading…
Cancel
Save