Skip to content

Commit

Permalink
chore: add the readme doc
Browse files Browse the repository at this point in the history
  • Loading branch information
karlsbeard committed Aug 26, 2024
1 parent 4288539 commit c71fca3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,18 @@ yarn install ts-tree-tools
// commonjs
const TTs = require('ts-tree-tools')

//
// es6
import TTs from 'ts-tree-tools'
```

### Usage

#### API

| Methods | Description |
| ---- | ---- |
| toTree | convert the list structure to tree structure |
| toList | convert the tree structure to list structure |
| findNodeById | find the first node by id in the tree |
| findNodeByFunc | find the first node by call function in the tree |
| findAllNode | find the all nodes by call function in the tree |
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import antfu from '@antfu/eslint-config'

export default antfu({
ignores: ['**.js', 'dist', 'node_modules'],
ignores: ['**.js', 'dist', 'node_modules', 'README.md'],
javascript: false,
})
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getConfig(config: Partial<Config>): Config {

export const TTs = {
/**
*
* @description convert the list structure to tree structure
* @param list the list structure
* @param config the tree config which you want to convert
* @returns return the tree structure
Expand All @@ -48,7 +48,7 @@ export const TTs = {
return result
},
/**
*
* @description convert the tree structure to list structure
* @param tree the tree structure
* @param config the list config which you want to convert
* @returns return the list structure
Expand Down

0 comments on commit c71fca3

Please sign in to comment.