New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@swear-js/react

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swear-js/react - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

2

lib/types.d.ts

@@ -1,2 +0,2 @@

export declare type SwearMutateType<T> = ((payload: T) => void) | (() => void);
export declare type SwearMutateType<T> = ((payload: T | ((prev: T) => T), tag?: string) => void) | (() => void);
export declare type SwearType<T, Y> = [

@@ -3,0 +3,0 @@ name: string,

@@ -40,3 +40,3 @@ "use strict";

}); };
var mutator = function (payload) { return (store === null || store === void 0 ? void 0 : store.setSwearValue(swearId, 'someAction', payload)); };
var mutator = function (payload, tag) { return store === null || store === void 0 ? void 0 : store.setSwearValue(swearId, tag !== null && tag !== void 0 ? tag : null, payload instanceof Function ? payload(swearValue) : payload); };
return [swearValue, __assign(__assign({}, defaultActions(mutator)), actions(mutator))];

@@ -43,0 +43,0 @@ };

{
"name": "@swear-js/react",
"version": "2.0.2",
"version": "2.1.0",
"description": "React support for swear-js",

@@ -31,3 +31,3 @@ "repository": {

"dependencies": {
"@swear-js/core": "^2.0.0",
"@swear-js/core": "^2.1.0",
"@types/node": "^17.0.24",

@@ -51,3 +51,3 @@ "@types/react": "^18.0.5",

},
"gitHead": "63420ec4fda43dbe2e2aa2000a17a2391bc5f253"
"gitHead": "ac4163c86f8f39d83f6cb172f6e7bb40cc7791b5"
}

@@ -55,10 +55,7 @@ # 🍭 Swear JS

export const countSwear = createSwear('counter', defaultState, {
set: (mutate) => (payload: number) => {
mutate(payload);
},
clear: (mutate) => () => {
mutate(defaultState);
},
});
// mutate is a function that changes your state in store
export const countSwear = createSwear('counter', defaultState, (mutate) => ({
set: (payload: number) => mutate(payload),
clear: mutate(defaultState, 'HERE YOUR TAG'), // You can also tag your store updates
}));
```

@@ -65,0 +62,0 @@

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