Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chamuth Chamandana Thilakarathne Chamuth

🏠
Working from home
Block or report user

Report or block Chamuth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Chamuth
Chamuth / lkphones.ts
Created Nov 21, 2018
Validate Sri Lankan phones numbers and get their carrier
View lkphones.ts
export module LKPhoneValidator
{
export function Validate(phone : string) : PhoneValidation
{
// remove starting +94
phone = phone.replace("+94", "0");
// Consider number length
if ((phone.startsWith('0') && phone.length == 10) || (!phone.startsWith('0') && phone.length == 9) && /^\d+$/.test(phone))
{
You can’t perform that action at this time.