mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-06-01 02:29:20 +02:00
Remove dependency on lodash
This commit is contained in:
parent
7c13a5d2bc
commit
c34a02589b
@ -53,7 +53,6 @@
|
|||||||
"@size-limit/preset-small-lib": "^8.1.0",
|
"@size-limit/preset-small-lib": "^8.1.0",
|
||||||
"@tsconfig/create-react-app": "^1.0.3",
|
"@tsconfig/create-react-app": "^1.0.3",
|
||||||
"@tsconfig/recommended": "^1.0.1",
|
"@tsconfig/recommended": "^1.0.1",
|
||||||
"@types/lodash.uniqby": "^4.7.7",
|
|
||||||
"@types/react": "^18.0.26",
|
"@types/react": "^18.0.26",
|
||||||
"@types/react-dom": "^18.0.9",
|
"@types/react-dom": "^18.0.9",
|
||||||
"dts-cli": "^1.6.0",
|
"dts-cli": "^1.6.0",
|
||||||
@ -65,6 +64,6 @@
|
|||||||
"typescript": "^4.9.4"
|
"typescript": "^4.9.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash.uniqby": "^4.7.0"
|
"@nostrgg/client": "^0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import { uniqBy } from 'lodash';
|
import { uniqBy } from './utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
OnConnectFunc,
|
OnConnectFunc,
|
||||||
|
11
src/utils.ts
Normal file
11
src/utils.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export const uniqBy = <T>(arr: T[], key: keyof T): T[] => {
|
||||||
|
return Object.values(
|
||||||
|
arr.reduce(
|
||||||
|
(map, item) => ({
|
||||||
|
...map,
|
||||||
|
[`${item[key]}`]: item,
|
||||||
|
}),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user