
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
normalize-vietnamese
Advanced tools
A TypeScript library for Vietnamese text processing including accent normalization, text masking, and string utilities
A TypeScript library for Vietnamese text processing including accent normalization, text masking, and string utilities.
slugify for text normalization# use npm
npm install normalize-vietnamese
# use yarn
yarn add normalize-vietnamese
import Str from "normalize-vietnamese";
// or
import { Str } from "normalize-vietnamese";
The normalizeVietnameseAccent method corrects Vietnamese accent placement according to Vietnamese grammar rules:
// Correct diphthongs (2 vowels) - accent on first vowel
Str.normalizeVietnameseAccent("toà"); // returns 'tòa'
Str.normalizeVietnameseAccent("thuỷ"); // returns 'thủy'
// Correct triphthongs (3 vowels) - accent on second vowel
Str.normalizeVietnameseAccent("tòan"); // returns 'toàn'
Str.normalizeVietnameseAccent("khủyu"); // returns 'khuỷu'
// Exception: ê and ơ have priority regardless of position
Str.normalizeVietnameseAccent("thủơ"); // returns 'thuở'
Str.normalizeVietnameseAccent("chuỵên"); // returns 'chuyện'
// Handle special consonant clusters (gi, qu)
Str.normalizeVietnameseAccent("gìa"); // returns 'già'
Str.normalizeVietnameseAccent("qủa"); // returns 'quả'
// Process multiple words
Str.normalizeVietnameseAccent("tòa nhà toàn"); // returns 'tòa nhà toàn'
ê and ơ have priority regardless of positiongi and qu are treated as single consonants// Mask entire string
Str.mask("hello"); // returns '*****'
// Mask with start and end positions
Str.mask("hello", 1, 4); // returns 'h***o'
// Negative positions (from end)
Str.mask("hello", -2, 4); // returns 'hel*o'
Str.mask("hello", 1, -1); // returns 'h***o'
// Convert to lowercase, remove special characters
Str.normalize("Hello World!"); // returns 'hello world'
// Handles Vietnamese characters
Str.normalize("Xin chào thế giới!"); // returns 'xin chao the gioi'
Str.normalizeVietnameseAccent(text: string): stringNormalizes Vietnamese accent marks according to Vietnamese grammar rules.
text - The text to normalizeStr.mask(text: string, start?: number, end?: number): stringMasks part of a string with asterisks.
text - The text to maskstart - Start position (default: 0, supports negative values)end - End position (default: 0, supports negative values)Str.normalize(text: string): stringNormalizes text by converting to lowercase and removing special characters.
text - The text to normalizegit clone https://github.com/nvminh461/normalize-vietnamese
cd normalize-vietnamese
npm install
# Build the library
npm run build
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate test coverage
npm run test:coverage
# Development mode (watch for changes)
npm run dev
The library includes comprehensive tests covering all functionality:
npm test
MIT
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)FAQs
A TypeScript library for Vietnamese text processing including accent normalization, text masking, and string utilities
The npm package normalize-vietnamese receives a total of 49 weekly downloads. As such, normalize-vietnamese popularity was classified as not popular.
We found that normalize-vietnamese demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.