MCPcopy Create free account
hub / github.com/garris/BackstopJS / genHash

Function genHash

core/util/engineTools.js:22–36  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

20}
21
22function genHash (str) {
23 let hash = 0;
24 let i;
25 let chr;
26 let len;
27 if (!str) return hash;
28 str = str.toString();
29 for (i = 0, len = str.length; i < len; i++) {
30 chr = str.charCodeAt(i);
31 hash = ((hash << 5) - hash) + chr;
32 hash |= 0; // Convert to 32bit integer
33 }
34 // return a string and replace a negative sign with a zero
35 return hash.toString().replace(/^-/, 0);
36}
37
38/**
39 * @description Determines whether the same dimensions are required based on the given scenario and configuration.

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected