"use strict";

exports.__esModule = true;
exports.getUrlParam = void 0;

/**
 *  ---
 *  获取 URL 传递所有参数<br/>
 *
 * @returns  {array}  返回全部参数组装的对象
 * @function  getURLParam
 * @author    libo
 * @static
 * @example example 01 缺省key值
 * --------------------------------------------------------------------------
 *
 *  import { getURLParam } from '@riil-frontend/utils';
 *  getURLParam();
 *
 *
 *  eg: url = http://localhost/riil-biz-frontend/dist/#/module/function?id=123&name=appbir&ts=1571105560850
 *  // result
 *  {
 *    "id": "123",
 *    "name": "appbir",
 *    "ts": "1571105560850"
 *  }
 *
 */
var getUrlParam = function getUrlParam() {
  var href = location.href;
  var paramStr = href.split('?')[1];
  var paramObj = {};

  if (paramStr) {
    var params = paramStr.split('&');
    params.map(function (str) {
      var pair = str.split('=');
      paramObj[pair[0]] = pair[1];
    });
  }

  return paramObj;
};

exports.getUrlParam = getUrlParam;