@bpd-library/utilities 1.3.6-beta.0 → 1.3.7-beta.0
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePartition: <T>(data: T[], filter: (item: T) => boolean) => [T[], T[]];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const usePartition = (data, filter) => {
|
|
2
|
+
const result = data.reduce((acc, item) => {
|
|
3
|
+
if (filter(item))
|
|
4
|
+
acc[0].push(item);
|
|
5
|
+
else
|
|
6
|
+
acc[1].push(item);
|
|
7
|
+
return acc;
|
|
8
|
+
}, [[], []]);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=use-partition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-partition.js","sourceRoot":"","sources":["../../src/hooks/use-partition.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,IAAS,EAAE,MAA4B,EAAc,EAAE;IACnF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CACtB,CAAC,GAAe,EAAE,IAAO,EAAE,EAAE;QACzB,IAAI,MAAM,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;YAC/B,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC;IACf,CAAC,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,CACX,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC","sourcesContent":["export const usePartition = <T>(data: T[], filter: (item: T) => boolean): [T[], T[]] => {\n const result = data.reduce(\n (acc: [T[], T[]], item: T) => {\n if (filter(item)) acc[0].push(item);\n else acc[1].push(item);\n return acc;\n },\n [[], []],\n );\n\n return result;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpd-library/utilities",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7-beta.0",
|
|
4
4
|
"description": "Description",
|
|
5
5
|
"url": "https://github.com/{repo name}",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "be624dbf3f57c7d895a7647ef2d0cb5d7d5307b5",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@atomify/core": "2.4.1",
|
|
51
51
|
"@atomify/hooks": "1.1.11",
|
|
52
52
|
"@atomify/jsx": "1.7.1",
|
|
53
53
|
"@atomify/kit": "1.1.11",
|
|
54
|
-
"@bpd-library/types": "^1.3.
|
|
54
|
+
"@bpd-library/types": "^1.3.7-beta.0",
|
|
55
55
|
"qs": "^6.9.4",
|
|
56
56
|
"query-string": "5"
|
|
57
57
|
}
|