UNPKG

abapmerge

Version:

Merge ABAP INCLUDEs into single file

40 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Utils = /** @class */ (function () { function Utils() { } Utils.nextMinstdRandFor = function (seed) { var product = 48271 * seed; return product % (Utils.minstdRandMax + 1); }; Utils.hashCodeOf = function (input) { var hash = 0; if (input.length === 0) { return hash; } for (var i = 0; i < input.length; ++i) { var char = input.charCodeAt(i); /* eslint-disable-next-line no-bitwise */ hash = ((hash << 5) - hash) + char; /* eslint-disable-next-line no-bitwise */ hash = hash & hash; } if (hash < 0) { return hash * -1; } return hash; }; Utils.randomStringOfLength = function (seed, requiredLength) { var allowedLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var result = ""; for (var currentLength = 0; currentLength < requiredLength; ++currentLength) { seed = Utils.nextMinstdRandFor(seed); result += allowedLetters[Math.floor(allowedLetters.length * (seed / Utils.minstdRandMax))]; } return result; }; Utils.minstdRandMax = 2147483646; return Utils; }()); exports.default = Utils; //# sourceMappingURL=utils.js.map