We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a25cb2 commit 4735ee0Copy full SHA for 4735ee0
src/universal/utils/lodash/pickByIndexOf.js
@@ -1,11 +1,26 @@
1
+const isSomeKey = (item, cookiesKey) => {
2
+ if (typeof item === "string") {
3
+ return cookiesKey.indexOf(item) !== -1;
4
+ }
5
+
6
+ if (typeof item?.value === "string") {
7
+ if (item?.exact) {
8
+ return cookiesKey === item.value;
9
10
+ return cookiesKey.indexOf(item?.value) !== -1;
11
12
13
+ return false;
14
+};
15
16
function pickByIndexOf(object, keys) {
17
if (object == null) {
18
return {};
19
}
20
21
const result = Object.keys(object).reduce((result, cookiesKey) => {
22
if (object[cookiesKey]) {
- if (keys.some(item => cookiesKey.indexOf(item) !== -1)) {
23
+ if (keys.some(item => isSomeKey(item, cookiesKey))) {
24
return {
25
...result,
26
[cookiesKey]: object[cookiesKey]
0 commit comments