MCPcopy Create free account
hub / github.com/BruceDevices/firmware / stringToId

Function stringToId

embedded_resources/web_interface/index.js:185–196  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

183}
184
185function stringToId(str) {
186 let hash = 0,
187 i,
188 chr;
189 if (str.length === 0) return hash.toString();
190 for (i = 0; i < str.length; i++) {
191 chr = str.charCodeAt(i);
192 hash = (hash << 5) - hash + chr;
193 hash |= 0; // Convert to 32bit integer
194 }
195 return "id_" + Math.abs(hash);
196}
197
198const _queueUpload = [];
199let _runningUpload = false;

Callers 2

appendFileToQueueFunction · 0.85
uploadFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected