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

awesome-mask

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-mask - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

19

index.js

@@ -11,2 +11,6 @@ 'use strict';

var _vue = require('vue');
var _vue2 = _interopRequireDefault(_vue);
var _isCharacterKeypress = require('./is-character-keypress');

@@ -35,2 +39,11 @@

var applyMaskToDefault = function applyMaskToDefault(el, mask) {
var isInputText = el instanceof HTMLInputElement;
var inputText = el;
if (!isInputText) {
inputText = el.querySelector('input');
}
inputText.value = mask && mask.length > 0 ? _vanillaMasker2.default.toPattern(inputText.value, mask) : inputText.value;
};
exports.default = {

@@ -40,5 +53,11 @@ bind: function bind(el, binding) {

el.dataset.mask = binding.value;
applyMaskToDefault(el, binding.value);
el.setAttribute('maxlength', el.dataset.mask.length);
el.addEventListener('keydown', inputHandler);
},
update: function update(el, binding) {
// this is only for v-model
if (binding.value.length < 1) return;
applyMaskToDefault(el, binding.value);
},
unbind: function unbind(el, binding) {

@@ -45,0 +64,0 @@ if (binding.value.length < 1) return;

2

package.json
{
"name": "awesome-mask",
"version": "0.3.5",
"version": "0.3.6",
"description": "An awesome mask directive for Vue.js using vanilla-masker from `https://github.com/BankFacil/vanilla-masker`",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -45,27 +45,18 @@ The awesome-mask runs with `Vue.js` and uses the `vanilla-masker` to make your form awesome with masks.

You can also change the mask on the fly:
Sample using import:
```vue
<template>
<p>
<input v-mask="mask" type="text" @input="updateMask">
</p>
</template>
import Component from './components/Component'
import AwesomeMask from 'awesome-mask'
<script>
export default {
data() {
return {
mask: '999.999.999-99'
}
name: 'app',
components: {
Component
},
methods: {
updateMask (val) {
if(val.lenght > 14){
this.mask = '99.999.999/9999-99'
}
}
directives: {
'mask': AwesomeMask
}
}
</script>
```
DISCLAIMER: If you use Windows, please use the version `0.3.3`, there was a problem with Vanilla-Masker to build at Windows.
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