UNPKG

providence-analytics

Version:

Providence is the 'All Seeing Eye' that measures effectivity and popularity of software. Release management will become highly efficient due to an accurate impact analysis of (breaking) changes

19 lines (18 loc) 455 B
/** * @param {string|object} inputValue * @returns {string} */ export function hash(inputValue) { if (typeof inputValue === 'object') { // eslint-disable-next-line no-param-reassign inputValue = JSON.stringify(inputValue); } return String( inputValue.split('').reduce( (prevHash, currVal) => // eslint-disable-next-line no-bitwise ((prevHash << 5) - prevHash + currVal.charCodeAt(0)) | 0, 0, ), ); }