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 4.0.1 to 4.0.2

2

package.json
{
"name": "uncontrollable",
"version": "4.0.1",
"version": "4.0.2",
"description": "Wrap a controlled react component, to allow specific prop/handler pairs to be uncontrolled",

@@ -5,0 +5,0 @@ "author": {

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

exports.version = undefined;
exports.customPropType = customPropType;
exports.uncontrolledPropTypes = uncontrolledPropTypes;

@@ -15,4 +14,4 @@ exports.getType = getType;

exports.each = each;
exports.has = has;
exports.isReactComponent = isReactComponent;
exports.has = has;

@@ -29,6 +28,17 @@ var _react = require('react');

function customPropType(handler, propType, name) {
function defaultPropType(controlledPropName, propType) {
return function (props, name) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
return function (props, propName, wrappedName) {
// never consider a defaultProp "required", bit a hack.
if (props[name] != null) {
return propType.apply(undefined, [props, name].concat(args));
}
};
}
function readOnlyPropType(handler, name) {
return function (props, propName) {
if (props[propName] !== undefined) {

@@ -38,8 +48,2 @@ if (!props[handler]) {

}
for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
args[_key - 3] = arguments[_key];
}
return propType && propType.apply(undefined, [props, propName, name].concat(args));
}

@@ -58,5 +62,5 @@ };

obj[prop] = customPropType(handler, type, displayName);
obj[prop] = readOnlyPropType(handler, displayName);
if (type !== undefined) obj[defaultKey(prop)] = type;
if (type !== undefined) obj[defaultKey(prop)] = defaultPropType(prop, type);
}, propTypes);

@@ -120,2 +124,6 @@ }

function has(o, k) {
return o ? Object.prototype.hasOwnProperty.call(o, k) : false;
}
/**

@@ -131,6 +139,2 @@ * Copyright (c) 2013-present, Facebook, Inc.

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