@mediarithmics/plugins-nodejs-sdk
Version:
This is the mediarithmics nodejs to help plugin developers bootstrapping their plugin without having to deal with most of the plugin boilerplate
32 lines • 937 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.obfuscateString = exports.getOrElse = exports.flatMap = exports.map = void 0;
const map = (a, f) => {
return a ? f(a) : undefined;
};
exports.map = map;
const flatMap = (a, f) => {
return a ? f(a) : undefined;
};
exports.flatMap = flatMap;
const getOrElse = (t, _default) => {
return t ? t : _default;
};
exports.getOrElse = getOrElse;
const obfuscateString = (rawString) => {
if (!rawString) {
return undefined;
}
const stringLength = rawString.length;
if (stringLength === 0) {
return '';
}
else {
const clearSize = Math.floor(0.3 * stringLength);
const clear = rawString.substring(0, clearSize);
const obfuscated = 'X'.repeat(stringLength - clearSize);
return clear + obfuscated;
}
};
exports.obfuscateString = obfuscateString;
//# sourceMappingURL=index.js.map