
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
vue2-filters
Advanced tools
The list of standard filters Vue.js 1.* adapted for use in Vue.js 2.*
Simply include vue2-filters
after Vue and it will install itself automatically:
<script src="vue.js"></script>
<script src="vue2-filters.min.js"></script>
<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 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.
Example:
{{ msg | capitalize }} // 'abc' => 'Abc'
#### uppercase
+ Example:
```js
{{ msg | uppercase }} // 'abc' => 'ABC'
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
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'
Arguments:
{Array} [items]
{Number} [limit]
{Number} [offset]
Example:
Arguments:
{Array} [items]
{String} [query]
{String} [searchKey]
Example:
Arguments:
{Array} [items]
{String} [sortKey]
{Number} [order] - default: 1
Example:
Sort users by name:
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.
FAQs
A collection of Vue.js filters
The npm package vue2-filters receives a total of 24,865 weekly downloads. As such, vue2-filters popularity was classified as popular.
We found that vue2-filters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.