Nervously Proposing Marriage

    @ghom/handler
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    File handler

    Example for table handler

    import { Handler } from "@ghom/handler"
    
    export const tableHandler = new Handler(path.join(process.cwd(), "dist", "tables"))
    
    tableHandler.once("finish", async (pathList) => {
      const tables = await Promise.all(
        pathList.map(async (filepath) => {
          const file = await import("file://" + filepath)
          if (filepath.endsWith(".native.js")) file.default.options.native = true
          file.default.filepath = filepath
          return file.default
        })
      )
    
      return Promise.all(
        tables
          .sort((a, b) => {
            return (b.options.priority ?? 0) - (a.options.priority ?? 0)
          })
          .map((table) => table.make())
      )
    })

    Keywords

    none

    Install

    npm i @ghom/handler

    DownloadsWeekly Downloads

    5

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    4.74 kB

    Total Files

    13

    Last publish

    Collaborators

    • ghom