Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquerysimplemask

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquerysimplemask - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

2

dist/jQuery.SimpleMask.min.js

@@ -1,2 +0,2 @@

/* Version: 1.0.9 - Last modified: 2022-10-07 12:27:19 */
/* Version: 1.0.10 - Last modified: 2022-10-07 14:58:02 */
String.prototype.simpleMaskStringCount=function(e){return(this.length-this.replace(new RegExp(e,"g"),"").length)/e.length},function(h){var n={mask:"",nextInput:null,onComplete:null},o=[],t={init:function(e){var t=h.extend({},n,e);return this.each(function(){h.fn.simpleMask.process(h(this),t)})},unmask:function(){return this.each(function(){h.fn.simpleMask.unmask(this)})}};h.fn.simpleMask=function(e){return t[e]?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void h.error("Method "+e+" does not exist on jQuery.SimpleMask"):t.init.apply(this,arguments)},h.fn.simpleMask.makeId=function(){for(var e="",t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",n=t.length,s=0;s<8;s++)e+=t.charAt(Math.floor(Math.random()*n));return e},h.fn.simpleMask._onComplete=function(e){e="object"==typeof e?h(e).attr("data-mask-ids"):e;null!==o[e].options.onComplete&&o[e].options.onComplete.call(this,o[e]),h.fn.simpleMask._nextInput(e)},h.fn.simpleMask.nextOnTabIndex=function(e){var n=h(e),s=!1,a=[];return n.closest("form").find("input,select").each(function(e){var t=h(this);if(s)return a=t,!1;t[0]==n[0]&&(s=!0)}),a},h.fn.simpleMask._nextInput=function(e){var t,e="object"==typeof e?h(e).attr("data-mask-ids"):e;null!==o[e].options.nextInput&&(!0===o[e].options.nextInput?0<(t=h.fn.simpleMask.nextOnTabIndex(o[e].element)).length&&t.select().focus():0<o[e].options.nextInput.length&&o[e].options.nextInput.select().focus())},h.fn.simpleMask.unmask=function(e){e="object"==typeof e?h(e).attr("data-mask-ids"):e;h(o[e].element).removeClass("input-masked").removeAttr("data-mask-ids"),""===h(o[e].element).attr("class")&&h(o[e].element).removeAttr("class"),h(document).off("keyup.simpleMask change.simpleMask",'input[data-mask-ids="'+e+'"]'),h(document).off("keydown.simpleMask",'input[data-mask-ids="'+e+'"]')},h.fn.simpleMask.isNumber=function(e){return""!==e.replace(/\D/g,"")},h.fn.simpleMask.onlyNumbers=function(e){return e.replace(/\D/g,"")},h.fn.simpleMask.onlyNumbersLength=function(e){return e.replace(/\D/g,"").length},h.fn.simpleMask.applyMask=function(e,t){var n,s=e.element,a=h(s)[0],a=(a.selectionStart,a.selectionEnd),l=e.oldvalue,o=h(s).val(),i=h.fn.simpleMask.onlyNumbers(h(s).val()),r=e.masks[0],m=e.masks[e.masks.length-1].simpleMaskStringCount("#"),p=(i=i.length>m?i.substr(0,m):i).length;for(n in e.masks)if(e.masks[n].simpleMaskStringCount("#")==p){r=e.masks[n];break}if(0<i.length){for(var u=r,k=(i=i.trim()).length,c=0;c<k;c++)u=u.replace("#",i.charAt(c));for(var m=u.indexOf("#"),f=(u=-1!=m?u.substr(0,m):u).substr(u.length-1,1),d=(u=""===h.fn.simpleMask.onlyNumbers(f)?u.substr(0,m-1):u).substr(u.length-1,1);0<u.length&&!1===h.fn.simpleMask.isNumber(d);)d=(u=u.substr(0,u.length-1)).substr(u.length-1,1);u!=o&&h(s).val(u),u!=l&&u.length==r.length&&u.length<=a&&u.length==e.maxlengthmask&&Number.isInteger(t)&&h.fn.simpleMask._onComplete(s.attr("data-mask-ids"))}else h(s).val("");e.oldvalue=h(s).val()},h.fn.simpleMask.process=function(e,t){for(var n=h.fn.simpleMask.makeId();void 0!==o[n];)n=h.fn.simpleMask.makeId();var s,a={},l=(a.element=e,a.options=t,a.nextInput=t.nextInput,a.onComplete=t.onComplete,a.oldvalue=h(e).val(),[]);for(s in l="string"==typeof t.mask?[t.mask]:t.mask)switch(l[s].toLowerCase()){case"cpf":l[s]="###.###.###-##";break;case"cnpj":l[s]="##.###.###/####-##";break;case"cep":l[s]="#####-###";break;case"date":case"data":l[s]="##/##/####";break;case"telefone":case"tel":l[s]="####-####";break;case"telefone9":case"tel9":l[s]="####-####",l.push("#####-####");break;case"ddd-telefone9":case"ddd-tel9":l[s]="(##) ####-####",l.push("(##) #####-####")}a.masks=l,a.masks.sort(function(e,t){return e.length-t.length}),a.maxlengthmask=a.masks[a.masks.length-1].length,o[n]=a,e.attr("data-mask-ids",n).addClass("input-masked"),h(document).on("keyup.simpleMask change.simpleMask",'input[data-mask-ids="'+n+'"]',function(e){h.fn.simpleMask.applyMask(a,parseInt(e.key))}),h(document).on("paste",'input[data-mask-ids="'+n+'"]',function(e){var t=h(this);setTimeout(function(){t.keyup()},100)}),h(document).on("keydown.simpleMask",'input[data-mask-ids="'+n+'"]',function(e){e.ctrlKey||65<=e.keyCode&&e.keyCode<=90&&(e.metaKey||e.preventDefault())}),h.fn.simpleMask.applyMask(a)}}(jQuery);
{
"name": "jquerysimplemask",
"version": "1.0.9",
"version": "1.0.10",
"description": "Simple and fast number input masks.",

@@ -47,13 +47,6 @@ "main": "dist/jQuery.SimpleMask.min.js",

},
"resolutions": {
"nth-check": ">=2.0.1",
"glob-parent": ">=5.1.2"
},
"scripts": {
"preinstall": "npx npm-force-resolutions",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"npm-force-resolutions": "0.0.10"
"test": "echo \"Error: no test specified\" && exit 1",
"audit": "yarn npm audit --recursive"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc