{"id":13339488,"url":"https://github.com/flex-development/esast-util-builder","last_synced_at":"2025-09-01T05:32:16.439Z","repository":{"id":241744737,"uuid":"807556304","full_name":"flex-development/esast-util-builder","owner":"flex-development","description":"esast utility to build trees","archived":false,"fork":false,"pushed_at":"2025-02-19T22:22:48.000Z","size":2473,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T06:35:54.310Z","etag":null,"topics":["ast","builder","esast","syntax","syntax-tree","tree","unist","unist-util","util"],"latest_commit_sha":null,"homepage":"https://github.com/flex-development/esast-util-builder","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flex-development.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["flex-development"]}},"created_at":"2024-05-29T10:26:01.000Z","updated_at":"2024-11-21T23:06:41.000Z","dependencies_parsed_at":"2024-08-23T23:46:51.237Z","dependency_job_id":"bb32028a-ae3f-4fe4-a7b3-12c42951ce30","html_url":"https://github.com/flex-development/esast-util-builder","commit_stats":null,"previous_names":["flex-development/esast-util-builder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flex-development/esast-util-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fesast-util-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fesast-util-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fesast-util-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fesast-util-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flex-development","download_url":"https://codeload.github.com/flex-development/esast-util-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fesast-util-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","builder","esast","syntax","syntax-tree","tree","unist","unist-util","util"],"created_at":"2024-07-29T19:20:04.019Z","updated_at":"2025-09-01T05:32:16.385Z","avatar_url":"https://github.com/flex-development.png","language":"JavaScript","funding_links":["https://github.com/sponsors/flex-development"],"categories":[],"sub_categories":[],"readme":"# esast-util-builder\n\n[![github release](https://img.shields.io/github/v/release/flex-development/esast-util-builder.svg?include_prereleases\u0026sort=semver)](https://github.com/flex-development/esast-util-builder/releases/latest)\n[![npm](https://img.shields.io/npm/v/@flex-development/esast-util-builder.svg)](https://npmjs.com/package/@flex-development/esast-util-builder)\n[![codecov](https://codecov.io/gh/flex-development/esast-util-builder/graph/badge.svg?token=mt91xOxzNo)](https://codecov.io/gh/flex-development/esast-util-builder)\n[![module type: esm](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![license](https://img.shields.io/github/license/flex-development/esast-util-builder.svg)](LICENSE.md)\n[![conventional commits](https://img.shields.io/badge/-conventional%20commits-fe5196?logo=conventional-commits\u0026logoColor=ffffff)](https://conventionalcommits.org/)\n[![typescript](https://img.shields.io/badge/-typescript-3178c6?logo=typescript\u0026logoColor=ffffff)](https://typescriptlang.org/)\n[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat\u0026logo=vitest\u0026logoColor=ffffff)](https://vitest.dev/)\n[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat\u0026logo=yarn\u0026logoColor=ffffff)](https://yarnpkg.com/)\n\n[esast][esast] utility to build trees\n\n## Contents\n\n- [What is this?](#what-is-this)\n- [When should I use this?](#when-should-i-use-this)\n- [Install](#install)\n- [Use](#use)\n- [API](#api)\n  - [`u(type[, builder])`](#utype-builder)\n  - [`AnyNode`](#anynode)\n  - [`Builder\u003c[T]\u003e`](#buildert)\n  - [`Match\u003cN, Check\u003e`](#matchn-check)\n  - [`Type\u003c[T]\u003e`](#typet)\n- [Types](#types)\n- [Related](#related)\n- [Contribute](#contribute)\n\n## What is this?\n\nThis is a tiny but useful utility for building [esast][esast] nodes.\n\n## When should I use this?\n\nUse this package when you need to create [esast][esast] nodes.\n\nIf you need to build nodes for other ASTs, use [`unist-util-builder`][unist-util-builder] instead.\n\n## Install\n\nThis package is [ESM only][esm].\n\nIn Node.js (version 18+) with [yarn][yarn]:\n\n```sh\nyarn add @flex-development/esast-util-builder\n```\n\n\u003cblockquote\u003e\n  \u003csmall\u003e\n    See \u003ca href='https://yarnpkg.com/protocol/git'\u003eGit - Protocols | Yarn\u003c/a\u003e\n    \u0026nbsp;for details regarding installing from Git.\n  \u003c/small\u003e\n\u003c/blockquote\u003e\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```ts\nimport { u } from 'https://esm.sh/@flex-development/esast-util-builder'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { u } from 'https://esm.sh/@flex-development/esast-util-builder'\n\u003c/script\u003e\n```\n\n## Use\n\n**TODO**: use\n\n## API\n\nThis package exports the identifier [`u`](#utype-builder). There is no default export.\n\n### `u(type[, builder])`\n\nBuild an [esast][esast] node using a child node array, properties object, or value.\n\nIf `builder` is omitted, a void node (a node with only a `type` field) will be created.\n\n\u003e 👉 Undefined literals must be created using a properties object, rather than a value. Passing `undefined` will create\n\u003e a void node.\n\n#### Type Parameters\n\n- `T` (`Type\u003cAnyNode\u003e`) - esast node type\n\n##### Parameters\n\n- `type` (`T`) - esast node type\n- `builder` ([`Builder\u003cT\u003e`](#buildert), optional) - node children, properties, or value\n\n##### Returns\n\n`Match\u003cAnyNode, T\u003e` new esast node.\n\n### `AnyNode`\n\nUnion of nodes that can occur in esast (TypeScript type).\n\n\u003e 👉 This type is exported from [`@flex-development/esast`][esast].\\\n\u003e See [`AnyNode`][anynode] for more details.\n\n### `Builder\u003c[T]\u003e`\n\nConstruct a union of esast node builders (TypeScript type).\n\n**See also**: [`ub.AnyBuilder`][anybuilder], [`ub.Builder`][buildert]\n\n\u003c!-- dprint-ignore-start --\u003e\n```ts\ntype Builder\u003cT extends Type = Type\u003cAnyNode\u003e\u003e = T extends Type\u003cAnyNode\u003e\n  ? ub.Builder\u003cMatch\u003cAnyNode, T\u003e\u003e extends infer B extends ub.AnyBuilder\n    ? B extends ub.BuilderValue\n      ? B\n      : B extends readonly Node[]\n        ? B[number][]\n        : {\n            [K in keyof B]: K extends 'children'\n              ? B[K] extends infer U extends readonly Node[]\n                ? U[number][]\n                : never\n              : B[K]\n          }\n    : never\n  : never\n```\n\u003c!-- dprint-ignore-end --\u003e\n\n### `Match\u003cN, Check\u003e`\n\nCheck if node `N` passes a test. (TypeScript type).\n\n\u003e 👉 This type is exported from [`@flex-development/unist-util-types`][unist-util-types].\\\n\u003e See [`Match\u003cN, Check\u003e`][matchn-check] for more details.\n\n### `Type\u003c[T]\u003e`\n\nExtract [*type*][type] from node `T` (TypeScript type).\n\n\u003e 👉 This type is exported from [`@flex-development/unist-util-types`][unist-util-types].\\\n\u003e See [`Type\u003c[T]\u003e`][typet] for more details.\n\n## Types\n\nThis package is fully typed with [TypeScript][typescript].\n\n## Related\n\n- [`esast`][esast] \u0026mdash; ecmascript abstract syntax tree format\n\n## Contribute\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md).\n\nThis project has a [code of conduct](CODE_OF_CONDUCT.md). By interacting with this repository, organization, or\ncommunity you agree to abide by its terms.\n\n[anybuilder]: https://github.com/flex-development/unist-util-builder#anybuilder\n[anynode]: https://github.com/flex-development/esast/blob/main/src/types/any-node.ts\n[buildert]: https://github.com/flex-development/unist-util-builder#buildert\n[esast]: https://github.com/flex-development/esast\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n[esmsh]: https://esm.sh/\n[matchn-check]: https://github.com/flex-development/unist-util-types#typet\n[type]: https://github.com/syntax-tree/unist#type\n[typescript]: https://www.typescriptlang.org\n[typet]: https://github.com/flex-development/unist-util-types#typet\n[unist-util-builder]: https://github.com/flex-development/unist-util-builder\n[unist-util-types]: https://github.com/flex-development/unist-util-types\n[yarn]: https://yarnpkg.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fesast-util-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflex-development%2Fesast-util-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fesast-util-builder/lists"}