{"id":17823780,"url":"https://github.com/andersdjohnson/null-propagation","last_synced_at":"2026-03-15T18:37:49.744Z","repository":{"id":46938342,"uuid":"91531081","full_name":"AndersDJohnson/null-propagation","owner":"AndersDJohnson","description":"Emulate null propagation operator.","archived":false,"fork":false,"pushed_at":"2023-01-12T06:49:11.000Z","size":496,"stargazers_count":5,"open_issues_count":15,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T11:42:45.140Z","etag":null,"topics":["ecmascript","esnext","facebook","get","idx","javascript","lodash","null","null-check","path","propagation","stage-1","traversal","traverse"],"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/AndersDJohnson.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":"2017-05-17T03:48:23.000Z","updated_at":"2023-12-05T06:34:34.000Z","dependencies_parsed_at":"2023-02-09T10:31:57.931Z","dependency_job_id":null,"html_url":"https://github.com/AndersDJohnson/null-propagation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersDJohnson%2Fnull-propagation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersDJohnson%2Fnull-propagation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersDJohnson%2Fnull-propagation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndersDJohnson%2Fnull-propagation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndersDJohnson","download_url":"https://codeload.github.com/AndersDJohnson/null-propagation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945539,"owners_count":20372896,"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":["ecmascript","esnext","facebook","get","idx","javascript","lodash","null","null-check","path","propagation","stage-1","traversal","traverse"],"created_at":"2024-10-27T17:59:28.595Z","updated_at":"2026-03-15T18:37:44.698Z","avatar_url":"https://github.com/AndersDJohnson.png","language":"JavaScript","readme":"# null-propagation\n\u003e Emulate null propagation operator.\n\nLike [Facebook's `idx`][idx] and [Lodash's `get`][get],\nbut even more terse than the former, and real syntax unlike the latter.\n\nThe use of real syntax enables static analysis tools.\n\n\n```js\nimport np from 'null-propagation'\n\nconst obj = {\n  a: {\n    b: 'B2'\n  },\n  z: []\n}\n````\n\nFor undefined values, returns undefined:\n```js\nconst c = np(() =\u003e obj.a.c)\n```\n\nWith a default as a 2nd argument, returns that value:\n```js\nconst c2 = np(() =\u003e obj.a.c, 'C2')\n```\n\nFor defined values, returns that value:\n```js\nconst b = np(() =\u003e obj.a.b)\n```\n\nWorks with arrays, returns undefined:\n```js\nconst z = np(() =\u003e obj.z[0].y)\n```\n\nThrows other errors:\n```js\nnp(() =\u003e { throw new Error('some error') })\n```\n\n[idx]: https://github.com/facebookincubator/idx\n[get]: https://lodash.com/docs/4.17.4#get\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersdjohnson%2Fnull-propagation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersdjohnson%2Fnull-propagation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersdjohnson%2Fnull-propagation/lists"}