generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
17 lines (16 loc) • 420 B
JavaScript
import { camelCase, upperFirst } from 'lodash-es';
export function stringHashCode(str) {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const character = str.charCodeAt(i);
hash = (hash << 5) - hash + character;
hash |= 0;
}
if (hash < 0) {
hash *= -1;
}
return hash;
}
export function upperFirstCamelCase(value) {
return upperFirst(camelCase(value));
}