{"id":17242816,"url":"https://github.com/imcuttle/symbolic-link","last_synced_at":"2025-03-26T03:44:20.725Z","repository":{"id":45113132,"uuid":"185823310","full_name":"imcuttle/symbolic-link","owner":"imcuttle","description":"Make the property links to other target like the symbolic link.","archived":false,"fork":false,"pushed_at":"2022-01-07T14:21:23.000Z","size":119,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T02:34:05.918Z","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/imcuttle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-09T15:14:49.000Z","updated_at":"2019-05-09T15:18:49.000Z","dependencies_parsed_at":"2022-08-31T05:11:02.523Z","dependency_job_id":null,"html_url":"https://github.com/imcuttle/symbolic-link","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fsymbolic-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fsymbolic-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fsymbolic-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Fsymbolic-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/symbolic-link/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245585797,"owners_count":20639671,"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","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-15T06:14:08.970Z","updated_at":"2025-03-26T03:44:20.705Z","avatar_url":"https://github.com/imcuttle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# symbolic-link\n\n[![Build status](https://img.shields.io/travis/imcuttle/symbolic-link/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/symbolic-link)\n[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/symbolic-link.svg?style=flat-square)](https://codecov.io/github/imcuttle/symbolic-link?branch=master)\n[![NPM version](https://img.shields.io/npm/v/symbolic-link.svg?style=flat-square)](https://www.npmjs.com/package/symbolic-link)\n[![NPM Downloads](https://img.shields.io/npm/dm/symbolic-link.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/symbolic-link)\n[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)\n\n\u003e Make the property links to other target like the symbolic link and it works well in [mobx](https://github.com/mobxjs/mobx).\n\n## Installation\n\n```bash\nnpm install symbolic-link\n# or use yarn\nyarn add symbolic-link\n```\n\n## Usage\n\n### Simple Case\n\n```javascript\nconst { symbolicLink } = require('symbolic-link')\n\nconst obj = {}\nconst dest = { name: 'foo' }\nconst rm = symbolicLink(obj, 'name', dest, 'foo')\n\nobj.name === 'foo'\nobj.name = 'bar'\ndest.name = 'bar'\n\nrm()\n\nobj.name === undefined\ndest.name === 'bar'\n```\n\n### Use in mobx\n\n```javascript\nconst { observable } = require('mobx')\nconst { defineSymbolic } = require('symbolic-link')\n\nclass Src {\n  @observable name\n}\n\nclass Combine {\n  @observable obj = {\n    name: 'objName'\n  }\n\n  @observable src = defineSymbolic(new Src(), {\n    name: [this.obj, 'name']\n  })\n\n  srcX = define(new Src(), {\n    name: [this.obj, 'name']\n  })\n}\n\nconst comb = new Combine()\ncomb.src.name === comb.obj.name\ncomb.srcX.name === comb.obj.name\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### symbolicLink\n\n[index.js:86-120](https://github.com/imcuttle/symbolic-link/blob/6f46a6dccc6a06316cce5d13012fb933d53b95bd/index.js#L86-L120 \"Source code on GitHub\")\n\n#### Parameters\n\n-   `srcTarget`  {any}\n-   `srcPropName`  {String|Symbol|Number}\n-   `destTarget`  {any}\n-   `destPropName`  {String|Symbol|Number}\n-   `descriptor`  {object}\n\n#### Examples\n\n```javascript\nconst obj = {}\nconst dest = { name: 'foo' }\nconst rm = symbolicLink(obj, 'name', dest, 'foo')\n\nobj.name === 'foo'\nobj.name = 'bar'\ndest.name = 'bar'\n\nrm()\n\nobj.name === undefined\ndest.name === 'bar'\n```\n\nReturns **any** dispose {Function}\n\n### symbolicTarget\n\n[index.js:142-152](https://github.com/imcuttle/symbolic-link/blob/6f46a6dccc6a06316cce5d13012fb933d53b95bd/index.js#L142-L152 \"Source code on GitHub\")\n\n#### Parameters\n\n-   `target`  {any}\n-   `config`  {{name: [destTarget, destPropName, descriptor]}}\n\n#### Examples\n\n```javascript\nconst obj = {}\nconst dest = { name: 'foo' }\nconst rm = symbolicTarget(obj, {\n  name: [dest, 'name']\n})\n\nobj.name === 'foo'\nobj.name = 'bar'\ndest.name === 'bar'\nrm()\n\nobj.name === undefined\ndest.name === 'bar'\n```\n\nReturns **any** dispose {Function}\n\n### defineSymbolic\n\n[index.js:160-163](https://github.com/imcuttle/symbolic-link/blob/6f46a6dccc6a06316cce5d13012fb933d53b95bd/index.js#L160-L163 \"Source code on GitHub\")\n\n#### Parameters\n\n-   `target`  {any}\n-   `config`  {{name: [destTarget, destPropName, descriptor]}}\n\nReturns **any** target {any}\n\n## Contributing\n\n-   Fork it!\n-   Create your new branch:  \n    `git checkout -b feature-new` or `git checkout -b fix-which-bug`\n-   Start your magic work now\n-   Make sure npm test passes\n-   Commit your changes:  \n    `git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`\n-   Push to the branch: `git push`\n-   Submit a pull request :)\n\n## Authors\n\nThis library is written and maintained by imcuttle, \u003ca href=\"mailto:moyuyc95@gmail.com\"\u003emoyuyc95@gmail.com\u003c/a\u003e.\n\n## License\n\nMIT - [imcuttle](https://github.com/imcuttle) 🐟\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fsymbolic-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Fsymbolic-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Fsymbolic-link/lists"}