Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-breadcrumbs-hoc

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-breadcrumbs-hoc - npm Package Compare versions

Comparing version 3.2.6 to 3.2.7

2

dist/cjs/index.js

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouter=require("react-router"),reactRouterDom=require("react-router-dom");function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var DEFAULT_MATCH_OPTIONS={exact:!0},NO_BREADCRUMB="NO_BREADCRUMB",humanize=function(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})},render=function(e){var t=e.breadcrumb,r=e.match,o=e.location,n=_objectWithoutProperties(e,["breadcrumb","match","location"]),a=_objectSpread2({match:r,location:o,key:r.url},n);return _objectSpread2({},a,{breadcrumb:"string"==typeof t?React.createElement("span",{key:a.key},t):React__default.createElement(t,a)})},getDefaultBreadcrumb=function(e){var t=e.currentSection,r=e.location,o=e.pathSection,n=reactRouter.matchPath(o,_objectSpread2({},DEFAULT_MATCH_OPTIONS,{path:o}))||{url:"not-found"};return render({breadcrumb:humanize(t),match:n,location:r})},getBreadcrumbMatch=function(e){var c,u=e.currentSection,i=e.disableDefaults,t=e.excludePaths,b=e.location,l=e.pathSection,r=e.routes;return t&&t.some(function(e){return reactRouter.matchPath(l,{path:e,exact:!0,strict:!1})})?NO_BREADCRUMB:(r.some(function(e){var t=e.breadcrumb,r=e.matchOptions,o=e.path,n=_objectWithoutProperties(e,["breadcrumb","matchOptions","path"]);if(!o)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var a=reactRouter.matchPath(l,_objectSpread2({},r||DEFAULT_MATCH_OPTIONS,{path:o}));return a&&null===t||!a&&r?(c=NO_BREADCRUMB,!0):!!a&&(c=!t&&i?NO_BREADCRUMB:render(_objectSpread2({breadcrumb:t||humanize(u),match:a,location:b},n)),!0)}),c||(i?NO_BREADCRUMB:getDefaultBreadcrumb({pathSection:l,currentSection:"/"===l?"Home":u,location:b})))},getBreadcrumbs=function(e){var n=e.routes,a=e.location,t=e.options,c=void 0===t?{}:t,u=[];return a.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",o=getBreadcrumbMatch(_objectSpread2({currentSection:t,location:a,pathSection:r,routes:n},c));return o!==NO_BREADCRUMB&&u.push(o),"/"===r?"":r},""),u},flattenRoutes=function r(e){return e.reduce(function(e,t){return t.routes?e.concat([t].concat(_toConsumableArray(r(t.routes)))):e.concat(t)},[])},index=function(e,o){return function(t){var r={options:o,routes:flattenRoutes(e||[])};return reactRouterDom.useLocation?function(){return React.createElement(t,{breadcrumbs:getBreadcrumbs(_objectSpread2({},r,{location:reactRouterDom.useLocation()}))})}:reactRouter.withRouter(function(e){return console.warn("[react-router-breadcrumbs-hoc]: react-router v4 support will be deprecated in the next major release. Please consider upgrading react-router and react-router-dom to >= 5.1.0"),React.createElement(t,_objectSpread2({},e,{breadcrumbs:getBreadcrumbs(_objectSpread2({},r,{location:e.location}))}))})}};exports.default=index,exports.getBreadcrumbs=getBreadcrumbs;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouter=require("react-router"),reactRouterDom=require("react-router-dom");function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}function _objectWithoutProperties(e,t){if(null==e)return{};var r,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}var DEFAULT_MATCH_OPTIONS={exact:!0},NO_BREADCRUMB="NO_BREADCRUMB",humanize=function(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})},render=function(e){var t=e.breadcrumb,r=e.match,o=e.location,n=_objectWithoutProperties(e,["breadcrumb","match","location"]),a=_objectSpread2({match:r,location:o,key:r.url},n);return _objectSpread2({},a,{breadcrumb:"string"==typeof t?React.createElement("span",{key:a.key},t):React__default.createElement(t,a)})},getDefaultBreadcrumb=function(e){var t=e.currentSection,r=e.location,o=e.pathSection,n=reactRouter.matchPath(o,_objectSpread2({},DEFAULT_MATCH_OPTIONS,{path:o}))||{url:"not-found"};return render({breadcrumb:humanize(t),match:n,location:r})},getBreadcrumbMatch=function(e){var c,u=e.currentSection,i=e.disableDefaults,t=e.excludePaths,b=e.location,l=e.pathSection,r=e.routes;return t&&t.some(function(e){return reactRouter.matchPath(l,{path:e,exact:!0,strict:!1})})?NO_BREADCRUMB:(r.some(function(e){var t=e.breadcrumb,r=e.matchOptions,o=e.path,n=_objectWithoutProperties(e,["breadcrumb","matchOptions","path"]);if(!o)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var a=reactRouter.matchPath(l,_objectSpread2({},r||DEFAULT_MATCH_OPTIONS,{path:o}));return a&&null===t||!a&&r?(c=NO_BREADCRUMB,!0):!!a&&(c=!t&&i?NO_BREADCRUMB:render(_objectSpread2({breadcrumb:t||humanize(u),match:a,location:b},n)),!0)}),c||(i?NO_BREADCRUMB:getDefaultBreadcrumb({pathSection:l,currentSection:"/"===l?"Home":u,location:b})))},getBreadcrumbs=function(e){var n=e.routes,a=e.location,t=e.options,c=void 0===t?{}:t,u=[];return a.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",o=getBreadcrumbMatch(_objectSpread2({currentSection:t,location:a,pathSection:r,routes:n},c));return o!==NO_BREADCRUMB&&u.push(o),"/"===r?"":r},""),u},flattenRoutes=function r(e){return e.reduce(function(e,t){return t.routes?e.concat([t].concat(_toConsumableArray(r(t.routes)))):e.concat(t)},[])},index=function(e,o){return function(t){var r={options:o,routes:flattenRoutes(e||[])};return reactRouterDom.useLocation?function(e){return React__default.createElement(t,_objectSpread2({},e,{breadcrumbs:getBreadcrumbs(_objectSpread2({},r,{location:reactRouterDom.useLocation()}))}))}:reactRouter.withRouter(function(e){return console.warn("[react-router-breadcrumbs-hoc]: react-router v4 support will be deprecated in the next major release. Please consider upgrading react-router and react-router-dom to >= 5.1.0"),React.createElement(t,_objectSpread2({},e,{breadcrumbs:getBreadcrumbs(_objectSpread2({},r,{location:e.location}))}))})}};exports.default=index,exports.getBreadcrumbs=getBreadcrumbs;
//# sourceMappingURL=index.js.map

@@ -329,9 +329,8 @@ import React, { createElement } from 'react';

if (useLocation) {
return function () {
return createElement(Component, {
// @ts-ignore-next-line
return function (props) {
return React.createElement(Component, _objectSpread2({}, props, {
breadcrumbs: getBreadcrumbs(_objectSpread2({}, sharedBreadcrumbProps, {
location: useLocation()
}))
});
}));
};

@@ -347,3 +346,2 @@ } // fallback to withRouter for older react-router versions (4.x)

return createElement(Component, _objectSpread2({}, props, {
// @ts-ignore-next-line
breadcrumbs: getBreadcrumbs(_objectSpread2({}, sharedBreadcrumbProps, {

@@ -350,0 +348,0 @@ location: props.location

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-router","react-router-dom"],t):t((e=e||self)["react-router-breadcrumbs-hoc"]={},e.React,e.ReactRouter,e.reactRouterDom)}(this,function(e,a,b,o){"use strict";var u="default"in a?a.default:a;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(o){for(var e=1;e<arguments.length;e++){var c=null!=arguments[e]?arguments[e]:{};e%2?t(Object(c),!0).forEach(function(e){var t,r,n;t=o,n=c[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):t(Object(c)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(c,e))})}return o}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],0<=t.indexOf(r)||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function h(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})}function y(e){var t=e.breadcrumb,r=e.match,n=e.location,o=d(e,["breadcrumb","match","location"]),c=m({match:r,location:n,key:r.url},o);return m({},c,{breadcrumb:"string"==typeof t?a.createElement("span",{key:c.key},t):u.createElement(t,c)})}function i(e){var a,t,r,n,o,c,u=e.currentSection,i=e.disableDefaults,l=e.excludePaths,s=e.location,p=e.pathSection,f=e.routes;return l&&l.some(function(e){return b.matchPath(p,{path:e,exact:!0,strict:!1})})?v:(f.some(function(e){var t=e.breadcrumb,r=e.matchOptions,n=e.path,o=d(e,["breadcrumb","matchOptions","path"]);if(!n)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var c=b.matchPath(p,m({},r||O,{path:n}));return c&&null===t||!c&&r?(a=v,!0):!!c&&(a=!t&&i?v:y(m({breadcrumb:t||h(u),match:c,location:s},o)),!0)}),a||(i?v:(r=(t={pathSection:p,currentSection:"/"===p?"Home":u,location:s}).currentSection,n=t.location,o=t.pathSection,c=b.matchPath(o,m({},O,{path:o}))||{url:"not-found"},y({breadcrumb:h(r),match:c,location:n}))))}function l(e){var o=e.routes,c=e.location,t=e.options,a=void 0===t?{}:t,u=[];return c.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",n=i(m({currentSection:t,location:c,pathSection:r,routes:o},a));return n!==v&&u.push(n),"/"===r?"":r},""),u}var O={exact:!0},v="NO_BREADCRUMB";e.default=function(e,n){return function(t){var r={options:n,routes:function r(e){return e.reduce(function(e,t){return t.routes?e.concat([t].concat(c(r(t.routes)))):e.concat(t)},[])}(e||[])};return o.useLocation?function(){return a.createElement(t,{breadcrumbs:l(m({},r,{location:o.useLocation()}))})}:b.withRouter(function(e){return console.warn("[react-router-breadcrumbs-hoc]: react-router v4 support will be deprecated in the next major release. Please consider upgrading react-router and react-router-dom to >= 5.1.0"),a.createElement(t,m({},e,{breadcrumbs:l(m({},r,{location:e.location}))}))})}},e.getBreadcrumbs=l,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-router","react-router-dom"],t):t((e=e||self)["react-router-breadcrumbs-hoc"]={},e.React,e.ReactRouter,e.reactRouterDom)}(this,function(e,a,b,o){"use strict";var u="default"in a?a.default:a;function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(o){for(var e=1;e<arguments.length;e++){var c=null!=arguments[e]?arguments[e]:{};e%2?t(Object(c),!0).forEach(function(e){var t,r,n;t=o,n=c[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(c)):t(Object(c)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(c,e))})}return o}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],0<=t.indexOf(r)||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function h(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})}function y(e){var t=e.breadcrumb,r=e.match,n=e.location,o=d(e,["breadcrumb","match","location"]),c=m({match:r,location:n,key:r.url},o);return m({},c,{breadcrumb:"string"==typeof t?a.createElement("span",{key:c.key},t):u.createElement(t,c)})}function i(e){var a,t,r,n,o,c,u=e.currentSection,i=e.disableDefaults,l=e.excludePaths,s=e.location,p=e.pathSection,f=e.routes;return l&&l.some(function(e){return b.matchPath(p,{path:e,exact:!0,strict:!1})})?v:(f.some(function(e){var t=e.breadcrumb,r=e.matchOptions,n=e.path,o=d(e,["breadcrumb","matchOptions","path"]);if(!n)throw new Error("withBreadcrumbs: `path` must be provided in every route object");var c=b.matchPath(p,m({},r||O,{path:n}));return c&&null===t||!c&&r?(a=v,!0):!!c&&(a=!t&&i?v:y(m({breadcrumb:t||h(u),match:c,location:s},o)),!0)}),a||(i?v:(r=(t={pathSection:p,currentSection:"/"===p?"Home":u,location:s}).currentSection,n=t.location,o=t.pathSection,c=b.matchPath(o,m({},O,{path:o}))||{url:"not-found"},y({breadcrumb:h(r),match:c,location:n}))))}function l(e){var o=e.routes,c=e.location,t=e.options,a=void 0===t?{}:t,u=[];return c.pathname.split("?")[0].replace(/\/$/,"").split("/").reduce(function(e,t){var r=t?"".concat(e,"/").concat(t):"/",n=i(m({currentSection:t,location:c,pathSection:r,routes:o},a));return n!==v&&u.push(n),"/"===r?"":r},""),u}var O={exact:!0},v="NO_BREADCRUMB";e.default=function(e,n){return function(t){var r={options:n,routes:function r(e){return e.reduce(function(e,t){return t.routes?e.concat([t].concat(c(r(t.routes)))):e.concat(t)},[])}(e||[])};return o.useLocation?function(e){return u.createElement(t,m({},e,{breadcrumbs:l(m({},r,{location:o.useLocation()}))}))}:b.withRouter(function(e){return console.warn("[react-router-breadcrumbs-hoc]: react-router v4 support will be deprecated in the next major release. Please consider upgrading react-router and react-router-dom to >= 5.1.0"),a.createElement(t,m({},e,{breadcrumbs:l(m({},r,{location:e.location}))}))})}},e.getBreadcrumbs=l,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.js.map
{
"name": "react-router-breadcrumbs-hoc",
"version": "3.2.6",
"version": "3.2.7",
"description": "small, flexible, higher order component for rendering breadcrumbs with react-router 4.x",

@@ -46,5 +46,7 @@ "repository": "icd2k3/react-router-breadcrumbs-hoc",

"@types/react": "^16.9.23",
"@types/react-dom": "^16.9.5",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"babel-eslint": "^10.1.0",

@@ -69,3 +71,3 @@ "babel-jest": "^25.1.0",

"react-router-dom": "^5.1.2",
"rollup": "^2.0.6",
"rollup": "^2.1.0",
"rollup-plugin-babel": "^4.4.0",

@@ -72,0 +74,0 @@ "rollup-plugin-uglify": "^6.0.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc