react-router-nomatch
Advanced tools
Comparing version 1.0.4 to 2.0.0
@@ -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");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(source,true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(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(props){var children=props.children,location=props.location,component=props.component,render=props.render,alwaysRender=props.alwaysRender;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(path!=null){match=!!(0,_reactRouterDom.matchPath)(location.pathname,_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=(0,_reactRouterDom.withRouter)(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);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(source,true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(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({},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": "1.0.4", | ||
"version": "2.0.0", | ||
"description": "React Router interface that renders a component when no child route is matched.", | ||
@@ -24,3 +24,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"prop-types": "^15.7.2" | ||
"lodash": "^4.17.15", | ||
"prop-types": "^15.7.2", | ||
"react-router-dom": "^5.1.2" | ||
}, | ||
@@ -31,4 +33,8 @@ "devDependencies": { | ||
"@babel/preset-env": "^7.5.5", | ||
"@babel/preset-react": "^7.0.0" | ||
"@babel/preset-react": "^7.0.0", | ||
"babel-eslint": "^10.0.3", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-react": "^7.16.0", | ||
"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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
9661
6
95
0
3
8
+ Addedlodash@^4.17.15
+ Addedreact-router-dom@^5.1.2
+ Added@babel/runtime@7.26.0(transitive)
+ Addedhistory@4.10.1(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedpath-to-regexp@1.9.0(transitive)
+ Addedreact@19.0.0(transitive)
+ Addedreact-router@5.3.4(transitive)
+ Addedreact-router-dom@5.3.4(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedresolve-pathname@3.0.0(transitive)
+ Addedtiny-invariant@1.3.3(transitive)
+ Addedtiny-warning@1.0.3(transitive)
+ Addedvalue-equal@1.0.1(transitive)