{"id":16499053,"url":"https://github.com/joshday/propertyutils.jl","last_synced_at":"2026-03-07T09:03:44.590Z","repository":{"id":61799246,"uuid":"309689189","full_name":"joshday/PropertyUtils.jl","owner":"joshday","description":"Properties in Julia made easy","archived":false,"fork":false,"pushed_at":"2023-06-01T00:10:22.000Z","size":24,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-01T15:20:49.502Z","etag":null,"topics":["julia","utilities"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/joshday.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-03T13:06:46.000Z","updated_at":"2025-10-28T00:37:23.000Z","dependencies_parsed_at":"2025-02-13T00:32:51.055Z","dependency_job_id":"620f1e36-4933-452a-8ab8-97df9459e1a1","html_url":"https://github.com/joshday/PropertyUtils.jl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/joshday/PropertyUtils.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshday%2FPropertyUtils.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshday%2FPropertyUtils.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshday%2FPropertyUtils.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshday%2FPropertyUtils.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshday","download_url":"https://codeload.github.com/joshday/PropertyUtils.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshday%2FPropertyUtils.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30210377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["julia","utilities"],"created_at":"2024-10-11T14:51:00.094Z","updated_at":"2026-03-07T09:03:44.567Z","avatar_url":"https://github.com/joshday.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePropertyUtils\u003c/h1\u003e\n\nThis package lets you:\n\n1. Change `getproperty` to `getfield` via `Fields(x)`\n2. Change `getproperty` to `getindex` via `Indexes(x)` (most useful for `AbstractDict{Symbol, Any}`).\n3. Similarly, `Fields`, and `Indexes` change the behavior of `setproperty!`.\n4. Replace items in an expression with properties from a `src` via `@with src expr`.\n5. Join together properties of different objects via `JoinProps`.\n\n\n\u003cbr\u003e\u003cbr\u003e\n\n## `@with`\n\n### Replace items in an expression with properties from a `src`.\n\n```julia\n@with src expr\n```\n\n- Every valid identifier `x` in `expr` gets changed to `hasproperty(src, :x) ? src.x : x`\n\n```julia\nz = 3\nresult = @with (x = 1, y = 2) begin\n    x + y + z\nend\nresult == 6\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## `JoinProps`\n\n### Join sources to create a union of their props.\n\nExample:\n\n```julia\na = (x = 1, y = 2)\nb = (y = 3, z = 4)\n\nj = JoinProps(a, b)\n\nj.x == 1\nj.y == 2  # non-unique props are taken from the first argument that has it\nj.z == 4\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## `Fields`\n\n### Map `getproperty` to `getfield`.\n\n\n```julia\nstruct A\n    x::Int\nend\nBase.getproperty(::A, x::Symbol) = \"hello!\"\n\nitem = A(1)\nf_item = Fields(a)\n\nitem.x == \"hello!\"\nf_item.x == 1\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## `Indexes`\n\n### Map `getproperty` to `getindex`.\n\n```julia\nd = Dict(:x =\u003e 1, :y =\u003e 2)\n\nIndexes(d).y == 2\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Composability\n\n`@with`, `Fields`, `Indexes`, and `JoinProps` play nicely together:\n\n```julia\nresult = @with JoinProps(Fields(A(10)), a, b, Indexes(Dict(:twenty =\u003e 20))) begin\n           x + y + z + twenty\n       end\n\nresult == 36\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## How this all works with `setproperty!`\n\n`setproperty!`, e.g. `thing.x = 1`, is supported if the underlying data structure supports mutation.\n\n- `Indexes(x)`: `setproperty!` --\u003e `setindex!`\n- `Fields(x)`: `setproperty!` --\u003e `setfield!`\n- `JoinProps(x)`: `setproperty!` --\u003e `setproperty!` on the first instance of the prop.  You cannot\n    create new props.\n\n```julia\nIndexes(d).z = 3\n\nd[:z] == 3\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Special Thanks\n\nThis package borrows ideas from [StatsModels.jl](https://github.com/JuliaStats/StatsModels.jl), [DataFramesMeta.jl](https://github.com/JuliaData/DataFramesMeta.jl), [StaticModules.jl](https://github.com/MasonProtter/StaticModules.jl), and [StatsPlots.jl](https://github.com/JuliaPlots/StatsPlots.jl), which are all fantastic.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshday%2Fpropertyutils.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshday%2Fpropertyutils.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshday%2Fpropertyutils.jl/lists"}