Integrations > Other


vue-underscore 0.07


simple vue plugin to implement underscore
    last commit 5 years ago
    18
    Stargazers

    Watchers
    18
    Open issues
    0
    205621
    Downloads

    Last 30 days
    11939
    Releases
    5
    37
    Final Score

    Quality
    52
    Popularity
    10
    Maintenance
    50

    vue-underscore

    You know Underscore.js is a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...) without extending any core JavaScript objects. I arranged it as a vue plugin to use on your projects.

    Version Packagist

    Table of Contents

    Requirements

    Installation

    # npm
    $ npm install vue-underscore
    
    

    Usage

    After using the plugin on main.js. You can call it simply with 'this.$_.findwhere' (each, map, reduce, filter...)

    main.js

    import Vue from 'vue';
    import underscore from 'vue-underscore';
    import App from './App';
    
    Vue.use(underscore);
    
    new Vue({
      ...App
    }).$mount('#app');
    

    If you wouldn't like to access from vue prototype, you can add underscore on the component source code directly via below.

    import {_} from 'vue-underscore';
    
    let testArr = [{id: 1}, {id:2}];
    let foundInfo = _.findWhere(testArr, {id:1});
    
    

    Examples

    
    <script>
    export default {
      methods: {
        test () {
          let testArr = [{id: 1}, {id:2}];
      
          let foundInfo = this.$_.findWhere(testArr, {id:1});
        
        }
      }
    }
    </script>
    
    

    License

    The MIT License