npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aurelia-mask

v2.0.1

Published

[![npm version](https://badge.fury.io/js/aurelia-mask.svg)](http://badge.fury.io/js/aurelia-mask)

Readme

npm version

This is a port of Angular's UI-Mask to Aurelia.

Apply a mask on an input field so the user can only type pre-determined pattern.

Requirements

  • aurelia

Installation

jspm

jspm install aurelia-mask=github:ariovistus/aurelia-mask

npm

npm install aurelia-mask

Usage

in your template:

<input masked="value.bind: myvalue; mask.bind: mymask" />

be sure to include the necessary require in the template:

<require from="aurelia-mask/masked-input"></require>

or register it globally:

aurelia.use
    .standardConfiguration()
    ...
    .globalResources("aurelia-mask/masked-input")
    ...

If you have 1.2 or later (and aren't using webpack) you can just reference the package:

<require from="aurelia-mask"></require>

may need to be this if you're using npm:

aurelia.use
    .standardConfiguration()
    ...
    .globalResources("aurelia-mask/dist/masked-input")
    ...

notes

  • do not apply a value binding to the input, that will interfere with the plumbing
    <!-- bad! -->
    <input masked="..." value.bind="myvalue" />
  • mask has the same format as default ui-mask
    • 9 → number
    • a → alpha
    • * → number or alpha

Two way binding

Seamless two way binding causes issues. If you need to change the model value from code, you can do the following:

    <input masked="..." masked.ref="masker" />

and in your view model

    this.masker.setValue(myvalue);

Options

placeholder

the default placeholder char is '_'. You can override it.

<input masked="value.bind: myvalue; mask: (999) 999-9999; placeholder: *" />

| mask | ui value | model value | | ---- | -------- | ----------- | | (999) 999-9999 | (***) ***-**** | '' |

special case for space:

<input masked="value.bind: myvalue; mask: 99/99; placeholder: space" />

| mask | ui value | model value | | ---- | -------- | ----------- | | (999) 999-9999 | '( ) - ' | '' |

bind-masking

by default, any punctuation characters are stripped out of the value, e.g:

| mask | ui value | model value | | ---- | -------- | ----------- | | (999) 999-9999 | (800) 888-8888 | 8008888888 |

you can override this:

<input masked="value.bind: myvalue; mask: (999) 999-9999; bind-masking: true" />

| mask | ui value | model value | | ---- | -------- | ----------- | | (999) 999-9999 | (800) 888-8888 | (800) 888-8888 |

aspnet masking

don't know what to call this, but sometimes you want a more relaxed mode where you can enter characters at any position, not just the start

<input masked="value.bind: myvalue; mask: (999) 999-9999; aspnet-masking: true;" />

| mask | ui value | model value | | ---- | -------- | ----------- | | /999/999/9999/ | /__0/_8_/8888/ | /__0/_8_/8888/ |

The masker object exposes a function to strip off the placeholder characters:

var masker = getMasker({maskFormat: "/999/999/9999/", aspnetMasking: true})
var result = masker.stripPlaceholders("/__0/_8_/8888/");
expect(result).toBe("/0/8/8888/");

not that that's hard to do yourself. have yet to figure out how to incorporate it in the binding.

edit mode

by default it is insert. You can also specify overtype mode.

<input masked="value.bind: myvalue; mask: (999) 999-9999; edit-mode: overtype" />

Currently only works with aspnet mode.

change event

you can specify a callback on change:

<input masked="value.bind: myvalue; mask: 9; change.call: onChange()" />
  • don't use change.trigger on the input
  • don't use BindingEngine on myvalue