X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Fstring%2FtrimRight.js;fp=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Fstring%2FtrimRight.js;h=0f9be71fbe6427660c3c89c2236d5f96af7ab845;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/string/trimRight.js b/node_modules/grunt-legacy-log/node_modules/lodash/string/trimRight.js new file mode 100644 index 000000000..0f9be71fb --- /dev/null +++ b/node_modules/grunt-legacy-log/node_modules/lodash/string/trimRight.js @@ -0,0 +1,36 @@ +var baseToString = require('../internal/baseToString'), + charsRightIndex = require('../internal/charsRightIndex'), + isIterateeCall = require('../internal/isIterateeCall'), + trimmedRightIndex = require('../internal/trimmedRightIndex'); + +/** + * Removes trailing whitespace or specified characters from `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to trim. + * @param {string} [chars=whitespace] The characters to trim. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {string} Returns the trimmed string. + * @example + * + * _.trimRight(' abc '); + * // => ' abc' + * + * _.trimRight('-_-abc-_-', '_-'); + * // => '-_-abc' + */ +function trimRight(string, chars, guard) { + var value = string; + string = baseToString(string); + if (!string) { + return string; + } + if (guard ? isIterateeCall(value, chars, guard) : chars == null) { + return string.slice(0, trimmedRightIndex(string) + 1); + } + return string.slice(0, charsRightIndex(string, (chars + '')) + 1); +} + +module.exports = trimRight;