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

oo7-react

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oo7-react - npm Package Compare versions

Comparing version 0.4.9 to 0.5.0

72

lib/index.js

@@ -70,2 +70,6 @@ 'use strict';

function identity(x) {
x;
}
/**

@@ -100,3 +104,2 @@ * @summary A derivable class for creating React components that can transparently

var ReactiveComponent = function (_React$Component2) {

@@ -123,2 +126,3 @@ _inherits(ReactiveComponent, _React$Component2);

var bonds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var propTransforms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -131,2 +135,3 @@ _classCallCheck(this, ReactiveComponent);

_this2.bonds = bonds;
_this2.propTransforms = propTransforms;
_this2.allBondKeys = [].concat(reactiveProps).concat(Object.keys(bonds));

@@ -212,2 +217,4 @@ return _this2;

value: function manageProps(props, nextProps) {
var _this3 = this;
var that = this;

@@ -219,3 +226,3 @@ if (this._consolidatedBonds) {

this._consolidatedBonds = new ReactiveBond(this.reactiveProps.map(function (f) {
return nextProps[f];
return (_this3.reactiveProps[f] || identity)(nextProps[f]);
}), [], function (a) {

@@ -240,6 +247,6 @@ var s = that.state || {};

value: function ready() {
var _this3 = this;
var _this4 = this;
return this.allBondKeys.every(function (k) {
return _this3.state[k] !== undefined;
return _this4.state[k] !== undefined;
});

@@ -289,2 +296,37 @@ }

/**
* Simple coditional to output one item over another dependent on some condition.
*
* @example
* class Clock extends React.Component {
* constructor (someBond) { this._someBond = someBond }
* render () {
* return <If condition={this.someBond.ready()}
* then={<Rspan>{this.someBond}</Rspan>}
* else='Not ready'
* />
* }
* }
*/
var If = function (_ReactiveComponent) {
_inherits(If, _ReactiveComponent);
function If() {
_classCallCheck(this, If);
return _possibleConstructorReturn(this, (If.__proto__ || Object.getPrototypeOf(If)).call(this, ['condition']));
}
_createClass(If, [{
key: 'render',
value: function render() {
return this.state.condition ? this.props.then : this.props.else || React.createElement('span', null);
}
}]);
return If;
}(ReactiveComponent);
/**
* {@link Bond}-aware, variant of `span` component.

@@ -302,4 +344,4 @@ *

var Rspan = function (_ReactiveComponent) {
_inherits(Rspan, _ReactiveComponent);
var Rspan = function (_ReactiveComponent2) {
_inherits(Rspan, _ReactiveComponent2);

@@ -343,4 +385,4 @@ function Rspan() {

var Rdiv = function (_ReactiveComponent2) {
_inherits(Rdiv, _ReactiveComponent2);
var Rdiv = function (_ReactiveComponent3) {
_inherits(Rdiv, _ReactiveComponent3);

@@ -379,4 +421,4 @@ function Rdiv() {

var Ra = function (_ReactiveComponent3) {
_inherits(Ra, _ReactiveComponent3);
var Ra = function (_ReactiveComponent4) {
_inherits(Ra, _ReactiveComponent4);

@@ -417,4 +459,4 @@ function Ra() {

var Rimg = function (_ReactiveComponent4) {
_inherits(Rimg, _ReactiveComponent4);
var Rimg = function (_ReactiveComponent5) {
_inherits(Rimg, _ReactiveComponent5);

@@ -451,4 +493,4 @@ function Rimg() {

var Hash = function (_ReactiveComponent5) {
_inherits(Hash, _ReactiveComponent5);
var Hash = function (_ReactiveComponent6) {
_inherits(Hash, _ReactiveComponent6);

@@ -487,3 +529,3 @@ function Hash() {

module.exports = {
ReactiveComponent: ReactiveComponent, Rspan: Rspan, Rdiv: Rdiv, Ra: Ra, Rimg: Rimg, Hash: Hash, InjectedCacheWaiter: InjectedCacheWaiter
ReactiveComponent: ReactiveComponent, Rspan: Rspan, Rdiv: Rdiv, Ra: Ra, Rimg: Rimg, Hash: Hash, InjectedCacheWaiter: InjectedCacheWaiter, If: If
};
{
"name": "oo7-react",
"version": "0.4.9",
"version": "0.5.0",
"description": "The Reactive Bond API",

@@ -41,4 +41,4 @@ "main": "lib/index.js",

"chai": "^3.5.0",
"mocha": "^3.2.0"
"mocha": "^5.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