From 5d08ef5eb8982b1c250137fa4beca383e2b9f6ee Mon Sep 17 00:00:00 2001 From: Prappo Prince Date: Tue, 24 May 2016 01:02:47 +0600 Subject: [PATCH] Added mask method # use S('secret').mask(2) // se**** S('secret').mask(-2) // ****et S('secret').mask(2, '!') // se!!!! according to this issue => https://github.com/jprichardson/string.js/issues/172 --- dist/string.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/dist/string.js b/dist/string.js index 85de7ae..ff39b2f 100644 --- a/dist/string.js +++ b/dist/string.js @@ -166,6 +166,30 @@ string.js - Copyright (C) 2012-2014, JP Richardson charAt: function(index) { return this.s.charAt(index); }, + + mask: function(index,sign="*"){ + var input = this.s; + var inputLength = input.length; + var sec = ""; + if(index > 0){ + var a = inputLength - index; + for(var i = 0;i },{"./_count":1,"./_splitLeft":2,"./_splitRight":3}]},{},[4]) (4) -}); \ No newline at end of file +});