MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / getIndex

Method getIndex

modules/crypt/ssl/ssl_cert.js:87–97  ·  view source on GitHub ↗
(name, target)

Source from the content-addressed store, hash-verified

85 return this.#clientCertificates ?? [];
86 }
87 getIndex(name, target) {
88 if (!target)
89 return -1;
90
91 const data = new Resource(name);
92 for (let i = 0, byteLength = data.byteLength; i < byteLength; i += 20) {
93 if (!Bin.comp(data.slice(i, i + 20, false), target))
94 return i / 20;
95 }
96 return -1;
97 }
98 findCert(fname, target) {
99 let data = this.getIndex(fname, target);
100 if (data < 0)

Callers 1

findCertMethod · 0.95

Calls 1

sliceMethod · 0.95

Tested by

no test coverage detected