@bigbinary/babel-preset-neeto 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,8 +41,8 @@ module.exports = {
41
41
 
42
42
  ## Available plugins
43
43
 
44
- - [zustand-pick](https://github.com/bigbinary/babel-preset-neeto/blob/e8433f3a019cf96dcb0ea29d46393bcf5868406d/docs/zustand-pick.md)
45
- - [zustand-pick-from](https://github.com/bigbinary/babel-preset-neeto/blob/e8433f3a019cf96dcb0ea29d46393bcf5868406d/docs/zustand-pick-from.md)
44
+ - [zustand-pick](https://github.com/bigbinary/babel-preset-neeto/blob/main/docs/zustand-pick.md)
45
+ - [zustand-pick-from](https://github.com/bigbinary/babel-preset-neeto/blob/main/docs/zustand-pick-from.md)
46
46
 
47
47
  ## Other links
48
48
 
@@ -75,6 +75,9 @@ const { order, setOrder } = useGlobalStore.pick();
75
75
  // picks `id` and `user` from inside store.order
76
76
  const { id, user } = useGlobalStore.pick("order");
77
77
 
78
+ // supports default values
79
+ const { user = {} } = useGlobalStore.pick();
80
+
78
81
  // picks `quantity` of dynamically obtained item of id `itemId`
79
82
  const { quantity } = useGlobalStore.pick(["order", "items", itemId]);
80
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/babel-preset-neeto",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A babel preset to transform short code to boilerplate at compile time",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -53,7 +53,9 @@ const PICK_STRICT_PATTERN = {
53
53
  matches({
54
54
  type: "ObjectProperty",
55
55
  method: false,
56
- value: { type: "Identifier" },
56
+ value: {
57
+ type: includes(__, ["Identifier", "AssignmentPattern"]),
58
+ },
57
59
  })
58
60
  ),
59
61
  },
@@ -0,0 +1 @@
1
+ const { orderId = "#1001", customer = {} } = useGlobalStore.pick();
@@ -0,0 +1,8 @@
1
+ import { shallow } from "zustand/shallow";
2
+ const { orderId = "#1001", customer = {} } = useGlobalStore(
3
+ store => ({
4
+ orderId: store["orderId"],
5
+ customer: store["customer"],
6
+ }),
7
+ shallow
8
+ );