Installations
npm install vue-imask
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
21.7.3
NPM Version
lerna/8.1.2/node@v21.7.3+arm64 (darwin)
Score
82.5
Supply Chain
98.3
Quality
79.8
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (93.31%)
JavaScript (3.67%)
HTML (2.96%)
Ruby (0.05%)
Developer
Download Statistics
Total Downloads
4,100,324
Last Day
6,013
Last Week
27,018
Last Month
105,214
Last Year
1,591,798
GitHub Statistics
5,009 Stars
956 Commits
262 Forks
30 Watching
9 Branches
29 Contributors
Bundle Size
64.26 kB
Minified
17.25 kB
Minified + Gzipped
Package Meta Information
Latest Version
7.6.1
Package Id
vue-imask@7.6.1
Unpacked Size
142.65 kB
Size
27.39 kB
File Count
34
NPM Version
lerna/8.1.2/node@v21.7.3+arm64 (darwin)
Node Version
21.7.3
Publised On
21 May 2024
Total Downloads
Cumulative downloads
Total Downloads
4,100,324
Last day
-3.4%
6,013
Compared to previous day
Last week
-5.6%
27,018
Compared to previous week
Last month
-2.4%
105,214
Compared to previous month
Last year
68.5%
1,591,798
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Vue IMask Plugin
vue-imask
![](https://opencollective.com/imask/donate/button.png?color=blue)
Install
npm i vue-imask
for Vue 2 also do:
npm i -D @vue/composition-api
If you are using NuxtJS with Vue 2 you also need to install:
npm i -D @nuxtjs/composition-api
And then add @nuxtjs/composition-api/module
in the buildModules option in your nuxt.config.js
.
Mask Component Example (Vue 2)
1<template> 2 <imask-input 3 v-model="numberModel" 4 :mask="Number" 5 radix="." 6 :unmask="true" 7 <!-- depending on prop above first argument of 'accept' callback is 8 `value` if `unmask=false`, 9 `unmaskedValue` if `unmask=true`, 10 `typedValue` if `unmask='typed'` --> 11 @accept="onAccept" 12 13 <!-- ...see more mask props in a guide --> 14 15 <!-- other input props --> 16 placeholder='Enter number here' 17 /> 18</template> 19 20<script> 21 import { IMaskComponent } from 'vue-imask'; 22 23 export default { 24 data () { 25 return { 26 numberModel: '', 27 onAccept (value) { 28 console.log(value); 29 } 30 } 31 }, 32 components: { 33 'imask-input': IMaskComponent 34 } 35 } 36</script>
Mask Component Example (Vue 3)
1<template> 2 <imask-input 3 <!-- possible to use 'v-model' = 'v-model:value' = 'v-model:masked' and 'v-model:unmasked' --> 4 v-model:typed="numberModel" 5 :mask="Number" 6 radix="." 7 @accept:masked="onAccept" <!-- accept value (same as '@accept:value' or just '@accept') --> 8 @accept:unmasked="onAcceptUnmasked" 9 <!-- 10 @accept:typed="onAccepttyped" 11 @complete:typed="onCompleteTyped" 12 --> 13 14 <!-- ...see more mask props in a guide --> 15 16 <!-- other input props --> 17 placeholder='Enter number here' 18 /> 19</template> 20 21<script> 22 import { IMaskComponent } from 'vue-imask'; 23 24 export default { 25 data () { 26 return { 27 numberModel: '', 28 onAccept (value) { 29 console.log({ value }); 30 }, 31 onAcceptUnmasked (unmaskedValue) { 32 console.log({ unmaskedValue }); 33 } 34 } 35 }, 36 components: { 37 'imask-input': IMaskComponent 38 } 39 } 40</script>
Mask Directive Example
In some cases value bindings (v-model
) might not work for directive, you can use @accept
or @complete
events to update the value.
1<template> 2 <input 3 :value="value" 4 v-imask="mask" 5 @accept="onAccept" 6 @complete="onComplete"> 7</template> 8 9<script> 10 import { IMaskDirective } from 'vue-imask'; 11 12 export default { 13 data () { 14 return { 15 value: '', 16 mask: { 17 mask: '{8}000000', 18 lazy: false 19 }, 20 }, 21 }, 22 methods: { 23 onAccept (e) { 24 const maskRef = e.detail; 25 this.value = maskRef.value; 26 console.log('accept', maskRef.value); 27 }, 28 onComplete (e) { 29 const maskRef = e.detail; 30 console.log('complete', maskRef.unmaskedValue); 31 }, 32 }, 33 directives: { 34 imask: IMaskDirective 35 } 36 } 37</script>
More options see in a guide.
Mask Composable (Vue 3)
1<template> 2 <input ref="el"> 3</template> 4 5<script> 6 import { useIMask } from 'vue-imask'; 7 8 export default { 9 setup (props) { 10 const { el, masked } = useIMask({ 11 mask: Number, 12 radix: '.', 13 }, /* optional { 14 emit, 15 onAccept, 16 onComplete, 17 defaultValue, 18 defaultUnmaskedValue, 19 defaultTypedValue, 20 } */); 21 22 return { el }; 23 } 24 } 25</script>
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
GitHub workflow tokens follow principle of least privilege
Details
- Info: topLevel 'contents' permission set to 'read': .github/workflows/deploy.yml:13
- Info: no jobLevel write permissions found
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/uNmAnNeR/imaskjs/deploy.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Reason
31 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-pxvg-2qj5-37jq
- Warn: Project is vulnerable to: GHSA-r95h-9x8f-r3f7
- Warn: Project is vulnerable to: GHSA-vcc3-rw6f-jv97
- Warn: Project is vulnerable to: GHSA-xc9x-jj77-9p9j
- Warn: Project is vulnerable to: GHSA-2rxp-v6pw-ch6m
- Warn: Project is vulnerable to: GHSA-4xqq-m2hx-25v8
- Warn: Project is vulnerable to: GHSA-5866-49gr-22v4
- Warn: Project is vulnerable to: GHSA-r55c-59qm-vjw6
- Warn: Project is vulnerable to: GHSA-vg3r-rm7w-2xgh
- Warn: Project is vulnerable to: GHSA-vmwr-mc7x-5vc3
- Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-mpg4-rc92-vx8v
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-8266-84wp-wv5c
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986 / GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6
- Warn: Project is vulnerable to: GHSA-5j4c-8p2g-v4jx
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More