New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-resolver

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-resolver - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

5

CHANGELOG.md

@@ -9,2 +9,7 @@ # React Resolver Changelog

### v1.1.0 - (2015-04-13)
- [Contexts](https://github.com/ericclemmons/react-resolver/pull/21)
### v1.0.0 - (2015-04-13)

@@ -11,0 +16,0 @@

16

dist/resolver.js

@@ -145,8 +145,8 @@ "use strict";

var valueOf = container.props.resolve[prop];
var value = container.props.hasOwnProperty(prop) ? container.props[prop] : valueOf(container.props);
var value = container.props.hasOwnProperty(prop) ? container.props[prop] : valueOf(container.props.props, container.props.context);
return Promise.resolve(value).then(function (value) {
state.values[prop] = value;
return Promise.resolve(value).then(function (resolved) {
state.values[prop] = resolved;
return value;
return resolved;
});

@@ -185,4 +185,6 @@ });

return _React2["default"].createElement(_Container2["default"], _extends({
component: Component
}, props, this.props));
component: Component,
context: this.context,
props: this.props
}, props));
}

@@ -194,2 +196,4 @@ }]);

ComponentContainer.childContextTypes = props.childContextTypes;
ComponentContainer.contextTypes = props.contextTypes;
ComponentContainer.displayName = "" + Component.displayName + "Container";

@@ -196,0 +200,0 @@

{
"name": "react-resolver",
"version": "1.0.0",
"version": "1.1.0",
"description": "Isomorphic library to lazy-load data for React components",

@@ -23,3 +23,3 @@ "main": "dist/index.js",

"build": "babel --out-dir dist/ src/",
"lint": "eslint src",
"lint": "eslint src test",
"prepublish": "npm run build",

@@ -26,0 +26,0 @@ "test": "npm run build && mocha"

@@ -90,3 +90,3 @@ # React Resolver ![https://img.shields.io/npm/v/react-resolver.svg](https://img.shields.io/npm/v/react-resolver.svg?style=flat-square)

resolve: {
users: function(props) {
users: function(props, context) {
return fetch(`/api/users?limit=${props.limit}`);

@@ -99,3 +99,24 @@ }

If you use [React Router][router] (or anything else) that uses
`context`, you can get access to these values via:
```javascript
Resolver.createContainer(Users, {
contextTypes: {
router: React.PropTypes.func.isRequired
},
resolve: {
user: function(props, context) {
const { login } = context.router.getCurrentParams();
return fetch(`/api/users/${login}`);
}
}
});
```
_For a working example of this, check out [User.js](https://github.com/ericclemmons/react-resolver/blob/master/examples/stargazers/handlers/User.js) in the [demo][demo]._
### Client

@@ -164,2 +185,3 @@

[license]: https://github.com/ericclemmons/react-resolver/blob/master/LICENSE
[router]: https://github.com/rackt/react-router/
[twitter]: https://twitter.com/ericclemmons/

@@ -110,8 +110,11 @@ import React from "react";

const valueOf = container.props.resolve[prop];
const value = container.props.hasOwnProperty(prop) ? container.props[prop]: valueOf(container.props);
const value = container.props.hasOwnProperty(prop)
? container.props[prop]
: valueOf(container.props.props, container.props.context)
;
return Promise.resolve(value).then((value) => {
state.values[prop] = value;
return Promise.resolve(value).then((resolved) => {
state.values[prop] = resolved;
return value;
return resolved;
});

@@ -136,4 +139,5 @@ });

component={Component}
context={this.context}
props={this.props}
{...props}
{...this.props}
/>

@@ -144,2 +148,4 @@ );

ComponentContainer.childContextTypes = props.childContextTypes;
ComponentContainer.contextTypes = props.contextTypes;
ComponentContainer.displayName = `${Component.displayName}Container`;

@@ -146,0 +152,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