A collection of handy vuejs filters.
npm install vue-filters-collectioncamelcasToReadable - Will converts a camelcase string to a readable string JamesMay will be James May
capitalize - takes an argument, _first_ capitalizies the first character/s in a string. eg james may will be James May
decapitalize - converts the whole string to small letters.
htmlEntities - substitutes " htmlentity with a double quote.
replaceAll - finds and replace all occurrences for a single string.
npm install vue-filters-collection
or
yarn add vue-filters-collection
`
$3
`javascript
import Vue from 'vue';
import vueFiltersCollection from 'vue-filters-collection';
Vue.use(vueFiltersCollection);
`
$3
`javascript
{{ pCapitalize | capitalize }}
//JAMES MAY
{{ pCapitalize | capitalize("first") }}
//Jame May
{{ pDecapitalize | decapitalize }}
//james may
{{ pEntities | htmlEntities }}
//Hello "james" may
{{ pCamelcase | camelcase }}
//Asta Lavista Baby
{{ pReplaceAll }} :{{ pReplaceAll | replaceAll("this", "that") }} -
replace all
//that is not a thattle, that is a cactus
{{ key }} --------------
{{ key | htmlEntities }}
{{ pEntities }} :{{ pEntities | htmlEntities }} - htmlEntities
`
$3
`javascript
doTheBoogie(){
console.log(this.$options.filters.capitalize(this.pCapitalize)); //JAMES MAY
//or
console.log(this.$capitalize("james"));
// ......
}
``