@opengis/fastify-table 1.2.54 → 1.2.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.2.54",
3
+ "version": "1.2.55",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -0,0 +1,5 @@
1
+ import { dump } from "js-yaml";
2
+
3
+ const yml2json = (json) => dump(json || {});
4
+
5
+ export default yml2json;
@@ -0,0 +1,13 @@
1
+ import { load } from "js-yaml";
2
+
3
+ function loadSafe(yml) {
4
+ try {
5
+ return load(yml);
6
+ } catch (err) {
7
+ return { error: err.toString() };
8
+ }
9
+ };
10
+
11
+ const yml2json = (yml) => loadSafe(yml);
12
+
13
+ export default yml2json;
package/utils.js CHANGED
@@ -70,6 +70,9 @@ import getFolder from './server/plugins/crud/funcs/utils/getFolder.js';
70
70
 
71
71
  import logChanges from './server/plugins/crud/funcs/utils/logChanges.js';
72
72
 
73
+ import yml2json from './server/plugins/yml/funcs/yml2json.js';
74
+ import json2yml from './server/plugins/yml/funcs/json2yml.js';
75
+
73
76
  export default null;
74
77
  export {
75
78
  config,
@@ -134,4 +137,7 @@ export {
134
137
  getSelect,
135
138
 
136
139
  logChanges,
140
+
141
+ yml2json,
142
+ json2yml,
137
143
  };