vue-commercetools
Version:
Collection of filters and utilities for the fast development of ecommerce sites with Commercetools and Vue.js
22 lines (18 loc) • 526 B
JavaScript
import * as filters from './filters';
const VueCommercetools = {
install(Vue) {
// Install filters
Object.keys(filters).forEach(key => {
if (Vue.filter(key)) {
console.warn(`[filter duplication]: A filter named ${key} has already been installed.`);
} else {
Vue.filter(key, filters[key]);
}
});
},
};
export default VueCommercetools;
// Install by default if included from script tag
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VueCommercetools);
}