use-undoable
Advanced tools
Comparing version 3.3.2 to 3.3.3
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
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
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
57395
480
462