UNPKG

@worktif/purei

Version:

Work TIF Material UI Theme Provider and Customization Suite for React applications with dark mode support and dynamic color schemes

32 lines 1.25 kB
"use strict"; /* * Business Source License 1.1 * * Copyright (C) 2025 Raman Marozau, raman@worktif.com * Use of this software is governed by the Business Source License included in the LICENSE file and at www.mariadb.com/bsl11. * * Change Date: Never * On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file. * Additional Use Grant: Free for personal and non-commercial research use only. * * * SPDX-License-Identifier: BUSL-1.1 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.hashCode = hashCode; const uuid_1 = require("uuid"); /** * Generates a hash code for the given string. If the string is null or undefined, it defaults to a predefined value. * * @param {Maybe<string>} str - The input string to generate the hash code for. Can be null or undefined. * @return {string} The generated hash code as a string. */ function hashCode(str) { return str ? Math.abs(str .split('') .reduce((prevHash, currentValue) => ((prevHash << 5) - prevHash + currentValue.charCodeAt(0)) | 0, 0)) .toString() : uuid_1.NIL; } //# sourceMappingURL=encode.js.map