react-router-nomatch
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -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);if(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=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{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 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; |
{ | ||
"name": "react-router-nomatch", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "React Router interface that renders a component when no child route is matched.", | ||
@@ -25,15 +25,15 @@ "license": "MIT", | ||
"lodash": "^4.17.21", | ||
"prop-types": "^15.7.2", | ||
"prop-types": "^15.8.1", | ||
"react-router-dom": "^5.1.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-react": "^7.14.5", | ||
"babel-eslint": "^10.0.3", | ||
"@babel/cli": "^7.17.6", | ||
"@babel/core": "^7.17.8", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-react": "^7.16.7", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-react": "^7.16.0", | ||
"eslint-plugin-react": "^7.29.4", | ||
"eslint-plugin-react-hooks": "^2.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9453
Updatedprop-types@^15.8.1