MCPcopy Create free account
hub / github.com/devflowinc/trieve / removeNullCharacters

Function removeNullCharacters

pdf2md/server/static/viewer.mjs:201–209  ·  view source on GitHub ↗
(str, replaceInvisible = false)

Source from the content-addressed store, hash-verified

199}
200const InvisibleCharsRegExp = /[\x00-\x1F]/g;
201function removeNullCharacters(str, replaceInvisible = false) {
202 if (!InvisibleCharsRegExp.test(str)) {
203 return str;
204 }
205 if (replaceInvisible) {
206 return str.replaceAll(InvisibleCharsRegExp, m => m === "\x00" ? "" : " ");
207 }
208 return str.replaceAll("\x00", "");
209}
210function binarySearchFirstItem(items, condition, start = 0) {
211 let minIndex = start;
212 let maxIndex = items.length - 1;

Callers 4

#setAttributesMethod · 0.85
#addImageInTextLayerMethod · 0.85
#bindMouseMethod · 0.85
getAllTextMethod · 0.85

Calls 1

testMethod · 0.80

Tested by

no test coverage detected