Giter Club home page Giter Club logo

idimetrix / vue-case Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.56 MB

A collection of Vue.js case filters: `camelCase`, `PascalCase`, `Capital Case`, `Header-Case`, `Title Case`, `path/case`, `snake_case`, `param-case`, `dot.case`, `CONSTANT_CASE`, `lower case`, `lOWER CASE FIRST`, `UPPER CASE`, `Upper case first` and other

Home Page: https://idimetrix.github.io/vue-case

JavaScript 46.67% HTML 9.68% Vue 43.65%
vue vue-case filters camel-case constant-case pascal-case change-case snake-case capital-case dot-case

vue-case's Introduction

vue-case Build Status

A collection of Vue.js case filters

Installation

Direct include

Simply include vue-case after Vue and it will install itself automatically:

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

CDN jsDelivr Hits

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

NPM npm

npm install vue-case

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

import Vue from 'vue'
import VueCase from 'vue-case'

Vue.use(VueCase)

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

Nuxt.js

npm install vue-case

When create file plugins/vue-case.js:

import Vue from 'vue'
import VueCase from 'vue-case'

Vue.use(VueCase)

Then, add the file inside the plugins key of nuxt.config.js:

module.exports = {
  //...
  plugins: [
    '~/plugins/vue-case'
  ],
  //...
}

Available Filters

Usage

camelCase

  • Example:

    {{ msg | camelCase }} // 'I LOVE vue-case' => 'iLoveVueCase'

pascalCase

  • Example:

    {{ msg | pascalCase }} // 'I LOVE vue-case' => 'ILoveVueCase'

capitalCase

  • Example:

    {{ msg | capitalCase }} // 'I LOVE vue-case' => '	I Love Vue Case'

headerCase

  • Example:

    {{ msg | headerCase }} // 'I LOVE vue-case' => 'I-Love-Vue-Case'

titleCase

  • Example:

    {{ msg | titleCase }} // 'I LOVE vue-case' => 'I LOVE Vue-Case'

pathCase

  • Example:

    {{ msg | pathCase }} // 'I LOVE vue-case' => 'i/love/vue/case'

paramCase

  • Example:

    {{ msg | paramCase }} // 'I LOVE vue-case' => 'i-love-vue-case'

dotCase

  • Example:

    {{ msg | dotCase }} // 'I LOVE vue-case' => 'i.love.vue.case'

snakeCase

  • Example:

    {{ msg | snakeCase }} // 'I LOVE vue-case' => 'i_love_vue_case'

constantCase

  • Example:

    {{ msg | constantCase }} // 'I LOVE vue-case' => 'I_LOVE_VUE_CASE'

lowerCase

  • Example:

    {{ msg | lowerCase }} // 'I LOVE vue-case' => 'i love vue-case'

lowerCaseFirst

  • Example:

    {{ msg | lowerCaseFirst }} // 'I LOVE vue-case' => 'i LOVE vue-case'

upperCase

  • Example:

    {{ msg | upperCase }} // 'I LOVE vue-case' => 'I LOVE VUE-CASE'

upperCaseFirst

  • Example:

    {{ msg | upperCaseFirst }} // 'I LOVE vue-case' => 'I LOVE vue-case'

swapCase

  • Example:

    {{ msg | swapCase }} // 'I LOVE vue-case' => 'i love VUE-CASE'

sentenceCase

  • Example:

    {{ msg | sentenceCase }} // 'I LOVE vue-case' => 'I love vue case'

noCase

  • Example:

    {{ msg | noCase }} // 'I LOVE vue-case' => 'i love vue case'

isLowerCase

  • Example:

    {{ msg | isLowerCase }} // 'I LOVE vue-case' => 'false'

isUpperCase

  • Example:

    {{ msg | isUpperCase }} // 'I LOVE vue-case' => 'false'

truncate

  • Example:

    {{ msg | truncate(10) }} // 'I LOVE vue-case' => 'I LOVE vue...'

Programmatic Usage

Aside from using filters inside templates you can do this programmatically using default filters object:

this.$options.filters.filterName(value)

For example, here's how you can use the truncate filter:

this.$options.filters.truncate('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 17) // => Lorem ipsum dolor...

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

vue-case's People

Contributors

idimetrix avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.