datagrok-tools 4.14.21 → 4.14.22
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/bin/utils/utils.js +4 -2
- package/package.json +1 -1
package/bin/utils/utils.js
CHANGED
|
@@ -109,7 +109,7 @@ const replacers = exports.replacers = {
|
|
|
109
109
|
FUNC_NAME_LOWERCASE: (s, name) => s.replace(/#{FUNC_NAME_LOWERCASE}/g, friendlyNameToName(name, false)),
|
|
110
110
|
PARAMS_OBJECT: (s, params) => s.replace(/#{PARAMS_OBJECT}/g, params.length ? `{ ${params.map(p => p.name).join(', ')} }` : `{}`),
|
|
111
111
|
OUTPUT_TYPE: (s, type) => s.replace(/#{OUTPUT_TYPE}/g, type),
|
|
112
|
-
TYPED_PARAMS: (s, params) => s.replace(/#{TYPED_PARAMS}/g, params.map(p => `${p.name}${p.isOptional ? '?' : ''}: ${p.type}`).join(', '))
|
|
112
|
+
TYPED_PARAMS: (s, params) => s.replace(/#{TYPED_PARAMS}/g, params.map(p => `${p.name}${p.isOptional ? '?' : ''}: ${p.type} ${p.nullable ? '| null' : ''}`).join(', '))
|
|
113
113
|
};
|
|
114
114
|
class TemplateBuilder {
|
|
115
115
|
static sep = '\n';
|
|
@@ -205,12 +205,14 @@ function getScriptInputs(script, comment = '#') {
|
|
|
205
205
|
const inputs = [];
|
|
206
206
|
for (const match of script.matchAll(regex)) {
|
|
207
207
|
const isOptional = /isOptional\s*:\s*true/.test(match[0]) || /optional\s*:\s*true/.test(match[0]);
|
|
208
|
+
const nullable = /nullable\s*:\s*true/.test(match[0]);
|
|
208
209
|
const type = dgToTsTypeMap[match[1]] || 'any';
|
|
209
210
|
const name = match[2];
|
|
210
211
|
inputs.push({
|
|
211
212
|
type,
|
|
212
213
|
name,
|
|
213
|
-
isOptional
|
|
214
|
+
isOptional,
|
|
215
|
+
nullable
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
218
|
return inputs;
|
package/package.json
CHANGED