-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.js
25 lines (22 loc) · 806 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint-disable */
import app from './views/app';
import './assets/js/bootstrap.min';
// actually mount to DOM
app.$mount('#app');
if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production') {
navigator.serviceWorker.register('/service-worker.js').then(function(registration){
console.log('Service worker registered : ', registration.scope);
})
.catch(function(err){
console.log("Service worker registration failed : ", err);
});
}
//array
Array.prototype.group = function(key) {
var result = {};
this.map(item => ({section: key(item), value: item})).forEach(item => {
result[item.section] = result[item.section] || [];
result[item.section].push(item.value);
});
return Object.keys(result).map(item => ({section: item, data: result[item]}));
}