@n3okill/utils
Version:
Many javascript helpers
18 lines • 802 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.trimRight = trimRight;
const _internal_1 = require("./_internal");
const detectEncoding_1 = require("./detectEncoding");
const toString_1 = require("./toString");
const trimRight_1 = require("../string/trimRight");
/**
* Remove given characters from right side of the buffer
* @param s Buffer to remove the characters from
* @param chars Characters to remove, if not defined removes empty spaces
* @returns Trimmed Buffer
*/
function trimRight(s, chars = []) {
const encoding = (0, detectEncoding_1.detectEncoding)(s);
return Buffer.from((0, trimRight_1.trimRight)((0, toString_1.toString)(s, encoding), chars.map((s) => (0, _internal_1._toString)(s))), encoding);
}
//# sourceMappingURL=trimRight.js.map
;