{"id":16137881,"url":"https://github.com/gsuuon/simple-object-translation","last_synced_at":"2026-02-02T02:03:44.020Z","repository":{"id":42651943,"uuid":"179417972","full_name":"gsuuon/simple-object-translation","owner":"gsuuon","description":"Generate translator functions from an object map","archived":false,"fork":false,"pushed_at":"2023-01-07T07:27:42.000Z","size":627,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T03:32:04.464Z","etag":null,"topics":["object-mapping","object-to-object","translator"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gsuuon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-04T03:54:35.000Z","updated_at":"2021-05-13T18:05:16.000Z","dependencies_parsed_at":"2023-02-06T14:45:51.312Z","dependency_job_id":null,"html_url":"https://github.com/gsuuon/simple-object-translation","commit_stats":null,"previous_names":["guo-sun/simple-object-translation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gsuuon/simple-object-translation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsuuon%2Fsimple-object-translation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsuuon%2Fsimple-object-translation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsuuon%2Fsimple-object-translation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsuuon%2Fsimple-object-translation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gsuuon","download_url":"https://codeload.github.com/gsuuon/simple-object-translation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsuuon%2Fsimple-object-translation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29001519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T01:32:03.847Z","status":"online","status_checked_at":"2026-02-02T02:00:07.448Z","response_time":58,"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":["object-mapping","object-to-object","translator"],"created_at":"2024-10-09T23:30:13.714Z","updated_at":"2026-02-02T02:03:43.999Z","avatar_url":"https://github.com/gsuuon.png","language":"JavaScript","readme":"# simple-object-translation\n\n`parseTranslationMap` builds two translator functions from an object map. The first function takes an object from the shape implied by the map's paths to the map structure, and the second from the map structure to the implied object shape.\n\n```js\nimport { parseTranslationMap } from 'simple-object-translation'\n\nconst foosToXsTranslationMap = {\n    foo: 'x',\n    bar: 'y.y',\n    baz: 'y.z'\n}\n\nconst [toFoos, toXs] = parseTranslationMap(foosToXsTranslationMap)\n\nconst foos = {\n    foo: 'foo',\n    bar: 'bar',\n    baz: 'baz',\n}\n\nconst xs = {\n    x: 'x',\n    y: {\n        y: 'y',\n        z: 'z'\n    }\n}\n\nexpect(toFoos(xs)).toEqual({\n    foo: 'x',\n    bar: 'y',\n    baz: 'z'\n})\n\nexpect(toXs(foos)).toEqual({\n    x: 'foo',\n    y: {\n        y: 'bar',\n        z: 'baz'\n    }\n})\n```\n\nBlazingly small ~1kb unzipped (but slower than just writing these functions out)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsuuon%2Fsimple-object-translation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgsuuon%2Fsimple-object-translation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsuuon%2Fsimple-object-translation/lists"}