Comparing version 0.0.4 to 0.0.5
{ | ||
"dist/index.js": { | ||
"bundled": 1904, | ||
"minified": 852, | ||
"gzipped": 408, | ||
"bundled": 1877, | ||
"minified": 829, | ||
"gzipped": 394, | ||
"treeshaked": { | ||
@@ -17,6 +17,6 @@ "rollup": { | ||
"dist/index.cjs.js": { | ||
"bundled": 2692, | ||
"minified": 1207, | ||
"gzipped": 482 | ||
"bundled": 2665, | ||
"minified": 1184, | ||
"gzipped": 469 | ||
} | ||
} |
@@ -39,3 +39,3 @@ 'use strict'; | ||
if (sliceRef.current !== selected && typeof selected === 'object' && !Array.isArray(selected)) { | ||
if (sliceRef.current !== selected && selected === Object(selected)) { | ||
selected = Object.entries(selected).reduce(function (acc, _ref) { | ||
@@ -42,0 +42,0 @@ var _Object$assign; |
@@ -24,3 +24,3 @@ import React from 'react'; | ||
if (sliceRef.current !== selected && typeof selected === 'object' && !Array.isArray(selected)) { | ||
if (sliceRef.current !== selected && selected === Object(selected)) { | ||
selected = Object.entries(selected).reduce((acc, [key, value]) => sliceRef.current[key] !== value ? Object.assign({}, acc, { | ||
@@ -27,0 +27,0 @@ [key]: value |
{ | ||
"name": "zustand", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "🐻 Bear necessities for state management in React", | ||
@@ -12,3 +12,5 @@ "main": "dist/index.cjs.js", | ||
"prepare": "npm run build", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "jest", | ||
"test:dev": "jest --watch --no-coverage", | ||
"test:coverage:watch": "jest --watch" | ||
}, | ||
@@ -52,2 +54,25 @@ "husky": { | ||
"homepage": "https://github.com/drcmda/zustand#readme", | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"jest", | ||
"legacy" | ||
], | ||
"testRegex": "test.(js|ts|tsx)$", | ||
"coverageDirectory": "./coverage/", | ||
"collectCoverage": true, | ||
"coverageReporters": [ | ||
"json", | ||
"html", | ||
"text", | ||
"text-summary" | ||
], | ||
"collectCoverageFrom": [ | ||
"src/**/*.js", | ||
"tests/**/*.js" | ||
], | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/setupTests.js" | ||
] | ||
}, | ||
"devDependencies": { | ||
@@ -62,5 +87,11 @@ "@babel/core": "7.3.4", | ||
"@babel/preset-typescript": "^7.3.3", | ||
"enzyme": "^3.9.0", | ||
"enzyme-adapter-react-16": "^1.12.1", | ||
"husky": "^1.3.1", | ||
"jest": "^24.7.1", | ||
"lint-staged": "^8.1.5", | ||
"prettier": "^1.16.4", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"react-testing-library": "^6.1.2", | ||
"rimraf": "^2.6.3", | ||
@@ -67,0 +98,0 @@ "rollup": "^1.9.0", |
@@ -7,3 +7,3 @@ <p align="center"> | ||
Small, fast and scaleable bearbones state-management solution. Has a comfy api based on hooks, isn't that boilerplatey or opinionated, but still just enough to be explicit and flux-like, breaches reconciler boundaries. You can check out a small live demo [here](https://codesandbox.io/s/v8pjv251w7). | ||
Small, fast and scaleable bearbones state-management solution. Has a comfy api based on hooks, isn't that boilerplatey or opinionated, but still just enough to be explicit and flux-like, breaches reconciler boundaries and is cross-platform to boot. Make your paws dirty with a small live demo [here](https://codesandbox.io/s/v8pjv251w7). | ||
@@ -121,3 +121,3 @@ #### Create a store (or multiple, up to you...) | ||
Having to construct nested structes bearhanded is one of the worst aspects of reducing state. Try [immer](https://github.com/mweststrate/immer)! It is a tiny package that allows you to work with immutable state in a more convenient way. You can easily extend your store with it. | ||
Having to build nested structures bearhanded is one of the more tiresome aspects of reducing state. Have you tried [immer](https://github.com/mweststrate/immer)? It is a tiny package that allows you to work with immutable state in a more convenient way. You can easily extend your store with it. | ||
@@ -163,1 +163,17 @@ ```jsx | ||
``` | ||
## Middleware | ||
```jsx | ||
const logger = fn => { | ||
return (set, get) => fn(args => { | ||
console.log(" applying", args) | ||
set(args) | ||
console.log(" new state", get()) | ||
}, get) | ||
} | ||
const [useStore] = create(logger((set, get) => { | ||
return { text: "hello", setText: text => set({ text }) } | ||
})) | ||
``` |
@@ -47,2 +47,2 @@ import path from 'path' | ||
export default [...createConfig('index', 'index')] | ||
export default [...createConfig('src/index', 'index')] |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
408996
22
797
1
177
23
1