{"size": 2000, "ext": "js", "max_stars_repo_path": "node_modules/@sap-cloud-sdk/util/dist/string.js", "max_stars_repo_name": "lbritz/RiskApplication", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/@sap-cloud-sdk/util/dist/string.js", "max_issues_repo_name": "lbritz/RiskApplication", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/@sap-cloud-sdk/util/dist/string.js", "max_forks_repo_name": "lbritz/RiskApplication", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.3333333333, "max_line_length": 114, "alphanum_fraction": 0.7095}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeFileExtension = exports.trim = exports.trimRight = exports.trimLeft = exports.encodeBase64 = void 0;
var string_formatter_1 = require("./string-formatter");
/**
 * Encode a string to a base64 encoded string.
 * @param str - String to encode.
 * @returns Base64 encoded string.
 */
function encodeBase64(str) {
    return Buffer.from(str).toString('base64');
}
exports.encodeBase64 = encodeBase64;
/**
 * Remove whitespace from the left side of a string.
 * @param string - String to trim.
 * @returns String without whitespace on the left side.
 */
function trimLeft(string) {
    var subStrings = string.split(string_formatter_1.unixEOL);
    if (!subStrings[0].trim()) {
        subStrings = subStrings.slice(1);
    }
    return subStrings.join(string_formatter_1.unixEOL);
}
exports.trimLeft = trimLeft;
/**
 * Remove whitespace from the right side of a string.
 * @param string - String to trim.
 * @returns String without whitespace on the right side.
 */
function trimRight(string) {
    var subStrings = string.split(string_formatter_1.unixEOL);
    if (!subStrings[subStrings.length - 1].trim()) {
        subStrings = subStrings.slice(0, -1);
    }
    return subStrings.join(string_formatter_1.unixEOL);
}
exports.trimRight = trimRight;
/**
 * Remove whitespace from the left side of a string.
 * @param string - String to trim.
 * @returns String without outer whitespace.
 */
function trim(string) {
    return trimRight(trimLeft(string));
}
exports.trim = trim;
/**
 * Remove file extension from a string, e.g. remove 'test.jpg' would return 'test'
 * @param fileName - File name to remove the file extension from.
 * @returns File name without extension.
 */
function removeFileExtension(fileName) {
    return fileName.includes('.')
        ? fileName.split('.').slice(0, -1).join('.')
        : fileName;
}
exports.removeFileExtension = removeFileExtension;
//# sourceMappingURL=string.js.map