@karmaniverous/jsonmap 0.2.0 → 0.2.1

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
@@ -111,44 +111,44 @@ const output = await jsonMap.transform(input);
111
111
  ```
112
112
 
113
113
  The [unit tests](https://github.com/karmaniverous/jsonmap/blob/main/lib/JsonMap/JsonMap.test.js) demonstrate this example in action.
114
-
114
+
115
115
  # API Documentation
116
116
 
117
- <a name="JsonMap"></a>
118
-
119
- ## JsonMap
120
- JsonMap class to apply transformations to a JSON object
121
-
122
- **Kind**: global class
123
-
124
- * [JsonMap](#JsonMap)
125
- * [new JsonMap([map], [lib])](#new_JsonMap_new)
126
- * [.transform(input)](#JsonMap+transform) ⇒ <code>object</code>
127
-
128
- <a name="new_JsonMap_new"></a>
129
-
130
- ### new JsonMap([map], [lib])
131
- Creates an instance of JsonMap.
132
-
133
-
134
- | Param | Type | Description |
135
- | --- | --- | --- |
136
- | [map] | <code>object</code> | The data mapping configuration. |
137
- | [lib] | <code>object</code> | A collection of function libraries. |
138
-
139
- <a name="JsonMap+transform"></a>
140
-
141
- ### jsonMap.transform(input) ⇒ <code>object</code>
142
- Transforms the input data according to the map configuration.
143
-
144
- **Kind**: instance method of [<code>JsonMap</code>](#JsonMap)
145
- **Returns**: <code>object</code> - - The transformed data.
146
-
147
- | Param | Type | Description |
148
- | --- | --- | --- |
149
- | input | <code>object</code> | The input data to be transformed. |
150
-
151
-
117
+ <a name="JsonMap"></a>
118
+
119
+ ## JsonMap
120
+ JsonMap class to apply transformations to a JSON object
121
+
122
+ **Kind**: global class
123
+
124
+ * [JsonMap](#JsonMap)
125
+ * [new JsonMap([map], [lib])](#new_JsonMap_new)
126
+ * [.transform(input)](#JsonMap+transform) ⇒ <code>object</code>
127
+
128
+ <a name="new_JsonMap_new"></a>
129
+
130
+ ### new JsonMap([map], [lib])
131
+ Creates an instance of JsonMap.
132
+
133
+
134
+ | Param | Type | Description |
135
+ | --- | --- | --- |
136
+ | [map] | <code>object</code> | The data mapping configuration. |
137
+ | [lib] | <code>object</code> | A collection of function libraries. |
138
+
139
+ <a name="JsonMap+transform"></a>
140
+
141
+ ### jsonMap.transform(input) ⇒ <code>object</code>
142
+ Transforms the input data according to the map configuration.
143
+
144
+ **Kind**: instance method of [<code>JsonMap</code>](#JsonMap)
145
+ **Returns**: <code>object</code> - - The transformed data.
146
+
147
+ | Param | Type | Description |
148
+ | --- | --- | --- |
149
+ | input | <code>object</code> | The input data to be transformed. |
150
+
151
+
152
152
  ---
153
153
 
154
154
  See more great templates and other tools on
@@ -50,8 +50,8 @@ class JsonMap {
50
50
  // Calls the #transform method to perform the transformation
51
51
  const result = await this.#transform(this.map, this.input, this.output);
52
52
 
53
- // Recursively eliminate keys starting with $.
54
- const deep = value => (0, _lodash7.default)(value) ? (0, _lodash9.default)((0, _lodash10.default)(value, (v, k) => /^[^$]/.test(k)), value => (0, _lodash2.default)(value, deep)) : undefined;
53
+ // Recursively eliminate string keys starting with $.
54
+ const deep = value => (0, _lodash7.default)(value) ? (0, _lodash9.default)((0, _lodash10.default)(value, (v, k) => !(0, _lodash8.default)(k) || /^[^$]/.test(k)), value => (0, _lodash2.default)(value, deep)) : undefined;
55
55
  return (0, _lodash2.default)(result, deep);
56
56
  }
57
57
 
@@ -41,11 +41,11 @@ class JsonMap {
41
41
  // Calls the #transform method to perform the transformation
42
42
  const result = await this.#transform(this.map, this.input, this.output);
43
43
 
44
- // Recursively eliminate keys starting with $.
44
+ // Recursively eliminate string keys starting with $.
45
45
  const deep = (value) =>
46
46
  isPlainObject(value)
47
47
  ? mapValues(
48
- pickBy(value, (v, k) => /^[^$]/.test(k)),
48
+ pickBy(value, (v, k) => !isString(k) || /^[^$]/.test(k)),
49
49
  (value) => cloneDeepWith(value, deep)
50
50
  )
51
51
  : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karmaniverous/jsonmap",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,26 +36,27 @@
36
36
  "lodash.size": "^4.2.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/cli": "^7.21.5",
40
- "@babel/core": "^7.22.1",
41
- "@babel/eslint-parser": "^7.21.8",
42
- "@babel/plugin-syntax-import-assertions": "^7.20.0",
43
- "@babel/preset-env": "^7.22.4",
44
- "@babel/register": "^7.21.0",
45
- "@karmaniverous/get-dotenv": "^2.4.1",
46
- "@types/node": "^20.2.5",
39
+ "@babel/cli": "^7.22.10",
40
+ "@babel/core": "^7.22.10",
41
+ "@babel/eslint-parser": "^7.22.10",
42
+ "@babel/plugin-syntax-import-assertions": "^7.22.5",
43
+ "@babel/preset-env": "^7.22.10",
44
+ "@babel/register": "^7.22.5",
45
+ "@karmaniverous/get-dotenv": "^3.1.13",
46
+ "@types/node": "^20.5.3",
47
+ "auto-changelog": "^2.4.0",
47
48
  "chai": "^4.3.7",
48
49
  "concat-md": "^0.5.1",
49
- "eslint": "^8.41.0",
50
+ "eslint": "^8.47.0",
50
51
  "eslint-config-standard": "^17.1.0",
51
- "eslint-plugin-jsdoc": "^46.1.0",
52
+ "eslint-plugin-jsdoc": "^46.5.0",
52
53
  "eslint-plugin-mocha": "^10.1.0",
53
54
  "jsdoc-to-markdown": "^8.0.0",
54
55
  "lodash": "^4.17.21",
55
56
  "mocha": "^10.2.0",
56
57
  "numeral": "^2.0.6",
57
- "prettier": "^2.8.8",
58
- "release-it": "^15.10.3"
58
+ "prettier": "^3.0.2",
59
+ "release-it": "^16.1.5"
59
60
  },
60
61
  "exports": {
61
62
  ".": {
@@ -76,9 +77,27 @@
76
77
  "spec": "./**/*.test.!(*.*)"
77
78
  },
78
79
  "release-it": {
80
+ "git": {
81
+ "changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
82
+ "requireBranch": "main",
83
+ "commitMessage": "chore: release v${version}"
84
+ },
79
85
  "github": {
80
86
  "release": true
81
87
  },
88
+ "hooks": {
89
+ "after:init": [
90
+ "nr lint",
91
+ "nr test",
92
+ "nr build",
93
+ "nr doc"
94
+ ],
95
+ "after:release": [
96
+ "git switch -c release/${version}",
97
+ "git push -u origin release/${version}",
98
+ "git switch main"
99
+ ]
100
+ },
82
101
  "npm": {
83
102
  "publish": true
84
103
  }
@@ -88,8 +107,8 @@
88
107
  "doc": "jsdoc2md -c doc/jsdoc.config.json -f lib/**/*.* -t doc/api-template.hbs > doc/2-api.jsdoc2.md && concat-md doc --hide-anchor-links > README.md",
89
108
  "lint": "eslint lib/**",
90
109
  "prerelease": "npm run lint && npm run test && npm run build && npm run doc",
91
- "release": "release-it",
92
- "test": "getdotenv -c \"mocha\" -p ./ ./env -d dev -y ./env/dynamic.js"
110
+ "release": "getdotenv -c \"release-it\"",
111
+ "test": "getdotenv -c \"mocha\""
93
112
  },
94
113
  "type": "module"
95
114
  }