UNPKG

@newbiz/vue-maintainer-libs

Version:

Vue.js maintainer 라이브러리

1 lines 1.2 kB
"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r}).apply(this,arguments)},t=this&&this.__read||function(r,t){var e="function"==typeof Symbol&&r[Symbol.iterator];if(!e)return r;var n,o,i=e.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},e=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("vue-router"));exports.initRouter=function initRouter(e,o){e.use(n.default);var i=o.fallback?r(r({},o.routes),{FALLBACK:[o.fallback]}):o.routes,u=Object.entries(null!==i&&void 0!==i?i:[]).reduce(function(r,t){return t[1].length&&t[1].forEach(function(t){return r.push(t)}),r},[]),a=new n.default(r(r({},o.option),{mode:"history",routes:u}));return o.navigationGuards&&Object.entries(o.navigationGuards).map(function(r){var e,n=t(r,2),o=n[0],i=n[1];return null===(e=a[o])||void 0===e?void 0:e.call(a,i)}),a};