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

uncontrollable

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uncontrollable - npm Package Compare versions

Comparing version 3.2.3 to 3.2.4

14

batching.js

@@ -5,8 +5,6 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _ReactUpdates = require('react/lib/ReactUpdates');
var _reactLibReactUpdates = require('react/lib/ReactUpdates');
var _ReactUpdates2 = _interopRequireDefault(_ReactUpdates);
var _reactLibReactUpdates2 = _interopRequireDefault(_reactLibReactUpdates);
var _createUncontrollable = require('./createUncontrollable');

@@ -16,2 +14,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mixin = {

@@ -30,4 +30,4 @@ componentWillReceiveProps: function componentWillReceiveProps() {

_reactLibReactUpdates2['default'].batchedUpdates(function () {
_reactLibReactUpdates2['default'].asap(function () {
_ReactUpdates2.default.batchedUpdates(function () {
_ReactUpdates2.default.asap(function () {
if (component.isMounted() && component._needsUpdate) {

@@ -42,3 +42,3 @@ component._needsUpdate = false;

exports['default'] = _createUncontrollable2['default']([mixin], set);
exports.default = (0, _createUncontrollable2.default)([mixin], set);
module.exports = exports['default'];

@@ -7,14 +7,12 @@ 'use strict';

exports['default'] = createUncontrollable;
exports.default = createUncontrollable;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react2 = _interopRequireDefault(_react);
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _invariant = require('invariant');
var _react = require('react');
var _invariant2 = _interopRequireDefault(_invariant);
var _react2 = _interopRequireDefault(_react);
var _utils = require('./utils');

@@ -24,2 +22,8 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function createUncontrollable(mixins, set) {

@@ -34,2 +38,3 @@

basePropTypes = utils.getType(Component).propTypes,
isCompositeComponent = utils.isReactComponent(Component),
propTypes;

@@ -39,2 +44,3 @@

(0, _invariant2.default)(isCompositeComponent || !methods.length, '[uncontrollable] stateless function components cannot pass through methods ' + 'becasue they have no associated instances. Check component: ' + displayName + ', ' + 'attempting to pass through methods: ' + methods.join(', '));
methods = utils.transform(methods, function (obj, method) {

@@ -48,3 +54,3 @@ obj[method] = function () {

var component = _react2['default'].createClass(_extends({
var component = _react2.default.createClass(_extends({

@@ -58,3 +64,2 @@ displayName: 'Uncontrolled(' + displayName + ')',

}, methods, {
componentWillMount: function componentWillMount() {

@@ -69,2 +74,3 @@ var props = this.props,

/**

@@ -86,3 +92,2 @@ * If a prop switches from controlled to Uncontrolled

},
render: function render() {

@@ -111,7 +116,8 @@ var _this2 = this;

newProps = _extends({}, props, newProps, { ref: 'inner' });
newProps = _extends({}, props, newProps, {
ref: isCompositeComponent ? 'inner' : null
});
return _react2['default'].createElement(Component, newProps);
return _react2.default.createElement(Component, newProps);
}
}));

@@ -125,4 +131,5 @@

*/
component.deferControlTo = function (newComponent, additions, nextMethods) {
if (additions === undefined) additions = {};
component.deferControlTo = function (newComponent) {
var additions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var nextMethods = arguments[2];

@@ -154,3 +161,2 @@ return uncontrollable(newComponent, _extends({}, controlledValues, additions), nextMethods);

}
module.exports = exports['default'];

@@ -5,4 +5,2 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _createUncontrollable = require('./createUncontrollable');

@@ -12,2 +10,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mixin = {

@@ -32,3 +32,3 @@ shouldComponentUpdate: function shouldComponentUpdate() {

exports['default'] = _createUncontrollable2['default']([mixin], set);
exports.default = (0, _createUncontrollable2.default)([mixin], set);
module.exports = exports['default'];
{
"name": "uncontrollable",
"version": "3.2.3",
"version": "3.2.4",
"description": "Wrap a controlled react component, to allow specific prop/handler pairs to be uncontrolled",

@@ -20,41 +20,5 @@ "author": {

],
"scripts": {
"test": "karma start --single-run",
"clean": "rimraf lib",
"copy": "cpy ./README.md ./lib",
"tdd": "karma start",
"build": "npm run test && npm run clean && babel src --out-dir lib && npm run copy",
"release": "release"
},
"peerDependencies": {
"react": ">=0.11.0"
},
"release-script": {
"defaultDryRun": "false",
"altPkgRootFolder": "lib"
},
"devDependencies": {
"babel": "^5.8.21",
"babel-eslint": "^4.0.5",
"babel-loader": "^5.3.2",
"chai": "^1.10.0",
"chai-as-promised": "^4.1.1",
"cpy": "^3.4.0",
"eslint": "^0.24.1",
"imports-loader": "^0.6.3",
"karma": "~0.12.23",
"karma-mocha": "~0.1.9",
"karma-mocha-reporter": "^0.3.1",
"karma-phantomjs-launcher": "~0.1.4",
"karma-sourcemap-loader": "^0.3.2",
"karma-webpack": "~1.2.2",
"mocha": "~1.21.4",
"phantomjs": "^1.9.16",
"react": ">=0.11.0",
"rimraf": "^2.2.8",
"sinon-chai": "^2.6.0",
"style-loader": "^0.8.3",
"webpack": "^1.4.15",
"webpack-dev-server": "^1.7.0"
},
"dependencies": {

@@ -61,0 +25,0 @@ "invariant": "^2.1.0"

@@ -0,0 +0,0 @@ # uncontrollable

'use strict';
exports.__esModule = true;
exports.version = undefined;
exports.customPropType = customPropType;

@@ -13,6 +14,5 @@ exports.uncontrolledPropTypes = uncontrolledPropTypes;

exports.each = each;
exports.isReactComponent = isReactComponent;
exports.has = has;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');

@@ -26,2 +26,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function customPropType(handler, propType, name) {

@@ -48,3 +50,3 @@

_invariant2['default'](typeof handler === 'string' && handler.trim().length, 'Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable', displayName, prop);
(0, _invariant2.default)(typeof handler === 'string' && handler.trim().length, 'Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable', displayName, prop);

@@ -60,6 +62,4 @@ obj[prop] = customPropType(handler, type, displayName);

var version = _react2['default'].version.split('.').map(parseFloat);
var version = exports.version = _react2.default.version.split('.').map(parseFloat);
exports.version = version;
function getType(component) {

@@ -110,7 +110,21 @@ if (version[0] >= 15 || version[0] === 0 && version[1] >= 13) return component;

for (var key in obj) if (has(obj, key)) cb.call(thisArg, obj[key], key, obj);
for (var key in obj) {
if (has(obj, key)) cb.call(thisArg, obj[key], key, obj);
}
}
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
function isReactComponent(component) {
return !!(component && component.prototype && component.prototype.isReactComponent);
}
function has(o, k) {
return o ? Object.prototype.hasOwnProperty.call(o, k) : false;
}
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