{"id":15698959,"url":"https://github.com/doowb/computed-property","last_synced_at":"2025-05-08T22:40:47.671Z","repository":{"id":23508949,"uuid":"26874799","full_name":"doowb/computed-property","owner":"doowb","description":"Add computed properties to JavaScript objects.","archived":false,"fork":false,"pushed_at":"2017-06-03T12:56:20.000Z","size":39,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-20T05:37:54.379Z","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/doowb.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}},"created_at":"2014-11-19T18:16:07.000Z","updated_at":"2021-04-12T21:56:52.000Z","dependencies_parsed_at":"2022-09-18T00:51:57.079Z","dependency_job_id":null,"html_url":"https://github.com/doowb/computed-property","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fcomputed-property","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fcomputed-property/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fcomputed-property/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fcomputed-property/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/computed-property/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160727,"owners_count":21863624,"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-03T19:36:43.141Z","updated_at":"2025-05-08T22:40:47.632Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# computed-property [![NPM version](https://img.shields.io/npm/v/computed-property.svg?style=flat)](https://www.npmjs.com/package/computed-property) [![NPM monthly downloads](https://img.shields.io/npm/dm/computed-property.svg?style=flat)](https://npmjs.org/package/computed-property)  [![NPM total downloads](https://img.shields.io/npm/dt/computed-property.svg?style=flat)](https://npmjs.org/package/computed-property) [![Linux Build Status](https://img.shields.io/travis/doowb/computed-property.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/computed-property) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/computed-property.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/doowb/computed-property)\n\n\u003e Add computed properties to JavaScript objects.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save computed-property\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add computed-property\n```\n\n## Usage\n\n```js\nvar computedProperty = require('computed-property');\n```\n\n## API\n\n### [computedProperty](index.js#L99)\n\nAdd a computed property to an object. This updates the property when dependent properties are updated.\n\n**Params**\n\n* `obj` **{Object}**: Object to add the property to.\n* `property` **{String}**: Name of the property.\n* `dependencies` **{Array}**: Optional list of properties to depend on.\n* `getter` **{Function}**: Getter function that does the calculation.\n\n**Example**\n\n```js\nvar computedProperty = require('computed-property');\nvar file = {\n  name: 'home-page',\n  ext: '.hbs',\n  dirname: 'views',\n  data: {\n    title: 'Home'\n  }\n};\n\ncomputedProperty(\n  // object\n  file,\n  // property name\n  'path',\n  // optional dependencies (may be deeply nested)\n  ['name', 'ext', 'dirname', 'data.title'],\n  // getter function\n  function () {\n    return this.dirname + '/' + this.name + this.ext;\n  });\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 10 | [doowb](https://github.com/doowb) |  \n| 7  | [pgilad](https://github.com/pgilad) |  \n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 03, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fcomputed-property","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fcomputed-property","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fcomputed-property/lists"}