{"id":32246903,"url":"https://github.com/polygonplanet/ghostrap","last_synced_at":"2026-02-22T03:01:19.459Z","repository":{"id":58244037,"uuid":"43875118","full_name":"polygonplanet/ghostrap","owner":"polygonplanet","description":"Observe the object property getter, setter or method calls and add custom behavior.","archived":false,"fork":false,"pushed_at":"2015-10-16T05:38:24.000Z","size":172,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-23T12:56:11.433Z","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/polygonplanet.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":"2015-10-08T08:51:28.000Z","updated_at":"2023-03-04T03:24:53.000Z","dependencies_parsed_at":"2022-08-31T00:31:28.048Z","dependency_job_id":null,"html_url":"https://github.com/polygonplanet/ghostrap","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/polygonplanet/ghostrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonplanet%2Fghostrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonplanet%2Fghostrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonplanet%2Fghostrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonplanet%2Fghostrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polygonplanet","download_url":"https://codeload.github.com/polygonplanet/ghostrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polygonplanet%2Fghostrap/sbom","scorecard":{"id":740491,"data":{"date":"2025-08-11","repo":{"name":"github.com/polygonplanet/ghostrap","commit":"ee7c40f97f0d3d86c439abd4e2e6368832221500"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T17:17:09.525Z","repository_id":58244037,"created_at":"2025-08-22T17:17:09.528Z","updated_at":"2025-08-22T17:17:09.528Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T23:35:04.139Z","status":"online","status_checked_at":"2026-02-22T02:00:08.193Z","response_time":110,"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":"2025-10-22T17:30:05.289Z","updated_at":"2026-02-22T03:01:19.448Z","avatar_url":"https://github.com/polygonplanet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ghostrap\n========\n\n[![Build Status](https://travis-ci.org/polygonplanet/ghostrap.svg?branch=master)](https://travis-ci.org/polygonplanet/ghostrap)\n\nObserve the object property getter, setter or method calls and add custom behavior.\n\n**ghostrap** can intercept object on any timing (e.g. property value change, assignment, function invocation, etc).\n\n\n## Installation\n\n### In Browser:\n\n```html\n\u003cscript src=\"ghostrap.js\"\u003e\u003c/script\u003e\n```\n\nor\n\n```html\n\u003cscript src=\"ghostrap.min.js\"\u003e\u003c/script\u003e\n```\n\nFunction object **ghostrap** will defined in the global scope.\n\n\n### In Node.js:\n\n```bash\nnpm install ghostrap\n```\n\n```javascript\nvar ghostrap = require('ghostrap');\n```\n\n### bower:\n\n```bash\nbower install ghostrap\n```\n\n----\n\n## Usage\n\n\n### ghostrap\n\n`ghostrap` is a handy constructor.\n`new` operator is not needed.\n\n\n* **ghostrap** ( target )  \n  @param {_Object_} _target_ The target object to trap.  \n  @return {_ghostrap_} Return an instance of ghostrap.  \n\n\nIn this example, outputs a log when the object message has change.\n\n```javascript\nvar myModel = {\n  id: 1,\n  message: 'Hello'\n};\n\nvar ghost = ghostrap(myModel);\nghost.on('change:message', function() {\n  console.log('message changed!');\n});\n\nmyModel.message = 'Good evening';\n// message changed!\nmyModel.message = 'Good night';\n// message changed!\n```\n\n----\n\n### on\n\nAdd new handler.\n\n* **on** ( type, func )  \n  @param {_string_} [_type_](#type) Type of listener/trigger.  \n  @param {_function_} [_func_](#handler) handler function.  \n  @return {_ghostrap_} Return an instance of ghostrap.\n\n#### type\n\nThe first argument _type_ separates by a colon.\n`'when:propName'` e.g. `'get:myPropName'`\n\n##### when:\n\n* **beforeget**  \n  trigger on before get.\n* **get**  \n  trigger on get.\n* **beforeset**  \n  trigger on before set value.\n* **set**  \n  trigger on set value.\n* **beforeapply**  \n  trigger on before function calls.\n* **apply**  \n  trigger on function calls.\n* **change**  \n  trigger on changed value.\n\n#### handler\n\nThe second argument _func_ is a handler function.\nOn callback arguments are following.\n\n```javascript\nfunction(target, key, value, args) { ... }\n```\n\n* target : target object.\n* key    : target key.\n* value  : value to be returned.\n* args   : original function arguments. ('apply' or 'beforeapply')\n\n\nExample:\n\n```javascript\nvar myData = {\n  data: '',\n  maxLength: 20\n};\n\nvar ghost = ghostrap(myData);\nghost.on('set:data', function(target, key, value) {\n  // Truncate data value to the maximum length when set new data.\n  if (value.length \u003e myData.maxLength) {\n    value = value.substr(0, myData.maxLength - 3) + '...';\n  }\n  return value;\n});\n\nmyData.data = 'Lorem ipsum dolor sit amet';\nconsole.log(myData.data); // 'Lorem ipsum dolor...'\n```\n\n----\n\n### once\n\nAdd a new handler.\nJust like [on](#on), but handler is called only once.\n\n----\n\n### off\n\nRemove a handler.\nIf argument _type_ is specified, same types handlers are removed.\nIf argument _func_ is specified, same handlers are removed.\nIf arguments is omitted, all handlers are removed.\n\n* **off** ( [type] [, func] )  \n  @param {_string_} [_type_]  Type of listener/trigger.  \n  @param {_function_} [_func_] handler function.  \n  @return {_ghostrap_} Return an instance of ghostrap.\n\n\nExample:\n\n```javascript\nvar myModel = {\n  id: 1,\n  message: 'Hello'\n};\n\nfunction onMessageChange(target, key, value) {\n  console.log('message changed!', value);\n}\n\nvar ghost = ghostrap(myModel);\nghost.on('change:message', onMessageChange);\n\nmyModel.message = 'Good evening';\n// message changed!\nmyModel.message = 'Good night';\n// message changed!\n\nghost.off('change:message', onMessageChange);\n\nmyModel.message = 'Good morning';\n// no console logs.\n```\n\n----\n\n### clear\n\nClear all handlers and release the target object reference.\n\n* **clear** ( )  \n  @return {_ghostrap_} Return an instance of ghostrap.\n\n----\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolygonplanet%2Fghostrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolygonplanet%2Fghostrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolygonplanet%2Fghostrap/lists"}