{"name":"unist-builder","version":"2.0.3","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"}],"types":"types/index.d.ts","dependencies":{},"devDependencies":{"@types/mdast":"^3.0.0","dtslint":"^3.0.0","nyc":"^15.0.0","prettier":"^1.0.0","remark-cli":"^7.0.0","remark-preset-wooorm":"^6.0.0","tape":"^4.0.0","xo":"^0.26.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test-types":"dtslint types","test":"npm run format && npm run test-coverage && npm run test-types"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"38a12a01475391ac118f11330f59ecfeb6c34eed","homepage":"https://github.com/syntax-tree/unist-builder#readme","_id":"unist-builder@2.0.3","_nodeVersion":"13.0.1","_npmVersion":"6.13.7","dist":{"integrity":"sha512-f98yt5pnlMWlzP539tPc4grGMsFaQQlP/vM396b00jngsiINumNmsY8rkXjfoi1c6QaM8nQ3vaGDuoKWbe/1Uw==","shasum":"77648711b5d86af0942f334397a33c5e91516436","tarball":"http://registry-npm.ywwl.com/unist-builder/download/unist-builder-2.0.3.tgz","fileCount":5,"unpackedSize":9267,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSWf0CRA9TVsSAnZWagAAyn0QAKAPJ6F0bPoPF36XSrvD\nZr+ZcFwkSI5qM+ZmVHW8pSUTT1okWkvzdx9sP++gAmD3y1QRHS1Ga4fIyAF8\n9V1R0PvkPcl1XGNOZJWYpWEl9CLdlEgdcNl11C/tfGZiYJCCMACx12RASeuI\nhexZ/1iDYzQ2RCrpDCuPbbZ9XRmrgOUZBAbrl5hdjI/y2ft97Lhs9Lxx7MTa\nKI1p/upgymxD7LIWPFY/vCtmbSk1fyrqCfManb+6LYSrkJdW0tjcdSUSLrxF\nCWrmQR2tdsX5RhL29QOpy49qjxLAL6nBvO60CgRLbf1m/uv+aHOVDTEfH9Gd\nA/7mQ690gKrzCWQkdOgEJqNX/d6NkO18JthaV+k1j1eDZpIWCYEhP4+d4Iv7\n2hO76OgwsPUyVvZdwInxE4h75yv4wKVoL8ELZYgYONj5bUQ5VXrhh0Jf7bsb\niFI0Pnjb4PlS0vfpL7DWQRcfxZKbGit+ce2hP5WqBmdAcohiWrSjJvrYLRMc\niNmIxAoPM/B+cXEv7f+s28VNx/iftEURuaGbo4f7/ZTASbcbAbwhJcUJUX6g\n1jqtw98GsmFrQJdxcuAO4xbD/qJm2Yjw0Z3Ev2BYe3VSZ2vNAz9JHYuPnZFW\nsoatRs49TwahYp0wDnaGNkcUl5lvnaG8OTja39nw9tyf6PALo+syUeUDMbJx\n+JJY\r\n=dPM1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDe0Oj7MyyrwYP1tj1rskWhVUUR0It1i1FrJLKslBj5LgIhAPaq9rhAjpQQLgROA3aPZ8Jjmvr7923M6jObNE90jH4F"}],"size":3543,"noattachment":false,"key":"/unist-builder/-/unist-builder-2.0.3.tgz"},"maintainers":[{"email":"keith@mcknig.ht","name":"kmck"},{"email":"tituswormer@gmail.com","name":"wooorm"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unist-builder_2.0.3_1581869044074_0.10902945543770537"},"_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":1581869044252,"_cnpm_publish_time":1581869044252,"dist-tags":{"latest":"4.0.0"}}