(str: string)
| 64 | * Credit: https://gist.github.com/jlevy/c246006675becc446360a798e2b2d781?permalink_comment_id=4738050#gistcomment-4738050 |
| 65 | */ |
| 66 | export function simpleHash(str: string) { |
| 67 | let hash = 0; |
| 68 | for (let i = 0; i < str.length; i++) { |
| 69 | hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0; |
| 70 | } |
| 71 | return (hash >>> 0).toString(36); |
| 72 | } |
| 73 | |
| 74 | export function childSelector<T extends Element>( |
| 75 | filter?: string | ((el: T) => boolean), |