Socket
Socket
Sign inDemoInstall

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 8.0.2 to 8.0.3

11

CHANGELOG.md

@@ -0,1 +1,12 @@

## [8.0.3](https://github.com/jquense/uncontrollable/compare/v8.0.2...v8.0.3) (2023-07-28)
### Bug Fixes
* pass throguh return value if present ([38c308a](https://github.com/jquense/uncontrollable/commit/38c308a7e5bd56460aafb2a20b38bdf633ec9350))
## [8.0.2](https://github.com/jquense/uncontrollable/compare/v8.0.1...v8.0.2) (2023-05-22)

@@ -2,0 +13,0 @@

9

lib/cjs/index.d.ts

@@ -1,5 +0,8 @@

export type Handler = (...args: any[]) => any;
export type Handler<TProp = any> = (prop: TProp, ...args: any[]) => any;
export declare function defaultKey(key: string): string;
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [TProp | undefined, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler<TProp> = Handler<TProp>>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler<TProp> = Handler<TProp>>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [
TProp | undefined,
(...args: Parameters<THandler>) => ReturnType<THandler> | void
];
export { useUncontrolledProp };

@@ -6,0 +9,0 @@ type FilterFlags<Base, Condition> = {

@@ -28,5 +28,7 @@ "use strict";

}
return [isProp ? propValue : stateValue, (0, _react.useCallback)((value, ...args) => {
if (handler) handler(value, ...args);
return [isProp ? propValue : stateValue, (0, _react.useCallback)((...args) => {
const [value, ...rest] = args;
let returnValue = handler == null ? void 0 : handler(value, ...rest);
setState(value);
return returnValue;
}, [handler])];

@@ -33,0 +35,0 @@ }

@@ -1,5 +0,8 @@

export type Handler = (...args: any[]) => any;
export type Handler<TProp = any> = (prop: TProp, ...args: any[]) => any;
export declare function defaultKey(key: string): string;
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler = Handler>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [TProp | undefined, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler<TProp> = Handler<TProp>>(propValue: TProp | undefined, defaultValue: TProp, handler?: THandler): readonly [TProp, THandler];
declare function useUncontrolledProp<TProp, THandler extends Handler<TProp> = Handler<TProp>>(propValue: TProp | undefined, defaultValue?: TProp | undefined, handler?: THandler): readonly [
TProp | undefined,
(...args: Parameters<THandler>) => ReturnType<THandler> | void
];
export { useUncontrolledProp };

@@ -6,0 +9,0 @@ type FilterFlags<Base, Condition> = {

@@ -22,5 +22,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

}
return [isProp ? propValue : stateValue, useCallback((value, ...args) => {
if (handler) handler(value, ...args);
return [isProp ? propValue : stateValue, useCallback((...args) => {
const [value, ...rest] = args;
let returnValue = handler == null ? void 0 : handler(value, ...rest);
setState(value);
return returnValue;
}, [handler])];

@@ -27,0 +29,0 @@ }

{
"name": "uncontrollable",
"version": "8.0.2",
"version": "8.0.3",
"description": "Wrap a controlled react component, to allow specific prop/handler pairs to be uncontrolled",

@@ -27,3 +27,2 @@ "author": {

"tdd": "jest --watch",
"lint": "eslint src test",
"build": "build src",

@@ -30,0 +29,0 @@ "prepublishOnly": "npm run build",

Sorry, the diff of this file is not supported yet

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