@bbn/bbn 1.0.43 → 1.0.45

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/bundle.js CHANGED
@@ -934,6 +934,7 @@
934
934
  exports.filter = void 0;
935
935
  const filter = function (arr, prop, val = null, operator = '=') {
936
936
  if (!(0, isArray_4.isArray)(arr)) {
937
+ bbn.fn.log("NOT ARRAY", arr);
937
938
  throw new Error('Error in filter: The first argument must be an array');
938
939
  }
939
940
  let cfg = {};
@@ -943,14 +944,14 @@
943
944
  return arr;
944
945
  }
945
946
  if (arr.length) {
946
- if (typeof (prop) === 'object') {
947
+ if (typeof prop === 'object') {
947
948
  operator = val;
948
949
  cfg = prop;
949
950
  }
950
951
  else if (typeof prop === 'string') {
951
952
  cfg[prop] = val;
952
953
  }
953
- else {
954
+ else if (!isFn) {
954
955
  throw new Error('Search function error: The prop argument should be a string or an object');
955
956
  }
956
957
  if (isFn) {
package/dist/fn/filter.js CHANGED
@@ -5,6 +5,7 @@ import { filterToConditions } from './filterToConditions';
5
5
  import { compareConditions } from './compareConditions';
6
6
  const filter = function (arr, prop, val = null, operator = '=') {
7
7
  if (!isArray(arr)) {
8
+ bbn.fn.log("NOT ARRAY", arr);
8
9
  throw new Error('Error in filter: The first argument must be an array');
9
10
  }
10
11
  let cfg = {};
@@ -14,14 +15,14 @@ const filter = function (arr, prop, val = null, operator = '=') {
14
15
  return arr;
15
16
  }
16
17
  if (arr.length) {
17
- if (typeof (prop) === 'object') {
18
+ if (typeof prop === 'object') {
18
19
  operator = val;
19
20
  cfg = prop;
20
21
  }
21
22
  else if (typeof prop === 'string') {
22
23
  cfg[prop] = val;
23
24
  }
24
- else {
25
+ else if (!isFn) {
25
26
  throw new Error('Search function error: The prop argument should be a string or an object');
26
27
  }
27
28
  if (isFn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",