https://github.com/gabo2151/ngx-name-capitalize
https://github.com/gabo2151/ngx-name-capitalize
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gabo2151/ngx-name-capitalize
- Owner: gabo2151
- License: mit
- Created: 2026-04-29T14:27:23.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-04-29T20:37:59.000Z (about 1 month ago)
- Last Synced: 2026-04-29T21:32:45.189Z (about 1 month ago)
- Language: TypeScript
- Size: 498 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-angular - ngx-name-capitalize - Angular pipe for name capitalization that formats compound surnames, linguistic particles, hyphenated names, apostrophes, and Unicode characters. (Third Party Components / Pipes)
- awesome-angular - ngx-name-capitalize - Angular pipe for name capitalization that formats compound surnames, linguistic particles, hyphenated names, apostrophes, and Unicode characters. (Third Party Components / Pipes)
README
# ngx-name-capitalize
[](https://www.npmjs.org/package/ngx-name-capitalize)
[](https://packagephobia.com/result?p=ngx-name-capitalize)
[](https://npm-stat.com/charts.html?package=ngx-name-capitalize)
[](https://opensource.org/licenses/MIT)
Angular pipe for smart capitalization of person names. Handles compound surnames, particles (de, del, la, van, von...), hyphenated names, apostrophes, and Unicode characters.
Built on top of [name-capitalize](https://www.npmjs.com/package/name-capitalize).
## Compatibility
| ngx-name-capitalize | Angular | Node |
|---------------------|---------|-------|
| 1.x | 12 – 13 | >= 16 |
| 2.x | 14 – 15 | >= 18 |
| 3.x | 16+ | >= 18 |
## Installation
```bash
npm install ngx-name-capitalize
```
## Usage
### Standalone (Angular 14+)
```typescript
import { NameCapitalizePipe } from 'ngx-name-capitalize';
@Component({
standalone: true,
imports: [NameCapitalizePipe],
template: `{{ name | namecase }}`
})
export class MyComponent { }
```
### NgModule (Angular 12 – 15)
```typescript
import { NgxNameCapitalizeModule } from 'ngx-name-capitalize';
@NgModule({
imports: [NgxNameCapitalizeModule]
})
export class AppModule { }
```
### In your template
```html
{{ 'JUAN DE LA MAZA' | namecase }}
{{ "bernardo o'higgins riquelme" | namecase }}
{{ 'jean-pierre dupont' | namecase }}
```
### In your component
```typescript
import { NameCapitalizePipe } from 'ngx-name-capitalize';
@Component({
providers: [NameCapitalizePipe]
})
export class MyComponent {
constructor(private namecase: NameCapitalizePipe) {}
format(name: string): string {
return this.namecase.transform(name);
}
}
```
## Examples
| Input | Output |
|----------------------------------|--------------------------------|
| `JUAN DE LA MAZA` | Juan de la Maza |
| `ludwig van beethoven` | Ludwig van Beethoven |
| `BERNARDO O'HIGGINS` | Bernardo O'Higgins |
| `jean-pierre dupont` | Jean-Pierre Dupont |
| `gabriel garcía márquez` | Gabriel García Márquez |
| `MIGUEL DE CERVANTES Y SAAVEDRA` | Miguel de Cervantes y Saavedra |
| `van gogh` | Van Gogh |
## License
MIT © [Gabriel Galilea](https://github.com/gabo2151)