@cabloy/utils 2.0.6 → 2.0.8
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/celjs/utils.d.ts +1 -1
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/celjs/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function regexp(str: string): string;
|
|
2
|
-
export declare function cel(str: string):
|
|
2
|
+
export declare function cel(str: string): any;
|
|
3
3
|
export declare function raw(str: string): string;
|
|
4
4
|
export declare function createFunction(expression: string, scopeKeys?: string[]): Function;
|
|
5
5
|
export declare function evaluateSimple(expression: string, scope?: object): any;
|
package/dist/index.js
CHANGED
|
@@ -269,6 +269,8 @@ celEnvBase.registerFunction('string(null):string', value => {
|
|
|
269
269
|
// operator: +
|
|
270
270
|
celEnvBase.registerOperator('string + int', (str, n) => str + String(n));
|
|
271
271
|
celEnvBase.registerOperator('int + string', (n, str) => String(n) + str);
|
|
272
|
+
celEnvBase.registerOperator('string + double', (str, n) => str + String(n));
|
|
273
|
+
celEnvBase.registerOperator('double + string', (n, str) => String(n) + str);
|
|
272
274
|
celEnvBase.registerOperator('string + null', (str, _n) => str);
|
|
273
275
|
celEnvBase.registerOperator('null + string', (_n, str) => str);
|
|
274
276
|
|
|
@@ -279,10 +281,10 @@ celEnvBase.registerOperator('bool == null', (b, n) => b === n);
|
|
|
279
281
|
|
|
280
282
|
// get
|
|
281
283
|
celEnvBase.registerFunction('get(map,string):dyn', (obj, name) => {
|
|
282
|
-
return getProperty(obj, name);
|
|
284
|
+
return getProperty(obj, name) ?? null;
|
|
283
285
|
});
|
|
284
286
|
celEnvBase.registerFunction('get(map,string,string):dyn', (obj, name, sep) => {
|
|
285
|
-
return getProperty(obj, name, sep);
|
|
287
|
+
return getProperty(obj, name, sep) ?? null;
|
|
286
288
|
});
|
|
287
289
|
celEnvBase.registerFunction('exists(null,string):bool', (obj, name) => {
|
|
288
290
|
return hasProperty(obj, name);
|
|
@@ -305,6 +307,8 @@ const StringPrefixRaw = 'raw://';
|
|
|
305
307
|
function regexp(str) {
|
|
306
308
|
return `${StringPrefixRegexp}${str}`;
|
|
307
309
|
}
|
|
310
|
+
|
|
311
|
+
// should return any
|
|
308
312
|
function cel(str) {
|
|
309
313
|
return `${StringPrefixCel}${str}`;
|
|
310
314
|
}
|