{"name":"unist-builder","version":"3.0.0","description":"unist utility to create a new trees with a nice syntax","license":"MIT","keywords":["unist","unist-util","util","utility","tree","ast","build","builder","create","dsl","hyperscript","sugar","syntax"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/unist-builder.git"},"bugs":{"url":"https://github.com/syntax-tree/unist-builder/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Eugene Sharygin","email":"eush77@gmail.com"},"contributors":[{"name":"Eugene Sharygin","email":"eush77@gmail.com"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/unist":"^2.0.0"},"devDependencies":{"@types/mdast":"^3.0.0","@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","tsd":"^0.14.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.38.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && tsd && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"capitalized-comments":"off","import/no-mutable-exports":"off","no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"b923e609cc4a61d1ae7c1f3aaa082098f42d6308","homepage":"https://github.com/syntax-tree/unist-builder#readme","_id":"unist-builder@3.0.0","_nodeVersion":"15.11.0","_npmVersion":"7.9.0","dist":{"integrity":"sha512-GFxmfEAa0vi9i5sd0R2kcrI9ks0r82NasRq5QHh2ysGngrc6GiqD5CDf1FjPenY4vApmFASBIIlk/jj5J5YbmQ==","shasum":"728baca4767c0e784e1e64bb44b5a5a753021a04","tarball":"http://registry-npm.ywwl.com/unist-builder/download/unist-builder-3.0.0.tgz","fileCount":5,"unpackedSize":11681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgfStpCRA9TVsSAnZWagAAON8P/RaEs4cOBjqMZwLuMRLi\nJoW8X9JIrATN+K2NhXvmCzv3ChUnluQBRBJONacusfrPsiILzUrF9M2rHjj3\nfCRLrPkiO3qVoz3WjtO2e6TcyV6yS0nNLm+j1uk4gElYFs6IA1z2O2xiFWw9\n+BGoMB8PgoXnjRdRYkxpbE3nXGDWfZbZ8NFl6kGbbJOCEidTQ8bG0rukQbFZ\n1xTuql/2AUlLecJXPGswDkwhIWTmp1tH6IsLDZRBg1a9E0ChyzL3dGqFt9d6\nwFcbrxhtuetEs7g6OVMZE/TEBPzhWu89YjHrKj4hSh0tC0kmnwoHtcFXBiXZ\niZ9F6sumIqjuGIY5145wMZ3X+To2izNkP4+7cPYkdSfiyk2T0gfcTtT4A0vq\nO5O2knPHBVqMc8yg+6hiJbg9LjY5rIDNvuGglGPT+/8ir5yk9aX4IuMsa7I/\nOiYGy64yFKvPdRj6vINsOyApm3I7FyCHTB3SznUgAfaM7meePw2u3PLCQ5Fr\ny47nQSyd619soR/rsGws7FNDYwj+teq4dTvlYCbc39XmrlKK7ta+TKnBiM2U\nffkyit364FwcS1GYbGApApJNOk4Y3/tAhU7wvLySkgBQ1RaLzQD77Ea2GDUC\npVBM4ECYAiE1Q5Usa6lMbDY+Qusy7+CUEx8pNDOENmnXS3YaFhY5pjgZGHZQ\nrY3x\r\n=IjWL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAvYWLm408n2CnKld1Xw+Odc5SvW/L3y8fVhDgg78h+zAiEAtdxkG7nhiqQzGVUcB1Ckiiz4TmiOPhYx4lUz1G1TeR8="}],"size":3931,"noattachment":false,"key":"/unist-builder/-/unist-builder-3.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-builder_3.0.0_1618815848578_0.19481555315756527"},"_hasShrinkwrap":false,"readme":"# unist-builder\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[unist][] utility to create trees with ease.\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[, props][, children|value])`](#utype-props-childrenvalue)\n    *   [`ChildrenOrValue`](#childrenorvalue)\n    *   [`Props`](#props)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a hyperscript interface (like `createElement` from React and\n`h` from Vue and such) to help with creating unist trees.\n\n## When should I use this?\n\nYou can use this utility in your project when you generate syntax trees with\ncode.\nIt helps because it replaces most of the repetition otherwise needed in a syntax\ntree with function calls.\n\nYou can instead use [`hastscript`][hastscript] or [`xastscript`][xastscript]\nwhen creating hast (HTML) or xast (XML) nodes.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install unist-builder\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {u} from 'https://esm.sh/unist-builder@4'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {u} from 'https://esm.sh/unist-builder@4?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {u} from 'unist-builder'\n\nconst tree = u('root', [\n  u('subtree', {id: 1}),\n  u('subtree', {id: 2}, [\n    u('node', [u('leaf', 'leaf 1'), u('leaf', 'leaf 2')]),\n    u('leaf', {id: 3}, 'leaf 3'),\n    u('void', {id: 4})\n  ])\n])\n\nconsole.dir(tree, {depth: undefined})\n```\n\n…yields:\n\n```js\n{\n  type: 'root',\n  children: [\n    {type: 'subtree', id: 1},\n    {\n      type: 'subtree',\n      id: 2,\n      children: [\n        {\n          type: 'node',\n          children: [\n            {type: 'leaf', value: 'leaf 1'},\n            {type: 'leaf', value: 'leaf 2'}\n          ]\n        },\n        {type: 'leaf', id: 3, value: 'leaf 3'},\n        {type: 'void', id: 4}\n      ]\n    }\n  ]\n}\n```\n\n## API\n\nThis package exports the identifier [`u`][u].\nThere is no default export.\n\n### `u(type[, props][, children|value])`\n\nBuild a node.\n\n###### Signatures\n\n*   `u(type[, props], children)` — create a parent ([`Parent`][parent])\n*   `u(type[, props], value)` — create a literal ([`Literal`][literal])\n*   `u(type[, props])` — create a void node (neither parent not literal)\n\n###### Parameters\n\n*   `type` (`string`)\n    — node type\n*   `props` (`Record<string, unknown>`)\n    — fields assigned to node\n*   `children` ([`Array<Node>`][node])\n    — children of node\n*   `value` (`*`)\n    — value of `node` (cast to string)\n\n###### Returns\n\nBuilt node ([`Node`][node]).\n\n### `ChildrenOrValue`\n\nList to use as `children` or value to use as `value` (TypeScript type).\n\n###### Type\n\n```ts\ntype ChildrenOrValue = Array<Node> | string\n```\n\n### `Props`\n\nOther fields to add to the node (TypeScript type).\n\n###### Type\n\n```ts\nexport type Props = Record<string, unknown>\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`ChildrenOrValue`][childrenorvalue] and\n[`Props`][props].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `unist-builder@^4`,\ncompatible with Node.js 16.\n\n## Related\n\n*   [`hastscript`](https://github.com/syntax-tree/hastscript)\n    — create [hast][] trees\n*   [`xastscript`](https://github.com/syntax-tree/xastscript)\n    — create [xast][] trees\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © Eugene Sharygin\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/unist-builder/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/unist-builder/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-builder.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/unist-builder\n\n[downloads-badge]: https://img.shields.io/npm/dm/unist-builder.svg\n\n[downloads]: https://www.npmjs.com/package/unist-builder\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-builder\n\n[size]: https://bundlejs.com/?q=unist-builder\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[unist]: https://github.com/syntax-tree/unist\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[parent]: https://github.com/syntax-tree/unist#parent\n\n[literal]: https://github.com/syntax-tree/unist#literal\n\n[hast]: https://github.com/syntax-tree/hast\n\n[xast]: https://github.com/syntax-tree/xast\n\n[hastscript]: https://github.com/syntax-tree/hastscript\n\n[xastscript]: https://github.com/syntax-tree/xastscript\n\n[u]: #utype-props-childrenvalue\n\n[props]: #props\n\n[childrenorvalue]: #childrenorvalue\n","publish_time":1618815848731,"_cnpm_publish_time":1618815848731,"dist-tags":{"latest":"4.0.0"}}