pacc 2.1.2 → 2.1.4

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
@@ -13,22 +13,35 @@
13
13
 
14
14
  propetty path utils
15
15
 
16
+
17
+ ```js
18
+ import { getAttribute } from "pacc";
19
+
20
+ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
21
+ // result === 4
22
+ ```
23
+
16
24
  # API
17
25
 
18
26
  <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
19
27
 
20
28
  ### Table of Contents
21
29
 
22
- * [AttributeDefinition](#attributedefinition)
23
- * [Properties](#properties)
24
- * [setAttribute](#setattribute)
25
- * [Parameters](#parameters)
26
- * [getAttribute](#getattribute)
27
- * [Parameters](#parameters-1)
28
- * [getAttributeAndOperator](#getattributeandoperator)
29
- * [Parameters](#parameters-2)
30
- * [tokens](#tokens)
31
- * [Parameters](#parameters-3)
30
+ - [pacc](#pacc)
31
+ - [API](#api)
32
+ - [Table of Contents](#table-of-contents)
33
+ - [AttributeDefinition](#attributedefinition)
34
+ - [Properties](#properties)
35
+ - [setAttribute](#setattribute)
36
+ - [Parameters](#parameters)
37
+ - [getAttribute](#getattribute)
38
+ - [Parameters](#parameters-1)
39
+ - [getAttributeAndOperator](#getattributeandoperator)
40
+ - [Parameters](#parameters-2)
41
+ - [tokens](#tokens)
42
+ - [Parameters](#parameters-3)
43
+ - [install](#install)
44
+ - [license](#license)
32
45
 
33
46
  ## AttributeDefinition
34
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "ava": "^5.3.1",
29
- "browser-ava": "^2.0.0",
29
+ "browser-ava": "^2.1.0",
30
30
  "c8": "^8.0.1",
31
31
  "documentation": "^14.0.2",
32
32
  "semantic-release": "^22.0.7"
package/src/attribute.mjs CHANGED
@@ -47,15 +47,7 @@ export function setAttribute(object, expression, value) {
47
47
 
48
48
  default:
49
49
  if (anchor) {
50
- switch (typeof token) {
51
- case "number":
52
- object = [];
53
- break;
54
- case "string":
55
- object = {};
56
- break;
57
- }
58
- anchor[anchorKey] = object;
50
+ anchor[anchorKey] = object = (typeof token === "string" ? {} : []);
59
51
  anchor = undefined;
60
52
  }
61
53