{"id":15389710,"url":"https://github.com/joshgillies/node-matrix-assets","last_synced_at":"2025-08-01T10:15:22.571Z","repository":{"id":140004069,"uuid":"42994464","full_name":"joshgillies/node-matrix-assets","owner":"joshgillies","description":"A DSL for creating Squiz Matrix asset trees in JavaScript!","archived":false,"fork":false,"pushed_at":"2016-03-10T23:49:10.000Z","size":26,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T20:34:59.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshgillies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2015-09-23T10:28:22.000Z","updated_at":"2016-01-17T12:08:16.000Z","dependencies_parsed_at":"2023-05-01T03:46:13.350Z","dependency_job_id":null,"html_url":"https://github.com/joshgillies/node-matrix-assets","commit_stats":{"total_commits":53,"total_committers":1,"mean_commits":53.0,"dds":0.0,"last_synced_commit":"2b8eab937afdb5324da8c9f1eb275c7ebad6f75a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/joshgillies/node-matrix-assets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgillies%2Fnode-matrix-assets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgillies%2Fnode-matrix-assets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgillies%2Fnode-matrix-assets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgillies%2Fnode-matrix-assets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshgillies","download_url":"https://codeload.github.com/joshgillies/node-matrix-assets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgillies%2Fnode-matrix-assets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268206050,"owners_count":24213000,"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-08-01T02:00:08.611Z","response_time":67,"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":[],"created_at":"2024-10-01T15:03:04.635Z","updated_at":"2025-08-01T10:15:22.490Z","avatar_url":"https://github.com/joshgillies.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-matrix-assets\n\nA DSL for creating Squiz Matrix asset trees in JavaScript!\n\nInspiration for this module is weighted heavily around the excellent work by [Dominic Tarr] with [hyperscript].\n\n[![Build Status](https://travis-ci.org/joshgillies/node-matrix-assets.svg)](https://travis-ci.org/joshgillies/node-matrix-assets)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n## Install\n\n`npm install node-matrix-assets`\n\n## Example\n\n```js\nvar asset = require('node-matrix-assets')\nvar getAssetById = asset.getAssetById\n\nvar tree = asset('folder', { name: 'Sites', links: 'type_2' },\n  asset('site', { id: 'site', name: 'My Site' },\n    asset('page_standard', { name: 'Home', links: { index: getAssetById('site') } },\n      asset('bodycopy', { links: 'type_2', dependant: '1', exclusive: '1' },\n        asset('bodycopy_div', { links: 'type_2', dependant: '1' },\n          asset('content_type_wysiwyg', { links: 'type_2', dependant: '1', exclusive: '1' })\n        )\n      )\n    )\n  )\n)\n```\n\n## API\n\n### asset\n\n`node-matrix-assets` provides an API for generating structured asset trees via `require('node-matrix-assets')`.\n\n#### asset(type, properties={}, children...)\n\nThe `type` argument is _required_ and accepts a string representing a valid Squiz Matrix asset type.\n\nThe `properties` argument accepts an object used to configure the returned asset definition.\n\nWith the exception of a few optional special cases for the `properties` objects\nkeys/values will change depending on the type of asset you're creating.\n\n#### properties.id\n\nAssigns a unique identifier to an asset. Typically used in conjunction with [asset.getAssetById].\n\n#### properties.links\n\nDefault: `'type_1'`. Either a string representing a valid link type (eg. `'type_2'`),\nan Array containing String or Object key/value pairs `['type_2', { notice: 'value' }]`,\nor an Object of key/value pairs `{ type_2: true, notice: 'value' }`.\n\nDefining `children` is accomplished through one of the following:\n\n  * As an array containing assets `asset('type_code', [asset(...), asset(...), asset(...)])`,\n  * or as arguments `asset('type_code', asset(...), asset(...), asset(...))`.\n\n#### asset.getAssetById(id)\n[asset.getAssetById]: #assetgetassetbyidid\n\nThe `id` argument accepts a string representing a previously defined asset `property.id`:\n\n```js\nvar myThing = asset('type_code', { id: 'myThing' })\n\nasset.getAssetById('myThing')\n```\n\nor a `key` representing a valid asset key:\n\n```js\nvar myThing = asset('type_code')\n\nasset.getAssetById(myThing.key)\n```\n\n## License\n\nMIT\n\n[Dominic Tarr]: https://github.com/dominictarr\n[hyperscript]: https://github.com/dominictarr/hyperscript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshgillies%2Fnode-matrix-assets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshgillies%2Fnode-matrix-assets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshgillies%2Fnode-matrix-assets/lists"}