mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-25 06:05:52 +02:00
Archive commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { transliterate } from 'transliteration';
|
||||
|
||||
@Pipe({
|
||||
name: 'translit',
|
||||
})
|
||||
export class TranslitPipe implements PipeTransform {
|
||||
transform(value: string) {
|
||||
if (!value || /^[a-z0-9-_.,\[\]!@#$%^&*{}|\/\\ ]+$/i.test(value))
|
||||
return undefined;
|
||||
|
||||
const translit = transliterate(value);
|
||||
return translit !== value ? translit : undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user