-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers
Milestone
Description
I receive the following warning in Visual Studio
TS6387 (JS) The signature '(from: number, length?: number): string' of 'str.substr' is deprecated. signalr.js 380
The affected code seems to be:
| return str.substr(0, str.length - 1); |
function formatArrayBuffer(data) {
const view = new Uint8Array(data);
// Uint8Array.map only supports returning another Uint8Array?
let str = "";
view.forEach((num) => {
const pad = num < 16 ? "0" : "";
str += `0x${pad}${num.toString(16)} `;
});
// Trim of trailing space.
return str.substr(0, str.length - 1);
}
Seems to be simple, use str.substring instead.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
Metadata
Metadata
Assignees
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers