or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-lodash--trimend

Removes trailing whitespace or specified characters from string

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.trimend@4.5.x

To install, run

npx @tessl/cli install tessl/npm-lodash--trimend@4.5.0

index.mddocs/

lodash.trimend

A modular lodash utility function that removes trailing whitespace or specified characters from string. This package provides precise string manipulation for trailing character removal with full Unicode support and performance optimization for common use cases.

Package Information

  • Package Name: lodash.trimend
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install lodash.trimend

Core Imports

const trimEnd = require("lodash.trimend");

For ES modules:

import trimEnd from "lodash.trimend";

Basic Usage

import trimEnd from "lodash.trimend";

// Remove trailing whitespace
const text = trimEnd("  hello world  ");
console.log(text); // "  hello world"

// Remove specific trailing characters
const path = trimEnd("/path/to/resource///", "/");
console.log(path); // "/path/to/resource"

// Works with Unicode characters
const unicode = trimEnd("héllo wörld   ");
console.log(unicode); // "héllo wörld"

Capabilities

String Trimming

Removes trailing whitespace or specified characters from strings with full Unicode support.

/**
 * 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 an iteratee for functions like `_.map`.
 * @returns {string} Returns the trimmed string.
 * @example
 *
 * _.trimEnd('  abc  ');
 * // => '  abc'
 *
 * _.trimEnd('-_-abc-_-', '_-');
 * // => '-_-abc'
 */
function trimEnd(string, chars, guard);

Parameters:

  • string (string): The string to trim. Defaults to empty string.
  • chars (string, optional): The characters to trim. Defaults to whitespace.
  • guard (Object, optional): Enables use as an iteratee for functions like _.map.

Returns:

  • (string): Returns the trimmed string.

Usage Examples:

// Basic whitespace trimming (default behavior)
trimEnd("  abc  ");
// => "  abc"

// Custom character trimming
trimEnd("-_-abc-_-", "_-");
// => "-_-abc"

// Works with Unicode characters
trimEnd("héllo wörld   ");
// => "héllo wörld"