Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
freearhey committed Nov 16, 2016
1 parent 4d46e23 commit 2ba327d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 28 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ The list of standard filters Vue.js 1.* adapted for use in Vue.js 2.*
npm install vue2-filters
```

### CommonJS

```js
var Vue = require('Vue');
var Vue2Filters = require('vue2-filters');
Vue.use(Vue2Filters);
```

### AMD
```js
require(['vue','vue2-filters'], function(Vue, Vue2Filters) {
Vue.use(Vue2Filters);
});
```

### Direct include

```html
Expand Down
1 change: 0 additions & 1 deletion dist/vue-filters.min.js

This file was deleted.

38 changes: 26 additions & 12 deletions dist/vue-filters.js → dist/vue2-filters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
/******/ (function(modules) { // webpackBootstrap
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};

Expand Down Expand Up @@ -534,20 +544,24 @@ function install(Vue) {
__WEBPACK_IMPORTED_MODULE_0__util_index__["a" /* default */].each(__WEBPACK_IMPORTED_MODULE_3__other_index__, function(value, key) {
Vue.filter(key, value)
})
}

var mixins = {
methods: {
limitBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["a" /* limitBy */],
filterBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["b" /* filterBy */],
orderBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["c" /* orderBy */]
}
Vue.mixin({
methods: {
limitBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["a" /* limitBy */],
filterBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["b" /* filterBy */],
orderBy: __WEBPACK_IMPORTED_MODULE_2__array_index__["c" /* orderBy */]
}
})
}

if(window.Vue) {
if (window.Vue) {
Vue.use(install)
Vue.mixin(mixins)
}
} else if (true) {
module.exports = install
} else if (typeof define === "function" && define.amd) {
define([], function(){ return install })
}

/***/ }
/******/ ]);
/******/ ]);
});
1 change: 1 addition & 0 deletions dist/vue2-filters.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "vue2-filters",
"version": "0.1.0",
"version": "0.1.2",
"description": "The list of standard filters Vue.js 1.* adapted for use in Vue.js 2.*",
"main": "dist/vue-filters.js",
"main": "dist/vue2-filters.js",
"scripts": {
"build": "webpack src/index.js dist/vue-filters.min.js --optimize-minimize",
"dev": "webpack src/index.js dist/vue-filters.js --watch",
"build": "webpack src/index.js dist/vue2-filters.min.js --output-library-target umd --optimize-minimize",
"dev": "webpack src/index.js dist/vue2-filters.js --output-library-target umd --watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"vuejs",
"vue",
"filters",
"vue-filters"
"vue2-filters"
],
"author": "Arhey",
"license": "MIT",
Expand Down
23 changes: 13 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ function install(Vue) {
util.each(otherFilters, function(value, key) {
Vue.filter(key, value)
})
}

var mixins = {
methods: {
limitBy: arrayFilters.limitBy,
filterBy: arrayFilters.filterBy,
orderBy: arrayFilters.orderBy
}
Vue.mixin({
methods: {
limitBy: arrayFilters.limitBy,
filterBy: arrayFilters.filterBy,
orderBy: arrayFilters.orderBy
}
})
}

if(window.Vue) {
if (window.Vue) {
Vue.use(install)
Vue.mixin(mixins)
}
} else if (typeof exports === "object") {
module.exports = install
} else if (typeof define === "function" && define.amd) {
define([], function(){ return install })
}

0 comments on commit 2ba327d

Please sign in to comment.