MCPcopy Index your code
hub / github.com/RustPython/RustPython / hashCode

Function hashCode

wasm/notebook/src/parse.js:4–17  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

2// https://github.com/iodide-project/iodide/blob/master/src/editor/iomd-tools/iomd-parser.js
3
4function hashCode(str) {
5 // this is an implementation of java's hashcode method
6 // https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
7 let hash = 0;
8 let chr;
9 if (str.length !== 0) {
10 for (let i = 0; i < str.length; i++) {
11 chr = str.charCodeAt(i);
12 hash = (hash << 5) - hash + chr; // eslint-disable-line
13 hash |= 0; // eslint-disable-line
14 }
15 }
16 return hash.toString();
17}
18
19export function iomdParser(fullIomd) {
20 const iomdLines = fullIomd.split('\n');

Callers 1

newChunkIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected