{"id":20225575,"url":"https://github.com/purescript/purescript-foreign-object","last_synced_at":"2025-03-03T12:45:11.679Z","repository":{"id":32436421,"uuid":"132020126","full_name":"purescript/purescript-foreign-object","owner":"purescript","description":"Functions for working with homogeneous JavaScript objects","archived":false,"fork":false,"pushed_at":"2022-10-27T16:36:57.000Z","size":331,"stargazers_count":29,"open_issues_count":2,"forks_count":16,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-29T21:05:41.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PureScript","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/purescript.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-05-03T16:11:45.000Z","updated_at":"2024-03-31T14:12:17.000Z","dependencies_parsed_at":"2022-08-07T17:30:35.371Z","dependency_job_id":null,"html_url":"https://github.com/purescript/purescript-foreign-object","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Fpurescript-foreign-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Fpurescript-foreign-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Fpurescript-foreign-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Fpurescript-foreign-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript","download_url":"https://codeload.github.com/purescript/purescript-foreign-object/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241004691,"owners_count":19892643,"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":[],"created_at":"2024-11-14T07:13:37.339Z","updated_at":"2025-03-03T12:45:11.626Z","avatar_url":"https://github.com/purescript.png","language":"PureScript","readme":"# purescript-foreign-object\n\n[![Latest release](http://img.shields.io/github/release/purescript/purescript-foreign-object.svg)](https://github.com/purescript/purescript-foreign-object/releases)\n[![Build status](https://github.com/purescript/purescript-foreign-object/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-foreign-object/actions?query=workflow%3ACI+branch%3Amaster)\n[![Pursuit](https://pursuit.purescript.org/packages/purescript-foreign-object/badge)](https://pursuit.purescript.org/packages/purescript-foreign-object)\n\nFunctions for working with homogeneous JavaScript objects from PureScript. Similar to using `Map String a` but simply reusing JavaScript objects.\n\n## Installation\n\n```\nspago install foreign-object\n```\n\n## Example\n\n```purs\nexample = do\n  let\n    -- make an empty Object\n    empty = FO.empty\n\n    -- insert to an empty Object\n    inserted = FO.insert \"a\" 1 empty\n\n    -- or: use the singleton function\n    -- singleton FO.singleton \"a\" 1\n\n  -- lookup values for existing in the Object as a result of Maybe\n  let lookup = FO.lookup \"a\" inserted\n  Assert.assertEqual { actual: lookup, expected: Just 1 }\n\n  -- delete a value from an Object\n  let deleted = FO.delete \"a\" inserted\n  Assert.assertEqual { actual: deleted, expected: FO.empty }\n\n  let\n    -- convert homogeneous records to Object\n    converted = FO.fromHomogeneous { a: 1, b: 2, c: 3}\n    -- check that the converted is equal to a regularly built Object\n    built\n      = FO.empty\n      # FO.insert \"a\" 1\n      # FO.insert \"b\" 2\n      # FO.insert \"c\" 3\n\n  Assert.assertEqual { actual: converted, expected: built }\n```\n\nSee the [tests](test/Main.purs) for more examples.\n\n## Documentation\n\nModule documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-foreign-object).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript%2Fpurescript-foreign-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript%2Fpurescript-foreign-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript%2Fpurescript-foreign-object/lists"}