* Checks if `string` ends with the given target string. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to
(string, target, position)
| 11643 | * // => true |
| 11644 | */ |
| 11645 | function endsWith(string, target, position) { |
| 11646 | string = baseToString(string); |
| 11647 | target = (target + ''); |
| 11648 | |
| 11649 | var length = string.length; |
| 11650 | position = position === undefined |
| 11651 | ? length |
| 11652 | : nativeMin(position < 0 ? 0 : (+position || 0), length); |
| 11653 | |
| 11654 | position -= target.length; |
| 11655 | return position >= 0 && string.indexOf(target, position) == position; |
| 11656 | } |
| 11657 | |
| 11658 | /** |
| 11659 | * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to |
no test coverage detected