|
|
|
@ -60,22 +60,22 @@
|
|
|
|
|
: ArrayBuffer.isView;
|
|
|
|
|
|
|
|
|
|
var formatMessage = function (message) {
|
|
|
|
|
var notString, type = typeof message;
|
|
|
|
|
if (type !== 'string') {
|
|
|
|
|
if (type === 'object') {
|
|
|
|
|
if (message === null) {
|
|
|
|
|
throw new Error(INPUT_ERROR);
|
|
|
|
|
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
|
} else if (!isArray(message) && !isView(message)) {
|
|
|
|
|
throw new Error(INPUT_ERROR);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var type = typeof message;
|
|
|
|
|
if (type === 'string') {
|
|
|
|
|
return [message, false];
|
|
|
|
|
}
|
|
|
|
|
if (type === 'object') {
|
|
|
|
|
if (message === null) {
|
|
|
|
|
throw new Error(INPUT_ERROR);
|
|
|
|
|
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
|
} else if (!isArray(message) && !isView(message)) {
|
|
|
|
|
throw new Error(INPUT_ERROR);
|
|
|
|
|
}
|
|
|
|
|
notString = true;
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error(INPUT_ERROR);
|
|
|
|
|
}
|
|
|
|
|
return [message, notString];
|
|
|
|
|
return [message, true];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var empty = function (message) {
|
|
|
|
|