Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue2-filters

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue2-filters

The list of standard filters Vue.js 1.* adapted for use in Vue.js 2.*

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-6.34%
Maintainers
1
Weekly downloads
 
Created
Source

vue2-filters

The list of standard filters Vue.js 1.* adapted for use in Vue.js 2.*

Installation

Direct include

Simply include vue2-filters after Vue and it will install itself automatically:

<script src="vue.js"></script>
<script src="vue2-filters.min.js"></script>

CDN

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/vue2-filters/0.1.3/vue2-filters.min.js"></script>

NPM

npm install vue2-filters

When used with a module system, you must explicitly install the filters via Vue.use():

import Vue from 'vue'
import Vue2Filters from 'vue2-filters'

Vue.use(Vue2Filters)

You don't need to do this when using global script tags.

Usage

capitalize
  • Example:

{{ msg | capitalize }} // 'abc' => 'Abc'



#### uppercase

+ Example:

  ```js
{{ msg | uppercase }} // 'abc' => 'ABC'
lowercase
  • Example:

{{ msg | lowercase }} // 'ABC' => 'abc'


#### currency

+ Arguments:
  * `{String} [symbol] - default: '$'`
  * `{Number} [decimal places] - default: 2`

+ Example:

  ```js
{{ amount | currency }} // 12345 => $12,345.00

Use a different symbol:

{{ amount | currency('£') }} // 12345 => £12,345.00

Use a different number decimal places:

{{ amount | currency('₽', 0) }} // 12345 => ₽12,345
pluralize
  • Arguments:

    • {String} single, [double, triple, ...]
  • Example:

{{count}} {{count | pluralize('item')}}

// 1 => '1 item' // 2 => '2 items'


  ```js
{{date}} {{date | pluralize('st','nd','rd','th')}} 

// 1 => '1st'
// 2 => '2nd'
// 3 => '3rd'
// 4 => '4th'
// 5 => '5th'
limitBy
  • Arguments:

    • {Array} [items]
    • {Number} [limit]
    • {Number} [offset]
  • Example:

```
filterBy
  • Arguments:

    • {Array} [items]
    • {String} [query]
    • {String} [searchKey]
  • Example:

```
orderBy
  • Arguments:

    • {Array} [items]
    • {String} [sortKey]
    • {Number} [order] - default: 1
  • Example:

    Sort users by name:

  • {{ user.name }}
``` In descending order: ```html
  • {{ user.name }}
```

Contribution

If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.

License

MIT

Keywords

FAQs

Package last updated on 23 Nov 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc