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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fasting-troubadour

v0.2.2

Published

some aurelia behaviors

Downloads

4

Readme

npm version

Some useful binding behaviors for aurelia.

Installation

npm install fasting-troubadour

for requirejs based cli, add to aurelia.json dependencies:

          {
              "name": "fasting-troubadour",
              "path": "../node_modules/fasting-troubadour/dist",
              "main": "index"
          }

you can also register it as a plugin in main.ts:

      aurelia.use
          .plugin("fasting-troubadour")

this is optional, it will just register all of the binding behaviors as global resources

Trim

trims leading and trailing whitespace

<require from="fasting-troubadour/trim-binding-behavior"></require>

<input type="text" value.bind="val & trim" />

Notes

  • if you are using aurelia-validation, be sure to place trim after validate
<!-- bad (has cause me problems in the past) -->
<input type="text" value.bind="val & trim & validate" />


<!-- ok -->
<input type="text" value.bind="val & validate & trim" />

Formatted Number

formats number inputs after you tab away. Controls the minimum and maximum permitted values; the bound value is expected to be a number.

<require from="fasting-troubadour/formatted-number-behavior"></require>

<input type="text" value.bind="dollars & formattedNumber"/>

<!-- custom format -->
<input type="text" value.bind="dollars & formattedNumber:'0.00000'"/>

<!-- custom format and min/max -->
<input type="text" value.bind="dollars & formattedNumber:'0.00000':0:1000000"/>

Notes

  • numeraljs is the formatting engine
  • default format is '0.00'
  • you can emit an event to force the displayed value to be formatted
    this.eventAggregator.publish("formatted-number:refresh");

Numeric Input

constrains input to only accept numeric characters. Bound value is not expected to be a number (eg a string)

<require from="fasting-troubadour/numeric-input-behavior"></require>

<input type="text" value.bind="zip & numericInput"/>

Alphanumeric Input

constrains input to only accept alphanumeric characters.

<require from="fasting-troubadour/alphanumeric-input-behavior"></require>

<input type="text" value.bind="zip & alphanumericInput"/>

Name Input

constraints input to only accept alpha characters or space, apostraphe, or dash

<require from="fasting-troubadour/name-input-behavior"></require>

<input type="text" value.bind="zip & nameInput"/>

Notes

  • todo: accept more than english alphanumeric characters

Numeric Name Input

constraints input to only above name characters or numeric characters.

<require from="fasting-troubadour/numeric-name-input-behavior"></require>

<input type="text" value.bind="zip & numericNameInput"/>

Custom Characters Input

constrains input to only the characters matched by the provided regex.

<require from="fasting-troubadour/custom-chars-input-behavior"></require>

<input type="text" value.bind="zip & customCharsInput:myRegex"/>

Notes

  • regex is applied to each character - e.g. regex="[a-z]" will allow the entire input to be "a", "aa", "aaz", etc.

Number Format

A value converter to format numbers that wraps numeraljs. You've probably seen it in every value converter tutorial you've read.

<require from="fasting-troubadour/number-format"></require>

${ val | numberFormat:'0.0000' }