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

react-router-nomatch

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-nomatch - npm Package Compare versions

Comparing version 1.0.4 to 2.0.0

.eslintrc.json

2

lib/index.js

@@ -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"
}
}
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