Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const printReceivedStringContainExpectedSubstring = (
received: string,
start: number,
length: number, // not end
): string =>
RECEIVED_COLOR(
'"' +
printSubstring(received.slice(0, start)) +
INVERTED_COLOR(printSubstring(received.slice(start, start + length))) +
printSubstring(received.slice(start + length)) +
'"',
);
function printReceivedWithHighlight(
text: string,
start: number,
length: number,
) {
return receivedColor(
`"${text.slice(0, start)}${invertedColor(
text.slice(start, start + length),
)}${text.slice(start + length)}"`,
);
}
.map((item, i) => {
const stringified = stringify(item);
return i === index ? INVERTED_COLOR(stringified) : stringified;
})
.join(', ') +