Socket
Socket
Sign inDemoInstall

vue-filter-number-format

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-filter-number-format

Vue.js filter for formatting numbers


Version published
Weekly downloads
1.8K
decreased by-17.55%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

vue-filter-number-format

Vue.js filter for formatting numbers

This is a simple wrapper for Numeral.js.

Numeral.js 2 required

This package requires you to install Numeral.js as a peer dependency (numeral@^2). This way, you can use a different version of Numeral, or even a drop-in replacement with the same API. Use version 1 of this package if you want it to install its own Numeral.js dependency as part of the bundle.

Suggested usage

Pass in Numeral to create the formatter function, and register globally as a Vue filter in your main.js-ish file:

import numeral from 'numeral';
import numFormat from 'vue-filter-number-format';

Vue.filter('numFormat', numFormat(numeral));

// new Vue ...

Use anywhere in your .vue files:

// default format is '0,0'
{{ 69696969 | numFormat }} -> "69,696,969"

// use a custom format string
{{ 420 | numFormat('0.000') }} -> "420.000"
{{ 666 | numFormat('0,0o') }} -> "666th"

See the Numeral.js docs for other formatting options.

License

MIT

Keywords

FAQs

Last updated on 12 Apr 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc