Skip to content

Instantly share code, notes, and snippets.

View lnt's full-sized avatar
🏠
Working from home

Lalit Tanwar | The Architect lnt

🏠
Working from home
View GitHub Profile
@lnt
lnt / mask_card_number.js
Last active November 26, 2021 15:23
Mask Debit/Credit Card number
const maskCard = (str)=>
str.replace(/\b(?:\d{4}[ - ]?){3}(?=\d{4}\b)/gm,'#### #### ####');
maskCard('visa 1234 3456 4567 5678')
// 'visa #### #### ####5678'
@lnt
lnt / enum.js
Created December 26, 2018 06:10
Enum in JavaScript
var Enum = (function(foo) {
var EnumItem = function(item){
if(typeof item == "string"){
this.name = item;
} else {
this.name = item.name;
}
}
EnumItem.prototype = new String("DEFAULT");
EnumItem.prototype.toString = function(){
@lnt
lnt / persontest
Created December 4, 2014 15:52
Sample Parent Module
utils.define("persontest",function(persontest,_person_){
var person = utils.module("person");
var person_form = utils.module("person_form");
persontest._ready_ = function(){
this.person = person.instance().init($("#person_module"));