Quickly develop public methods
npm install @vswift/utilsQuickly develop public methods.
```
pnpm add @vswift/utils
`ts
import { findArraryValueFromTreeData } from '@vswift/utils'
const treeData = [
{
key: '1',
name: 'como1',
children: [
{
key: '1-1',
name: 'como11',
children: [
{ key: '1-1-1', name: 'como111' }
]
}
]
}
]
const finds = findArraryValueFromTreeData('1-1-1', treeData, { id: 'key', label: 'name' })
// ['1', '1-1', '1-1-1']
const finds = findArraryValueFromTreeData('1-1-1', treeData, { id: 'key', label: 'name', returnType: 'labels' })
// ['como1', 'como11', 'como111']
`
- findArraryValueFromTreeData - Query all parent elements based on child ID, including itself.findNodeObjectFromTreeData
- - Find the node object where the target ID is located from the tree data.getLabelByValue
- - Get the label name based on value.imageCompress
- - Image quality compression.dataURLToBlob
- - Convert dataURL to blob data, dataURL is generated by canvas.toDataURL.fileDownload
- - File download, suitable for back-end interface to return file stream.countDown
- - Simple countdown.recursiveTreeData
- - Recursive tree data, modify and return the original data object.isArraryObject
- - Judgment object array.isAsyncFunction
- - Determine asynchronous function.xlsxExport` - Xlsx file export.
-