react-observable-mixin
Advanced tools
Comparing version 1.0.10 to 2.0.0
'use strict'; | ||
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default']; | ||
exports.__esModule = true; | ||
exports.ObservablePropTypes = exports.RxObservableMixin = undefined; | ||
@@ -15,3 +14,5 @@ var _RxObservableMixin = require('./RxObservableMixin'); | ||
exports.RxObservableMixin = _RxObservableMixin2['default']; | ||
exports.ObservablePropTypes = _ObservablePropTypes2['default']; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.RxObservableMixin = _RxObservableMixin2.default; | ||
exports.ObservablePropTypes = _ObservablePropTypes2.default; |
'use strict'; | ||
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default']; | ||
exports.__esModule = true; | ||
@@ -11,2 +9,4 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var ANONYMOUS = '<<anonymous>>'; | ||
@@ -26,7 +26,7 @@ | ||
if (props[propName]) return validate(props, propName, componentName, location); | ||
var locationName = location; | ||
if (isRequired) { | ||
throw new Error('Required ' + locationName + ' `' + propName + '` was not specified in ' + ('`' + componentName + '`.')); | ||
if (props[propName]) validate(props, propName, componentName, location);else { | ||
var locationName = location; | ||
if (isRequired) { | ||
throw new Error('Required ' + locationName + ' `' + propName + '` was not specified in ' + ('`' + componentName + '`.')); | ||
} | ||
} | ||
@@ -48,6 +48,5 @@ } | ||
var observable = createChainableTypeChecker(function (props, propName, componentName) { | ||
if (!_rxLite2['default'].Observable.isObservable(props[propName])) throw new Error('\n Prop `' + propName + '` specified in `' + componentName + '`\n is not a valid observable.\n '); | ||
if (!_rxLite2.default.Observable.isObservable(props[propName])) throw new Error('\n Prop `' + propName + '` specified in `' + componentName + '`\n is not a valid observable.\n '); | ||
}); | ||
exports['default'] = { observable: observable }; | ||
module.exports = exports['default']; | ||
exports.default = { observable: observable }; |
'use strict'; | ||
var _Object$keys = require('babel-runtime/core-js/object/keys')['default']; | ||
var _Object$assign = require('babel-runtime/core-js/object/assign')['default']; | ||
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default']; | ||
exports.__esModule = true; | ||
@@ -19,2 +13,4 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -24,7 +20,6 @@ * Rx Observable mixin. | ||
exports['default'] = { | ||
exports.default = { | ||
getInitialState: function getInitialState() { | ||
return {}; | ||
}, | ||
componentWillMount: function componentWillMount() { | ||
@@ -34,6 +29,5 @@ this.observables = this.getObservablesFromProps(this.props); | ||
}, | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
var observables = this.getObservablesFromProps(nextProps); | ||
if (!_shallowequal2['default'](this.observables, observables)) { | ||
if (!(0, _shallowequal2.default)(this.observables, observables)) { | ||
this.unsubscribeFromObservables(); | ||
@@ -44,3 +38,2 @@ this.observables = observables; | ||
}, | ||
componentWillUnmount: function componentWillUnmount() { | ||
@@ -50,2 +43,3 @@ this.unsubscribeFromObservables(); | ||
/** | ||
@@ -59,3 +53,3 @@ * Returns observable from props. | ||
getObservablesFromProps: function getObservablesFromProps(props) { | ||
return _Object$keys(props).reduce(function (observables, propKey) { | ||
return Object.keys(props).reduce(function (observables, propKey) { | ||
var matches = propKey.match(/^(.+)\$$/); | ||
@@ -68,2 +62,3 @@ if (matches && props[propKey] && typeof props[propKey].subscribe === 'function') observables[matches[1]] = props[propKey]; | ||
/** | ||
@@ -85,2 +80,3 @@ * Called when a onNext subscribe occurs. | ||
/** | ||
@@ -97,2 +93,3 @@ * Called when a onError subscribe occurs. | ||
/** | ||
@@ -105,3 +102,3 @@ * Subscribe to observables. | ||
subscribeToObservables: function subscribeToObservables(observables) { | ||
var mapObservables = _Object$keys(observables).map(function (key) { | ||
var mapObservables = Object.keys(observables).map(function (key) { | ||
return observables[key].map(function (value) { | ||
@@ -114,3 +111,3 @@ var _ref; | ||
this.observablesSubscription = _rxLite2['default'].Observable.combineLatest(mapObservables, function () { | ||
this.observablesSubscription = _rxLite2.default.Observable.combineLatest(mapObservables, function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -121,3 +118,3 @@ args[_key] = arguments[_key]; | ||
return args.reduce(function (result, arg) { | ||
return _Object$assign(result, arg); | ||
return Object.assign(result, arg); | ||
}); | ||
@@ -127,2 +124,3 @@ }).subscribe(this.observablesSubscribeOnNext, this.observablesSubscribeOnError); | ||
/** | ||
@@ -135,3 +133,2 @@ * Unsubscribe from observables. | ||
} | ||
}; | ||
module.exports = exports['default']; | ||
}; |
{ | ||
"name": "react-observable-mixin", | ||
"version": "1.0.10", | ||
"version": "2.0.0", | ||
"description": "Container like observable mixin for ReactJS.", | ||
@@ -10,3 +10,2 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-runtime": "^6.0.14", | ||
"rx-lite": "^4.0.6", | ||
@@ -16,16 +15,18 @@ "shallowequal": "^0.2.2" | ||
"devDependencies": { | ||
"@doctolib/gulp-tasks": "^1.0.0", | ||
"babel-eslint": "^4.1.3", | ||
"@doctolib/gulp-tasks": "^5.0.0", | ||
"babel-eslint": "^6.0.2", | ||
"babel-preset-doctolib": "^2.0.0", | ||
"chai": "^3.3.0", | ||
"eslint": "^1.7.3", | ||
"eslint-config-doctolib": "^1.0.2", | ||
"eslint-plugin-mocha": "^1.0.0", | ||
"eslint-plugin-react": "^3.6.3", | ||
"eslint": "^2.8.0", | ||
"eslint-config-doctolib": "^2.0.0", | ||
"eslint-plugin-mocha": "^2.2.0", | ||
"eslint-plugin-react": "^5.0.1", | ||
"gulp": "^3.9.0", | ||
"jsdom": "^7.0.1", | ||
"jsdom": "^8.4.0", | ||
"mocha": "^2.3.3", | ||
"mocha-jsdom": "^1.0.0", | ||
"react": "^0.14.0", | ||
"react-addons-test-utils": "^0.14.0", | ||
"react-dom": "^0.14.0", | ||
"react": "^15.0.1", | ||
"react-addons-pure-render-mixin": "^15.0.1", | ||
"react-addons-test-utils": "^15.0.1", | ||
"react-dom": "^15.0.1", | ||
"react-prism": "^3.0.0", | ||
@@ -32,0 +33,0 @@ "react-pure-render": "^1.0.2", |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
2
9268
20
135
1
1
- Removedbabel-runtime@^6.0.14
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.11.1(transitive)