1.1.2 • Published 1 year ago

@vswift/utils v1.1.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@vswift/utils

Quickly develop public methods.

Install

pnpm add @vswift/utils

Usage

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']

Preview

  • 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.
1.1.2

1 year ago

1.1.1-4

1 year ago

1.1.1-3

1 year ago

1.1.1

1 year ago

1.1.1-2

1 year ago

1.1.1-1

1 year ago

1.1.1-0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago