@cabloy/utils 1.0.34 → 1.0.37

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/cel.js CHANGED
@@ -56,7 +56,12 @@ export function parse(expression) {
56
56
  function _prepareFunctions(functions) {
57
57
  return Object.assign({
58
58
  concat: (...args) => {
59
- return args.reduce((accumulator, current) => `${accumulator}${current}`, '');
59
+ return [].concat(...args);
60
+ },
61
+ join: (arr, sep) => {
62
+ if (!arr)
63
+ return '';
64
+ return arr.join(sep);
60
65
  },
61
66
  get: (obj, name, sep) => {
62
67
  return getProperty(obj, name, sep);
package/dist/check.d.ts CHANGED
@@ -12,6 +12,8 @@ export declare const isNumber: (val: any) => val is number;
12
12
  export declare const isConstructor: (val: any) => boolean;
13
13
  export declare const isEmpty: (array: any) => boolean;
14
14
  export declare const isSymbol: (val: any) => val is symbol;
15
+ export declare function isClass(fn: any): boolean;
16
+ export declare function isClassStrict(fn: any): boolean;
15
17
  export declare function isPromise(obj: any): obj is Promise<any>;
16
18
  export declare function isNilOrEmptyString(str?: string | undefined | null): str is null | undefined | '';
17
19
  export declare function checkMeta(meta?: {}, data?: {}): boolean;
package/dist/check.js CHANGED
@@ -36,6 +36,12 @@ export const isNumber = (val) => typeof val === 'number';
36
36
  export const isConstructor = (val) => val === 'constructor';
37
37
  export const isEmpty = (array) => !(array && array.length > 0);
38
38
  export const isSymbol = (val) => typeof val === 'symbol';
39
+ export function isClass(fn) {
40
+ return typeof fn === 'function' && !!fn.name && fn.prototype?.constructor === fn;
41
+ }
42
+ export function isClassStrict(fn) {
43
+ return typeof fn === 'function' && /^class(?:\s|\{)/.test(fn.toString());
44
+ }
39
45
  export function isPromise(obj) {
40
46
  return obj instanceof Promise || (obj && typeof obj.then === 'function');
41
47
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cabloy/utils",
3
3
  "type": "module",
4
- "version": "1.0.34",
4
+ "version": "1.0.37",
5
5
  "description": "cabloy utils",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@cabloy/cel-js": "^0.7.3",
28
+ "@cabloy/cel-js": "^0.7.4",
29
29
  "@cabloy/module-info": "^1.3.24",
30
30
  "@cabloy/word-utils": "^2.0.1",
31
31
  "chevrotain": "^11.0.3",