or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

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

0

# lodash.trimend

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: lodash.trimend

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

- **Installation**: `npm install lodash.trimend`

10

11

## Core Imports

12

13

```javascript

14

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

15

```

16

17

For ES modules:

18

19

```javascript

20

import trimEnd from "lodash.trimend";

21

```

22

23

## Basic Usage

24

25

```javascript

26

import trimEnd from "lodash.trimend";

27

28

// Remove trailing whitespace

29

const text = trimEnd(" hello world ");

30

console.log(text); // " hello world"

31

32

// Remove specific trailing characters

33

const path = trimEnd("/path/to/resource///", "/");

34

console.log(path); // "/path/to/resource"

35

36

// Works with Unicode characters

37

const unicode = trimEnd("héllo wörld ");

38

console.log(unicode); // "héllo wörld"

39

```

40

41

## Capabilities

42

43

### String Trimming

44

45

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

46

47

```javascript { .api }

48

/**

49

* Removes trailing whitespace or specified characters from `string`.

50

*

51

* @static

52

* @memberOf _

53

* @category String

54

* @param {string} [string=''] The string to trim.

55

* @param {string} [chars=whitespace] The characters to trim.

56

* @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.

57

* @returns {string} Returns the trimmed string.

58

* @example

59

*

60

* _.trimEnd(' abc ');

61

* // => ' abc'

62

*

63

* _.trimEnd('-_-abc-_-', '_-');

64

* // => '-_-abc'

65

*/

66

function trimEnd(string, chars, guard);

67

```

68

69

**Parameters:**

70

71

- **string** *(string)*: The string to trim. Defaults to empty string.

72

- **chars** *(string, optional)*: The characters to trim. Defaults to whitespace.

73

- **guard** *(Object, optional)*: Enables use as an iteratee for functions like `_.map`.

74

75

**Returns:**

76

77

- *(string)*: Returns the trimmed string.

78

79

**Usage Examples:**

80

81

```javascript

82

// Basic whitespace trimming (default behavior)

83

trimEnd(" abc ");

84

// => " abc"

85

86

// Custom character trimming

87

trimEnd("-_-abc-_-", "_-");

88

// => "-_-abc"

89

90

// Works with Unicode characters

91

trimEnd("héllo wörld ");

92

// => "héllo wörld"

93

```