@bbn/bbn 1.0.386 → 1.0.388

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.
@@ -1 +1 @@
1
- export default function copy(st: any, dispatch: any): Promise<unknown>;
1
+ export default function copy(st: any, noDispatch: any): Promise<unknown>;
@@ -23,7 +23,7 @@ var fire = function (st) {
23
23
  });
24
24
  document.dispatchEvent(copyEvent);
25
25
  };
26
- export default function copy(st, dispatch) {
26
+ export default function copy(st, noDispatch) {
27
27
  return new Promise(function (resolve) {
28
28
  var _a;
29
29
  if (st) {
@@ -38,7 +38,7 @@ export default function copy(st, dispatch) {
38
38
  var _a;
39
39
  var item = new ClipboardItem((_a = {}, _a[blob.type.toString()] = blob, _a));
40
40
  navigator.clipboard.write([item]).then(function () {
41
- if (dispatch) {
41
+ if (!noDispatch) {
42
42
  fire(st);
43
43
  }
44
44
  resolve(true);
@@ -47,7 +47,7 @@ export default function copy(st, dispatch) {
47
47
  }
48
48
  else {
49
49
  navigator.clipboard.writeText(st);
50
- if (dispatch) {
50
+ if (!noDispatch) {
51
51
  fire(st);
52
52
  }
53
53
  resolve(true);
@@ -61,7 +61,7 @@ export default function copy(st, dispatch) {
61
61
  input.select();
62
62
  document.execCommand('copy');
63
63
  document.body.removeChild(input);
64
- if (dispatch) {
64
+ if (!noDispatch) {
65
65
  fire(st);
66
66
  }
67
67
  resolve(true);
@@ -115,9 +115,21 @@ export default function search(arr, prop, val, operator, startFrom, backward) {
115
115
  var filter;
116
116
  var isFn = false;
117
117
  if (!prop) {
118
- throw new Error(bbn._('The second argument for a search cannot be null or undefined'));
118
+ isFn = true;
119
+ filter = function (a) {
120
+ return compareConditions({ value: a }, filterToConditions({
121
+ logic: 'AND',
122
+ conditions: [
123
+ {
124
+ field: 'value',
125
+ operator: operator || '=',
126
+ value: val,
127
+ },
128
+ ],
129
+ }));
130
+ };
119
131
  }
120
- if (typeof prop === 'string') {
132
+ else if (typeof prop === 'string') {
121
133
  filter = {
122
134
  conditions: [
123
135
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.386",
3
+ "version": "1.0.388",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",