@fang-kang/js-utils,Is an out of the box tool library implemented in pure javascript, mainly used to simplify the development process and improve development efficiency
import { uniqeArrayByKey } from '@fang-kang/js-utils';
const arr = [
{ id: 1, parentid: 0 },
{ id: 2, parentid: 1 },
{ id: 3, parentid: 1 },
{ id: 3, parentid: 1 },
];
uniqeArrayByKey(arr, 'id');
/**
* [
{ id: 1, parentid: 0 },
{ id: 2, parentid: 1 },
{ id: 3, parentid: 1 },
];
*
*/
Refer to documentations for more details.
npm i @fang-kang/js-utils
<script src="https://unpkg.com/@fang-kang/js-utils"></script>
It will be exposed to global as window.JsUtils
MIT License © 2023-PRESENT fang-kang