anorgatarrak-wordpress-theme/node_modules/underscore.string/rtrim.js

11 lines
423 B
JavaScript

var makeString = require('./helper/makeString');
var defaultToWhiteSpace = require('./helper/defaultToWhiteSpace');
var nativeTrimRight = String.prototype.trimRight;
module.exports = function rtrim(str, characters) {
str = makeString(str);
if (!characters && nativeTrimRight) return nativeTrimRight.call(str);
characters = defaultToWhiteSpace(characters);
return str.replace(new RegExp(characters + '+$'), '');
};