or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.md
tile.json

index.mddocs/

0

# lodash.deburr

1

2

lodash.deburr provides a utility function that removes diacritics (accent marks) from latin-1 supplementary letters, converting them to their basic latin equivalents. This is useful for text normalization, search functionality, URL slug generation, and internationalization scenarios where accent-insensitive processing is required.

3

4

## Package Information

5

6

- **Package Name**: lodash.deburr

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

- **Installation**: `npm install lodash.deburr` or use from full lodash library

10

11

## Core Imports

12

13

For standalone lodash.deburr package:

14

15

```javascript

16

const deburr = require('lodash.deburr');

17

```

18

19

From full lodash library:

20

21

```javascript

22

const _ = require('lodash');

23

// Use as _.deburr()

24

```

25

26

ES6 modules (if available):

27

28

```javascript

29

import deburr from 'lodash.deburr';

30

```

31

32

## Basic Usage

33

34

```javascript

35

const deburr = require('lodash.deburr');

36

37

// Remove accents from common phrases

38

const result1 = deburr('déjà vu');

39

// => 'deja vu'

40

41

const result2 = deburr('naïve café');

42

// => 'naive cafe'

43

44

const result3 = deburr('Zürich résumé');

45

// => 'Zurich resume'

46

47

// Handle empty or null values gracefully

48

const result4 = deburr('');

49

// => ''

50

51

const result5 = deburr(null);

52

// => ''

53

54

const result6 = deburr(undefined);

55

// => ''

56

```

57

58

## Capabilities

59

60

### String Deburring

61

62

Converts latin-1 supplementary letters (accented characters) to their basic latin equivalents while preserving other characters.

63

64

```javascript { .api }

65

/**

66

* Deburrs string by converting latin-1 supplementary letters to basic latin letters.

67

*

68

* @param {string} [string=''] - The string to deburr

69

* @returns {string} Returns the deburred string

70

*/

71

function deburr(string)

72

```

73

74

**Behavior:**

75

- Converts accented vowels: á, à, â, ã, ä, å → a

76

- Converts accented consonants: ç → c, ñ → n

77

- Converts special characters: æ → ae, ø → o, ß → ss

78

- Preserves mathematical operators: × and ÷ remain unchanged

79

- Handles null/undefined input by returning empty string

80

- Non-string inputs are converted to string first

81

82

**Usage Examples:**

83

84

```javascript

85

// Basic accent removal

86

deburr('Crème brûlée'); // => 'Creme brulee'

87

deburr('piña colada'); // => 'pina colada'

88

89

// URL slug generation

90

function createSlug(text) {

91

return deburr(text)

92

.toLowerCase()

93

.replace(/[^a-z0-9]+/g, '-')

94

.replace(/-+/g, '-')

95

.replace(/^-|-$/g, '');

96

}

97

98

createSlug('Café París'); // => 'cafe-paris'

99

100

// Search normalization

101

function normalizeForSearch(query) {

102

return deburr(query).toLowerCase();

103

}

104

105

const searchTerms = ['café', 'cafe'];

106

const normalizedTerms = searchTerms.map(normalizeForSearch);

107

// => ['cafe', 'cafe'] - now identical for matching

108

109

// Form data cleaning

110

const userInput = 'José María González';

111

const cleanedName = deburr(userInput);

112

// => 'Jose Maria Gonzalez'

113

```

114

115

**Character Mappings:**

116

117

The function handles these latin-1 supplementary letter ranges:

118

- À-Ö (uppercase accented letters): À→A, Á→A, Â→A, etc.

119

- Ø-Þ (other uppercase): Ø→O, Ð→D, Þ→Th, etc.

120

- ß-ö (lowercase accented): ß→ss, à→a, á→a, etc.

121

- ø-ÿ (other lowercase): ø→o, ð→d, þ→th, ÿ→y

122

123

**Edge Cases:**

124

- Mathematical operators (× ÷) are preserved unchanged

125

- Non-latin characters outside the latin-1 range are unchanged

126

- Whitespace and punctuation are preserved

127

- Numbers and basic ASCII letters are unchanged