| 20 | } |
| 21 | |
| 22 | function 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. |