@bagelink/sdk 0.0.1074 → 0.0.1078

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/dist/index.cjs CHANGED
@@ -66,11 +66,13 @@ const cleanOptionals = (str) => str.split(" | ").filter((t) => t !== "null" && t
66
66
  function formatVarType(varName, schema, required = false, defaultValue) {
67
67
  let type = schemaToType(schema);
68
68
  type = cleanOptionals(type);
69
- let defaultStr = defaultValue ? ` = ${defaultValue}` : "";
70
- if (defaultStr && type === "string" && typeof defaultValue === "string" && !defaultValue.startsWith("'") && !defaultValue.startsWith('"')) {
71
- defaultStr = ` = '${defaultValue}'`;
72
- } else if (defaultValue && (typeof defaultValue === "object" || defaultValue === "{}")) {
73
- defaultStr = " = {}";
69
+ let defaultStr = "";
70
+ if (defaultValue) {
71
+ if (typeof defaultValue === "string") {
72
+ defaultStr = ` = '${defaultValue}'`;
73
+ } else {
74
+ defaultStr = ` = ${defaultValue}`;
75
+ }
74
76
  }
75
77
  let optionalStr = required || isOptional(schema) ? "?" : "";
76
78
  if (defaultStr)
package/dist/index.mjs CHANGED
@@ -60,11 +60,13 @@ const cleanOptionals = (str) => str.split(" | ").filter((t) => t !== "null" && t
60
60
  function formatVarType(varName, schema, required = false, defaultValue) {
61
61
  let type = schemaToType(schema);
62
62
  type = cleanOptionals(type);
63
- let defaultStr = defaultValue ? ` = ${defaultValue}` : "";
64
- if (defaultStr && type === "string" && typeof defaultValue === "string" && !defaultValue.startsWith("'") && !defaultValue.startsWith('"')) {
65
- defaultStr = ` = '${defaultValue}'`;
66
- } else if (defaultValue && (typeof defaultValue === "object" || defaultValue === "{}")) {
67
- defaultStr = " = {}";
63
+ let defaultStr = "";
64
+ if (defaultValue) {
65
+ if (typeof defaultValue === "string") {
66
+ defaultStr = ` = '${defaultValue}'`;
67
+ } else {
68
+ defaultStr = ` = ${defaultValue}`;
69
+ }
68
70
  }
69
71
  let optionalStr = required || isOptional(schema) ? "?" : "";
70
72
  if (defaultStr)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/sdk",
3
3
  "type": "module",
4
- "version": "0.0.1074",
4
+ "version": "0.0.1078",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -65,12 +65,13 @@ export function formatVarType(varName: string, schema: any, required = false, de
65
65
  let type = schemaToType(schema)
66
66
  type = cleanOptionals(type)
67
67
 
68
- let defaultStr = defaultValue ? ` = ${defaultValue}` : ''
69
-
70
- if (defaultStr && type === 'string' && typeof defaultValue === 'string' && !defaultValue.startsWith('\'') && !defaultValue.startsWith('"')) {
71
- defaultStr = ` = '${defaultValue}'`
72
- } else if (defaultValue && (typeof defaultValue === 'object' || defaultValue === '{}')) {
73
- defaultStr = ' = {}'
68
+ let defaultStr = ''
69
+ if (defaultValue) {
70
+ if (typeof defaultValue === 'string') {
71
+ defaultStr = ` = '${defaultValue}'`
72
+ } else {
73
+ defaultStr = ` = ${defaultValue}`
74
+ }
74
75
  }
75
76
 
76
77
  let optionalStr = required || isOptional(schema) ? '?' : ''