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

@brightleaf/react-hooks

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightleaf/react-hooks - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

2

lib/__tests__/use-post.test.js

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

await waitForNextUpdate();
expect(result.current.data).toBe('12345');
expect(result.current.data).toBe(12345);
});

@@ -34,0 +34,0 @@ test('should make handle error', async () => {

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

await waitForNextUpdate();
expect(result.current.data).toBe('12345');
expect(result.current.data).toBe(12345);
});

@@ -31,0 +31,0 @@ test('should make handle error', async () => {

@@ -9,6 +9,11 @@ "use strict";

const getData = obj => {
if (obj && obj.data && obj.data.data) return obj.data.data;
if (obj && obj.data) return obj.data;
if (obj.data === null) return null;
return obj;
const data = obj && typeof obj.data === 'string' ? JSON.parse(obj.data) : obj;
if (data && data.data) {
return data.data;
} else if (Array.isArray(data)) {
return data;
}
return data;
};

@@ -44,3 +49,3 @@

return { ...state,
data: action.payload.data,
data: getData(action.payload),
error: null,

@@ -53,3 +58,3 @@ loading: false,

return { ...state,
data: getData(action.payload),
data: getData(action.payload.data),
error: true,

@@ -56,0 +61,0 @@ errorDetails: getError(action.payload),

@@ -112,6 +112,4 @@ "use strict";

const {
data,
error,
loading,
makeRequest
makeRequest,
...props
} = (0, _useRequest.useRequest)(url, {

@@ -139,6 +137,4 @@ data: null,

return {
data,
error,
loading,
makeQuery
makeQuery,
...props
};

@@ -145,0 +141,0 @@ };

{
"name": "@brightleaf/react-hooks",
"version": "3.0.0",
"version": "4.0.0",
"description": "Useful react hooks",

@@ -43,4 +43,3 @@ "files": [

"dependencies": {
"@hapi/nes": "^11.2.2",
"graphql-request": "^1.8.2"
"@hapi/nes": "^11.2.2"
},

@@ -65,2 +64,3 @@ "devDependencies": {

"eslint-plugin-react-hooks": "^2.0.1",
"graphql-request": "^1.8.2",
"hash-source": "^1.0.4",

@@ -90,3 +90,4 @@ "html-loader": "^0.5.5",

"peerDependencies": {
"react": ">= 16.8.6"
"react": ">= 16.8.6",
"graphql-request": "^1.8.2"
},

@@ -93,0 +94,0 @@ "jest": {

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