Skip to content

Commit 34d95e1

Browse files
committed
New icon
1 parent 14866c3 commit 34d95e1

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ vsc-extension-quickstart.md
77
**/jsconfig.json
88
**/*.map
99
**/.eslintrc.json
10-
media/**
10+
media/main.png
1111
node_modules
1212
src

media/logo.png

19.4 KB
Loading

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"engines": {
88
"vscode": "^1.61.0"
99
},
10+
"icon": "media/logo.png",
1011
"keywords": [
1112
"ibmi",
1213
"as400",

src/language/json.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports.generateSQL = (jsonIn) => {
3737
}
3838

3939
const generateArray = (elementIn) => {
40-
const firstValue = Array.isArray(elementIn) ? elementIn[0] : elementIn;
40+
const firstValue = (Array.isArray(elementIn) ? elementIn[0] : elementIn) || ``;
4141
if (typeof firstValue === `object`) {
4242
return `(SELECT json_arrayagg(${generateObject(firstValue)}) from SYSIBM.SYSDUMMY1)`
4343
} else {
@@ -50,14 +50,26 @@ const generateObject = (objIn) => {
5050

5151
Object.keys(objIn).forEach((key) => {
5252
const value = objIn[key];
53-
if (typeof value === `object`) {
54-
if (Array.isArray(value)) {
55-
items.push(`'${key}': ${generateArray(value[0])} format json`);
53+
if (value) {
54+
if (typeof value === `object`) {
55+
if (Array.isArray(value)) {
56+
items.push(`'${key}': ${generateArray(value[0])} format json`);
57+
} else {
58+
items.push(`'${key}': ${generateObject(value)}`);
59+
}
5660
} else {
57-
items.push(`'${key}': ${generateObject(value)}`);
61+
switch (typeof value) {
62+
case `string`:
63+
items.push(`'${key}': '${value}'`);
64+
break;
65+
case `boolean`:
66+
items.push(`'${key}': '${value}' format json`);
67+
break;
68+
default:
69+
items.push(`'${key}': ${value}`);
70+
break;
71+
}
5872
}
59-
} else {
60-
items.push(`'${key}': ${typeof value === `string` ? `'${value}'` : value}`);
6173
}
6274
});
6375

0 commit comments

Comments
 (0)