├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | .tmp 8 | .idea 9 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | .tmp 7 | .idea 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Haluk Keskin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-underscore 2 | 3 | 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. 4 | I arranged it as a vue plugin to use on your projects. 5 | 6 | [![Version](https://img.shields.io/npm/v/vue-underscore.svg)](https://www.npmjs.com/package/vue-underscore) 7 | [![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg?style=plastic)](https://www.npmjs.com/package/vue-underscore) 8 | 9 | 10 | # Table of Contents 11 | * [___Requirements___](#requirements) 12 | * [___Installation___](#installation) 13 | * [___Usage___](#usage) 14 | * [___Examples___](#examples) 15 | * [___License___](#license) 16 | 17 | # Requirements 18 | - [Vue.js](https://github.com/vuejs/vue) `2.x` 19 | 20 | 21 | # Installation 22 | ```bash 23 | # npm 24 | $ npm install vue-underscore 25 | 26 | ``` 27 | # Usage 28 | After using the plugin on main.js. You can call it simply with 'this.$_.findwhere' (each, map, reduce, filter...) 29 | 30 | main.js 31 | 32 | ```javascript 33 | import Vue from 'vue'; 34 | import underscore from 'vue-underscore'; 35 | import App from './App'; 36 | 37 | Vue.use(underscore); 38 | 39 | new Vue({ 40 | ...App 41 | }).$mount('#app'); 42 | ``` 43 | If you wouldn't like to access from vue prototype, you can add underscore on the component source code directly via below. 44 | 45 | ```javascript 46 | import {_} from 'vue-underscore'; 47 | 48 | let testArr = [{id: 1}, {id:2}]; 49 | let foundInfo = _.findWhere(testArr, {id:1}); 50 | 51 | ``` 52 | 53 | # Examples 54 | ```html 55 | 56 | 68 | 69 | ``` 70 | 71 | 72 | # License 73 | 74 | [The MIT License](http://opensource.org/licenses/MIT) 75 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import underscore from 'underscore'; 4 | 5 | export default { 6 | install: function(Vue, options) { 7 | Vue.prototype.$_ = underscore; 8 | } 9 | }; 10 | 11 | 12 | export const _= underscore; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-underscore", 3 | "version": "0.1.4", 4 | "description": "simple underscore implementation for vueJS", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/HKskn/vue-underscore.git" 12 | }, 13 | "author": "Haluk Keskin", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/HKskn/vue-underscore/issues" 17 | }, 18 | "homepage": "https://github.com/HKskn/vue-underscore#readme", 19 | "dependencies": { 20 | "underscore": "^1.8.3" 21 | } 22 | } 23 | --------------------------------------------------------------------------------