
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
prettyutils
Advanced tools
Custom validation utils (currently for RUT and Phone)
Each chilean citizen has its own RUT number, that is unique and unrepeatable number that useful as a method of identification. This consists of an 8-digit number with a verification digit that can be from 0 to 9 or a K.
The utilities for the use of the RUT number, consist in a set of tools that allow you to verify the validity of the number, give it a format, clean and get verifier digit. The utilities for the use of the phone number, consist in a set of tools that allow you to verify the validity of the number acording to their lenght, give it a format, clean and add a prefix to phone number.
npm install prettyutils --save
import { rutTools, phoneTools } from 'prettyutils';
rutTools.format((rut: string | undefined | null)); //Return string
rutTools.clean((rut: string | undefined | null)); //Return string
rutTools.calculateDv((rut: string | undefined | null)); //Return string
rutTools.validate((rut: string | undefined | null)); //Return boolean
phoneTools.format(
(phone: string | undefined | null),
(prefix: string),
(large: number),
); //Return string
phoneTools.clean((rut: string | undefined | null)); //Return string
phoneTools.calculateDv((rut: string | undefined | null)); //Return string
phoneTools.validate((rut: string | undefined | null)); //Return boolean
Input: String Rut
import { rutTools } from 'prettyutils';
rutTools.format('198765432'); // Returns 19.876.543-2
rutTools.format('19-8765-4-32'); // Returns 19.876.543-2
Input: String Rut
import { rutTools } from 'prettyutils';
rutTools.clean('08084750-5'); // Returns 80847505
rutTools.clean('1-8384889-5'); // Returns 183848895
Input: String Rut
import { rutTools } from 'prettyutils';
rutTools.calculateDv('16495221'); // Returns 5
rutTools.calculateDv('15280511'); // Returns K
Input: String Rut
import { rutTools } from 'prettyutils';
rutTools.validate('06099089-1'); // Returns true
rutTools.validate('21.44.509.7-6'); // Returns true
rutTools.validate('34566754-K'); // Returns false
Input: String phone
import { phoneTools } from 'prettyutils';
phoneTools.format('9 7888 6166'); // Returns 978886166
Input: String Phone
import { phoneTools } from 'prettyutils';
phoneTools.clean('+(156) 422 1234'); // Returns 1564221234
phoneTools.clean('35fdlp34/d'); // Returns 3534
Input: String Phone
import { phoneTools } from 'prettyutils';
phoneTools.addPrefix('978886666'); // Returns 56978886666
phoneTools.addPrefix('978886666', '1'); // Returns 1978886666
phoneTools.addPrefix('978886666', '13'); // Returns 13978886666
phoneTools.addPrefix('978886666', '14'); // Returns 14978886666
phoneTools.addPrefix('19788', '1', 5); // Returns 19788
phoneTools.addPrefix('9788', '1', 5); // Returns 19788
Input: String Phone
import { phoneTools } from 'prettyutils';
phoneTools.validate('+56 9 7888 6666'); // Returns true
phoneTools.validate('56978886666'); // Returns true
phoneTools.validate('978886666'); // Returns true
phoneTools.validate('123456'); // Returns false
Input: String Phone
import { phoneTools } from 'prettyutils';
phoneTools.validate('+56 987654321'); // Returns true
phoneTools.validate('56 987654321'); // Returns true
phoneTools.validate('56987654321'); // Returns true
phoneTools.validate('+1 987654321'); // Returns true
phoneTools.validate('56 987sometext654321'); // Returns false
npm test
FAQs
Utility functions to parse, validate and generate data
The npm package prettyutils receives a total of 61 weekly downloads. As such, prettyutils popularity was classified as not popular.
We found that prettyutils demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.