@cabloy/utils 2.0.2 → 2.0.4
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.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -226,6 +226,8 @@ const celEnvBase = new Environment({
|
|
|
226
226
|
enableOptionalTypes: true,
|
|
227
227
|
homogeneousAggregateLiterals: false
|
|
228
228
|
});
|
|
229
|
+
|
|
230
|
+
// array
|
|
229
231
|
const params = [];
|
|
230
232
|
for (let i = 0; i < 10; i++) {
|
|
231
233
|
params.push('dyn');
|
|
@@ -237,14 +239,28 @@ celEnvBase.registerFunction('join(list):string', list => {
|
|
|
237
239
|
celEnvBase.registerFunction('join(list,string):string', (list, sep) => {
|
|
238
240
|
return _join(list, sep);
|
|
239
241
|
});
|
|
242
|
+
|
|
243
|
+
// get
|
|
240
244
|
celEnvBase.registerFunction('get(map,string):dyn', (obj, name) => {
|
|
241
245
|
return getProperty(obj, name);
|
|
242
246
|
});
|
|
243
247
|
celEnvBase.registerFunction('get(map,string,string):dyn', (obj, name, sep) => {
|
|
244
248
|
return getProperty(obj, name, sep);
|
|
245
249
|
});
|
|
250
|
+
|
|
251
|
+
// string
|
|
252
|
+
celEnvBase.registerFunction('string(null):string', value => {
|
|
253
|
+
return String(value);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// operator: +
|
|
246
257
|
celEnvBase.registerOperator('string + int', (str, n) => str + String(n));
|
|
247
258
|
celEnvBase.registerOperator('int + string', (n, str) => String(n) + str);
|
|
259
|
+
|
|
260
|
+
// operator: ==
|
|
261
|
+
celEnvBase.registerOperator('string == null', (str, n) => str === n);
|
|
262
|
+
celEnvBase.registerOperator('int == null', (num, n) => num === n);
|
|
263
|
+
celEnvBase.registerOperator('bool == null', (b, n) => b === n);
|
|
248
264
|
function _concat(...args) {
|
|
249
265
|
return [].concat(...args);
|
|
250
266
|
}
|