@r/platform
Version:
A set of tools to enable easy universal rendering and page navigation on a React + Redux stack
93 lines (69 loc) • 2.68 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("lodash/lang"));
else if(typeof define === 'function' && define.amd)
define(["lodash/lang"], factory);
else if(typeof exports === 'object')
exports["shouldGoBack.js"] = factory(require("lodash/lang"));
else
root["shouldGoBack.js"] = factory(root["lodash/lang"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_12__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = shouldGoBack;
var _lang = __webpack_require__(12);
function shouldGoBack(urlHistory, currentIndex, url, queryParams) {
var existsHistoryAPI = typeof history !== 'undefined' && history.back && history.state;
var existsUrlHistory = urlHistory && urlHistory.length > 1 && urlHistory.length > currentIndex;
if (existsHistoryAPI && existsUrlHistory) {
var prevHist = urlHistory[currentIndex - 1];
if ((0, _lang.isEqual)(prevHist.url, url) && (0, _lang.isEqual)(prevHist.queryParams, queryParams)) {
return true;
}
}
return false;
}
/***/ },
/***/ 12:
/***/ function(module, exports) {
module.exports = require("lodash/lang");
/***/ }
/******/ })
});
;