@tadashi/mask
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -59,12 +59,9 @@ let _cc = 0; | ||
if (instance instanceof Mask) { | ||
return instance | ||
throw new TypeError('The input has already been instanced. Use the static method `Mask.data(input)` to get the instance.') | ||
} | ||
this.events = new Set(); | ||
this.input = input; | ||
this.mask = input.dataset?.mask ?? this.opts.mask; | ||
// this.mask = input.dataset?.mask ?? this.opts.mask | ||
this.mask = input.dataset.mask || this.opts.mask; | ||
// Check if has mask | ||
@@ -71,0 +68,0 @@ if (this.mask.length === 0) { |
@@ -64,12 +64,9 @@ (function (global, factory) { | ||
if (instance instanceof Mask) { | ||
return instance | ||
throw new TypeError('The input has already been instanced. Use the static method `Mask.data(input)` to get the instance.') | ||
} | ||
this.events = new Set(); | ||
this.input = input; | ||
this.mask = input.dataset?.mask ?? this.opts.mask; | ||
// this.mask = input.dataset?.mask ?? this.opts.mask | ||
this.mask = input.dataset.mask || this.opts.mask; | ||
// Check if has mask | ||
@@ -76,0 +73,0 @@ if (this.mask.length === 0) { |
{ | ||
"name": "@tadashi/mask", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "The simple and tiny script for input mask", | ||
@@ -41,5 +41,6 @@ "keywords": [ | ||
"globals": [ | ||
"beforeEach", | ||
"test", | ||
"expect", | ||
"document", | ||
"window", | ||
"HTMLElement", | ||
"HTMLInputElement" | ||
@@ -51,4 +52,3 @@ ], | ||
"capitalized-comments": 0, | ||
"unicorn/prevent-abbreviations": 0, | ||
"no-constructor-return": 0 | ||
"unicorn/prevent-abbreviations": 0 | ||
} | ||
@@ -58,8 +58,8 @@ }, | ||
"@babel/preset-env": "7.13.10", | ||
"babel-jest": "26.6.3", | ||
"jest": "26.6.3", | ||
"npm-run-all": "4.1.5", | ||
"rollup": "2.41.0", | ||
"rollup": "2.41.1", | ||
"simulant": "0.2.2", | ||
"xo": "0.38.2" | ||
} | ||
} |
@@ -30,18 +30,8 @@ # Mask | ||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, user-scalable=no"> | ||
<title>Example</title> | ||
</head> | ||
<body> | ||
<input id="telefone" type="text" data-mask="(99) 9-9999-9999"> | ||
<script type="module"> | ||
import Mask from './node_modules/@tadashi/mask/dist/index.js' | ||
const mask = new Mask(telefone) | ||
</script> | ||
</body> | ||
</html> | ||
<input id="telefone" type="text" data-mask="(99) 9-9999-9999"> | ||
<script type="module"> | ||
import Mask from 'https://unpkg.com/@tadashi/mask@{version}/src/index.js' | ||
const mask = new Mask(telefone) | ||
</script> | ||
``` | ||
@@ -48,0 +38,0 @@ |
@@ -61,12 +61,9 @@ 'use strict' | ||
if (instance instanceof Mask) { | ||
return instance | ||
throw new TypeError('The input has already been instanced. Use the static method `Mask.data(input)` to get the instance.') | ||
} | ||
this.events = new Set() | ||
this.input = input | ||
this.mask = input.dataset?.mask ?? this.opts.mask | ||
// this.mask = input.dataset?.mask ?? this.opts.mask | ||
this.mask = input.dataset.mask || this.opts.mask | ||
// Check if has mask | ||
@@ -73,0 +70,0 @@ if (this.mask.length === 0) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24013
282
42