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

use-undoable

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-undoable - npm Package Compare versions

Comparing version 3.3.2 to 3.3.3

3

dist/errors.d.ts
declare const payloadError: (func: string) => never;
export { payloadError };
declare const invalidBehavior: (behavior: string) => never;
export { payloadError, invalidBehavior, };

@@ -25,2 +25,6 @@ var react = require('react');

var invalidBehavior = function invalidBehavior(behavior) {
throw new Error("Mutation behavior must be one of: mergePastReversed, mergePast, keepFuture, or destroyFuture. Not: " + behavior);
};
var ensureLimit = function ensureLimit(limit, arr) {

@@ -90,2 +94,3 @@ if (!limit) return arr;

};
if (!behaviorMap.hasOwnProperty(behavior)) invalidBehavior(behavior);
return behaviorMap[behavior];

@@ -92,0 +97,0 @@ };

@@ -25,2 +25,6 @@ import { useReducer, useCallback } from 'react';

var invalidBehavior = function invalidBehavior(behavior) {
throw new Error("Mutation behavior must be one of: mergePastReversed, mergePast, keepFuture, or destroyFuture. Not: " + behavior);
};
var ensureLimit = function ensureLimit(limit, arr) {

@@ -90,2 +94,3 @@ if (!limit) return arr;

};
if (!behaviorMap.hasOwnProperty(behavior)) invalidBehavior(behavior);
return behaviorMap[behavior];

@@ -92,0 +97,0 @@ };

{
"name": "use-undoable",
"version": "3.3.2",
"version": "3.3.3",
"description": "React hook for undo/redo functionality without the hassle.",

@@ -5,0 +5,0 @@ "private": false,

@@ -127,3 +127,3 @@ # useUndoable

Defines the max size for the history. The default is `100.` The resulting `past` array will be +1 whatever number you give. That is, if you set the `historyLimit` to 5, there will actually be 6 total items within the array because the `present` is merged into it on every state change.
Defines the max size for the history. The default is `100`. The resulting `past` array will be +1 whatever number you give. That is, if you set the `historyLimit` to 5, there will actually be 6 total items within the array because the `present` is merged into it on every state change.

@@ -404,2 +404,4 @@ Therefore, if your project absolutely requires there to be only 1,000 **total** items, for example, set the limit to `999`.

One more note: This function **does not** reset the _actual_ state you passed into the hook itself (`useUndoable([])`); it only changes the item at index `0` in the `past` array.
## Performance considerations

@@ -406,0 +408,0 @@

Sorry, the diff of this file is not supported yet

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