react-router-nomatch
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactRouterDom=require("react-router-dom");var _isNil=_interopRequireDefault(require("lodash/isNil"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}var NoMatch=function NoMatch(_ref){var children=_ref.children,component=_ref.component,render=_ref.render,alwaysRender=_ref.alwaysRender;var location=(0,_reactRouterDom.useLocation)();var match=false;_react["default"].Children.forEach(children,function(child){if(!match&&_react["default"].isValidElement(child)){var path=child.props.path||child.props.from;if(!(0,_isNil["default"])(path)){match=!!(0,_reactRouterDom.matchPath)(location.pathname,_objectSpread(_objectSpread({},child.props),{},{path:path}))}}});return _react["default"].createElement(_react["default"].Fragment,null,(!match||alwaysRender)&&(component?_react["default"].createElement(component,{match:match}):render?render(match):null),children)};NoMatch.propTypes={children:_propTypes["default"].node,location:_propTypes["default"].object,component:_propTypes["default"].elementType,render:_propTypes["default"].func,alwaysRender:_propTypes["default"].bool};NoMatch.defaultProps={alwaysRender:false};var _default=NoMatch;exports["default"]=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _react=_interopRequireDefault(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactRouterDom=require("react-router-dom");var _isNil=_interopRequireDefault(require("lodash/isNil"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var NoMatch=function NoMatch(_ref){var children=_ref.children,component=_ref.component,render=_ref.render,alwaysRender=_ref.alwaysRender;var location=(0,_reactRouterDom.useLocation)();var match=false;_react["default"].Children.forEach(children,function(child){if(!match&&_react["default"].isValidElement(child)){var path=child.props.path||child.props.from;if(!(0,_isNil["default"])(path)){match=!!(0,_reactRouterDom.matchPath)(location.pathname,_objectSpread(_objectSpread({},child.props),{},{path:path}))}}});return _react["default"].createElement(_react["default"].Fragment,null,(!match||alwaysRender)&&(component?_react["default"].createElement(component,{match:match}):render?render(match):null),children)};NoMatch.propTypes={children:_propTypes["default"].node,location:_propTypes["default"].object,component:_propTypes["default"].elementType,render:_propTypes["default"].func,alwaysRender:_propTypes["default"].bool};NoMatch.defaultProps={alwaysRender:false};var _default=NoMatch;exports["default"]=_default; |
{ | ||
"name": "react-router-nomatch", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "React Router interface that renders a component when no child route is matched.", | ||
@@ -26,14 +26,14 @@ "license": "MIT", | ||
"prop-types": "^15.8.1", | ||
"react-router-dom": "^5.1.2" | ||
"react-router-dom": "^5.3.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.6", | ||
"@babel/core": "^7.17.8", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-react": "^7.16.7", | ||
"@babel/cli": "^7.20.7", | ||
"@babel/core": "^7.20.12", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-react": "^7.18.6", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-react": "^7.29.4", | ||
"eslint-plugin-react-hooks": "^2.2.0" | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-react": "^7.31.11", | ||
"eslint-plugin-react-hooks": "^2.5.1" | ||
} | ||
} |
10219
Updatedreact-router-dom@^5.3.4