@openmrs/esm-expression-evaluator 8.0.1-pre.3439 → 8.0.1-pre.3457
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/.turbo/turbo-build.log +1 -1
- package/dist/evaluator.js +12 -0
- package/package.json +1 -1
- package/src/evaluator.ts +14 -0
package/.turbo/turbo-build.log
CHANGED
package/dist/evaluator.js
CHANGED
|
@@ -211,6 +211,12 @@ export { jsep };
|
|
|
211
211
|
if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {
|
|
212
212
|
throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;
|
|
213
213
|
}
|
|
214
|
+
if (typeof expression === 'string' && expression.trim().length === 0) {
|
|
215
|
+
throw {
|
|
216
|
+
type: 'Empty expression',
|
|
217
|
+
message: 'Expression cannot be an empty string'
|
|
218
|
+
};
|
|
219
|
+
}
|
|
214
220
|
if (typeof variables === 'undefined' || variables === null) {
|
|
215
221
|
variables = {};
|
|
216
222
|
}
|
|
@@ -241,6 +247,12 @@ export { jsep };
|
|
|
241
247
|
if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {
|
|
242
248
|
return Promise.reject(`Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`);
|
|
243
249
|
}
|
|
250
|
+
if (typeof expression === 'string' && expression.trim().length === 0) {
|
|
251
|
+
throw {
|
|
252
|
+
type: 'Empty expression',
|
|
253
|
+
message: 'Expression cannot be an empty string'
|
|
254
|
+
};
|
|
255
|
+
}
|
|
244
256
|
if (typeof variables === 'undefined' || variables === null) {
|
|
245
257
|
variables = {};
|
|
246
258
|
}
|
package/package.json
CHANGED
package/src/evaluator.ts
CHANGED
|
@@ -242,6 +242,13 @@ export function evaluateAsType<T>(
|
|
|
242
242
|
throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
if (typeof expression === 'string' && expression.trim().length === 0) {
|
|
246
|
+
throw {
|
|
247
|
+
type: 'Empty expression',
|
|
248
|
+
message: 'Expression cannot be an empty string',
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
245
252
|
if (typeof variables === 'undefined' || variables === null) {
|
|
246
253
|
variables = {};
|
|
247
254
|
}
|
|
@@ -286,6 +293,13 @@ export async function evaluateAsTypeAsync<T>(
|
|
|
286
293
|
);
|
|
287
294
|
}
|
|
288
295
|
|
|
296
|
+
if (typeof expression === 'string' && expression.trim().length === 0) {
|
|
297
|
+
throw {
|
|
298
|
+
type: 'Empty expression',
|
|
299
|
+
message: 'Expression cannot be an empty string',
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
289
303
|
if (typeof variables === 'undefined' || variables === null) {
|
|
290
304
|
variables = {};
|
|
291
305
|
}
|