New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.2.0 to 3.2.1

4

dist/index.js

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

if (JSON.stringify(payload) === JSON.stringify(present)) {
return state;
}
var futureClone = [].concat(future);

@@ -64,0 +60,0 @@ var behaviorMap = {

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

if (JSON.stringify(payload) === JSON.stringify(present)) {
return state;
}
var futureClone = [].concat(future);

@@ -64,0 +60,0 @@ var behaviorMap = {

2

package.json
{
"name": "use-undoable",
"version": "3.2.0",
"version": "3.2.1",
"description": "React hook for undo/redo functionality without the hassle.",

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

@@ -21,14 +21,14 @@ # useUndoable

const MyComponent = () => {
const initialState = 0;
const initialState = 0;
const [
count,
setCount,
{
undo,
redo
}
] = useUndoable(initialState);
const [
count,
setCount,
{
undo,
redo
}
] = useUndoable(initialState);
return <p>{count}</p>
return <p>{count}</p>
}

@@ -56,15 +56,15 @@ ```

const [
count,
setCount,
count,
setCount,
{
past,
future,
{
past,
future,
undo,
canUndo,
redo,
canRedo,
reset
}
undo,
canUndo,
redo,
canRedo,
reset
}
] = useUndoable(initialState, options);

@@ -79,4 +79,4 @@ ```

const options = {
behavior: 'mergePastReversed' | 'mergePast' | 'destroyFuture' | 'keep future',
historyLimit: number | 'infinium' | 'infinity'
behavior: 'mergePastReversed' | 'mergePast' | 'destroyFuture' | 'keep future',
historyLimit: number | 'infinium' | 'infinity'
}

@@ -89,4 +89,4 @@ ```

{
behavior: 'mergePastReversed',
historyLimit: 100
behavior: 'mergePastReversed',
historyLimit: 100
}

@@ -103,3 +103,3 @@ ```

const options = {
behavior: 'destroyFuture'
behavior: 'destroyFuture'
}

@@ -157,3 +157,3 @@ ```

setCount((count) => {
return count + 1;
return count + 1;
})

@@ -188,5 +188,5 @@ ```

{
past: [0, 1, 2, 3],
present: 4,
future: []
past: [0, 1, 2, 3],
present: 4,
future: []
}

@@ -199,5 +199,5 @@ ```

{
past: [0, 1],
present: 2,
future: [3, 4]
past: [0, 1],
present: 2,
future: [3, 4]
}

@@ -210,5 +210,5 @@ ```

{
past: [0, 1, 4, 3, 2],
present: 3,
future: []
past: [0, 1, 4, 3, 2],
present: 3,
future: []
}

@@ -231,5 +231,5 @@ ```

{
past: [0, 1, 3, 4, 2],
present: 3,
future: []
past: [0, 1, 3, 4, 2],
present: 3,
future: []
}

@@ -246,5 +246,5 @@ ```

{
past: [0, 1, 2, 3],
present: 4,
future: []
past: [0, 1, 2, 3],
present: 4,
future: []
}

@@ -257,5 +257,5 @@ ```

{
past: [0, 1],
present: 2,
future: [3, 4]
past: [0, 1],
present: 2,
future: [3, 4]
}

@@ -268,5 +268,5 @@ ```

{
past: [0, 1, 2],
present: 3,
future: []
past: [0, 1, 2],
present: 3,
future: []
}

@@ -283,5 +283,5 @@ ```

{
past: [0, 1, 2],
present: 3,
future: [3, 4]
past: [0, 1, 2],
present: 3,
future: [3, 4]
}

@@ -324,19 +324,19 @@ ```

const MyComponent = () => {
const [
todos,
setTodos,
{
undo,
redo
}
] = useUndoable([]);
const [
todos,
setTodos,
{
undo,
redo
}
] = useUndoable([]);
useEffect(() => {
// query your API and set the todos
setTodos(api.queryForTodos());
}, []);
useEffect(() => {
// query your API and set the todos
setTodos(api.queryForTodos());
}, []);
return (
// ...
);
return (
// ...
);
};

@@ -351,23 +351,23 @@ ```

const MyComponent = () => {
const [
todos,
setTodos,
{
undo,
redo,
resetInitialState
}
] = useUndoable([]);
const [
todos,
setTodos,
{
undo,
redo,
resetInitialState
}
] = useUndoable([]);
useEffect(() => {
// query your API and set the todos
const apiTodos = api.queryForTodos();
useEffect(() => {
// query your API and set the todos
const apiTodos = api.queryForTodos();
setTodos(apiTodos);
resetInitialState(apiTodos);
}, []);
setTodos(apiTodos);
resetInitialState(apiTodos);
}, []);
return (
// ...
);
return (
// ...
);
};

@@ -398,20 +398,20 @@ ```

const [
count,
setCount,
{
past: currentPast,
future: currentFuture,
count,
setCount,
{
past: currentPast,
future: currentFuture,
undo: undoWithCustomName,
canUndo: canUndoWithCustomName,
redo: redoWithCustomName,
canRedo: canRedoWithCustomName,
reset: deleteEverythingYo
}
undo: undoWithCustomName,
canUndo: canUndoWithCustomName,
redo: redoWithCustomName,
canRedo: canRedoWithCustomName,
reset: deleteEverythingYo
}
] = useUndoable([{
count: 1
count: 1
}]);
deleteEverythingYo({
state: 'My new state'
state: 'My new state'
});

@@ -418,0 +418,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