{"id":17774829,"url":"https://github.com/rickwong/trespass","last_synced_at":"2025-04-21T23:32:06.031Z","repository":{"id":57379779,"uuid":"110139852","full_name":"RickWong/trespass","owner":"RickWong","description":"Access and chain object properties and methods in a safe manner.","archived":false,"fork":false,"pushed_at":"2020-08-24T04:35:33.000Z","size":96,"stargazers_count":5,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-25T09:46:52.958Z","etag":null,"topics":["access","deep","es6","methods","node","null","object","properties","proxy","safe","trespass","undefined"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RickWong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-09T16:32:54.000Z","updated_at":"2019-10-30T22:57:28.000Z","dependencies_parsed_at":"2022-09-06T03:32:28.622Z","dependency_job_id":null,"html_url":"https://github.com/RickWong/trespass","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickWong%2Ftrespass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickWong%2Ftrespass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickWong%2Ftrespass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickWong%2Ftrespass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RickWong","download_url":"https://codeload.github.com/RickWong/trespass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881649,"owners_count":17219268,"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":["access","deep","es6","methods","node","null","object","properties","proxy","safe","trespass","undefined"],"created_at":"2024-10-26T21:52:25.442Z","updated_at":"2024-11-09T21:03:14.746Z","avatar_url":"https://github.com/RickWong.png","language":"JavaScript","readme":"# trespass\n\nTired of `\u0026\u0026` or `?:` property guarding? Access undefined object properties and chain undefined methods in a safe manner.\n\n## Installation\n\n```bash\nnpm install --save trespass\n```\n\n## Usage\n\nSimple:\n\n```js\nimport t from 'trespass';\n\nconst fakeUser = undefined;\nconst realUser = { name: 'Rick' };\n\nt(fakeUser).contact.$; // access undefined or null objects\n\nt(realUser).contact.faxNumber.$; // access undefined properties\n\nt(realUser).greet().fakeSlap().$; // chain defined and undefined methods\n\nt(fakeUser).fakeSlap().greet().fakeName.$; // all together\n```\n\nCustom terminator:\n\n```js\nconst $ = t.createWrapper('$val'); \n\n$(foo).bar.$val; \n```\n\n## Requirements\n\nNode 6.4+. Native [Browser support](https://caniuse.com/#search=Proxy) for ES6 Proxies.\n\n## Why\n\nBecause the official Optional Chaining `?.` proposal is still in stage-1 currently, see https://github.com/tc39/proposal-optional-chaining.\n\n## Other packages\n\n- https://github.com/facebookincubator/idx\n- https://github.com/ktsn/safe-object-proxy\n- https://github.com/erictrinh/safe-proxy\n- https://github.com/forceuser/access-deep\n- https://github.com/tonylukasavage/safeproxy\n\n## Community\n\nLet's start one together! After you ★ this project, follow me [@rygu](https://twitter.com/rygu) on Twitter.\n\n## License\n\nBSD 3-Clause license. Copyright © 2017, Rick Wong. All rights reserved.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickwong%2Ftrespass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickwong%2Ftrespass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickwong%2Ftrespass/lists"}