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

angular-currency-name

v1.0.0

Published

An angular filter that lets you input the shortname of any of the world currencies and then suffixes or prefixes the amount with the symbol.

Downloads

2

Readme

Angular Currency Name

Formats an input using the shortname of any of the world currencies provided.

Description

An angular filter that formats an input using the shortname of any of the world currencies provided, then suffixes or prefixes the input with the symbol. When no currency symbol is provided, default symbol for current locale is used. Formats input as currency (e.g ₦12,3445, 12,450.00₦)

Usage

In HTML Template Binding

{{ currency_expression | currencyName:shortName[:decimalPoints[:suffixSymbol]] }}

In Controller

$filter('currency')(amount, shortName[, decimalPoints[, suffixSymbol]])

Paramaters

Param | Type | Details :----------- | :------ | :------ amount | number | Input to filter. shortName | string | Short name of currency to be displayed. e.g 'naira', 'euro', 'dollar' Falls back to ng.$locale. decimalPoints | number | Number of decimal places to round the number to. Falls back to ng.$locale suffixSymbol | boolean or string | If set to true the currency symbol will be placed after the amount.

Returns

String: Formatted number.

Use cases in controllers

// With all parameters
expect(currency(1234.4239, 'naira', 1, true)).toEqual('1,234.4₦');

// Parameters without suffix
expect(currency(1234.4239, 'pound', 2)).toEqual('€1,234.42');

// With missing fraction size
expect(currency(1234.4239, 'dollar', true)).toEqual('1,234.42$');

// With fraction size only
expect(currency(1234.4239, 'baht', 3)).toEqual('฿1,234.424');

// Only with symbol
expect(currency(1234.4239, 'naira')).toEqual('₦1,234.42');

Example

HTML Template Binding

<span ng-bind="price | currencyName:'pound':true"></span> <!-- 1234.42€ -->
<span ng-bind="price | currency:'naira': 3"></span> <!-- ₦1234.423-->

JavaScript

angular.module('app', ['ngCurrencyName']).
    controller('Ctrl', function ( $scope, $filter ) {
        var currency = $filter('currencyName');
        $scope.price = currency(1234.4239, 'pound', 0, true); // 1234€
        $scope.price = currency(1234.4239, 'dollar', 2, false); // $1234.42
    });

Install

Via bower

bower install --save angular-currency-name

Include src/angular-currency-name.js or dist/angular-currency-name.min.js to your project.

<script src="/bower_components/angular-currency-name/dist/angular-currency-name.min.js"></script>

Don't forget to add ngCurrencyName module to your app's dependecies.

List of available currencies

Short Name | Symbol :----------- | :----- Afghani | ؋ Baht | ฿ Balboa | B/. BeliDollar | BZ$ Bolivar | Bs Bolíviano | $b Cedi | ¢ Colon | $ Cordoba | C$ Euro | € Denar | ден Dinar | Дин Dollar | $ DomPeso | RD$ Dong | ₫ Forint | Ft Franc | CHF Guarani | Gs Guilder | ƒ Hryvnia | ₴ IndiaRupee | ₹ Jdollar | J$ Kip | ₭ Koruna | Kč Krona | kr Krone | kr Kuna | kn Lek | Lek Lempira | L Leu | lei Lev | лв Lira | ₺ Manat | ман Marka | KM Metical | MT Naira | ₦ NewDollar | NT$ Peso | $ PhilPeso | ₱ Pound | £ Pula | P Quetzal | Q Rand | R Real | R$ Rial | ﷼ Riel | ៛ Ringgit | RM Riyal | ﷼ Ruble | ₽ Rupee | ₨ Rupiah | Rp Shekel | ₪ Shilling | S Sol | S/. Som | лв Tenge | лв TTD | TT$ Tughrik | ₮ UruPeso | $U Won | ₩ Yen | ¥ Yuan | ¥ ZimDollar | Z$ Zloty | zł

Pull requests

If I've missed out on any currency or you think I made a mistake in any of the available currencies, please send a pull request. More ideas are welcome.

License

MIT License