@structure-codes/utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

This repo contains the tree parsing functions which are used in multiple repos throughout the project.

treeStringToJson

This parses a tree output into JSON for further use. Sample JSON format is below. Node names are stored in the keys and children are stored as an object in the value.

[
  {
    "name": "AboutView",
    "children": [],
  },
  {
    "name": "App",
    "children": [
      {
        "name": "Header",
        "children": [
          {
            "name": "index.tsx",
            "children": [],
          }
        ]
      },
      {
        "name": "index.tsx",
        "children": [],
      },
      {
        "name": "style.ts",
        "children": [],
      }
    ]
  }
]

treeJsonToString

This is used to convert the JSON back to a formatted string for logging or storing in a file.

├── AboutView
└── App
  ├── Header
  │  └── index.tsx
  ├── index.tsx
  └── style.ts

/@structure-codes/utils/

    Package Sidebar

    Install

    npm i @structure-codes/utils

    Weekly Downloads

    8

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    11.7 kB

    Total Files

    19

    Last publish

    Collaborators

    • hacksore
    • alex-oser