{"id":15416564,"url":"https://github.com/jahilldev/immutable-parsejs","last_synced_at":"2026-04-13T23:32:06.997Z","repository":{"id":57272822,"uuid":"431081382","full_name":"jahilldev/immutable-parsejs","owner":"jahilldev","description":"Parse a JS object or array/map into an Immutable collection. Makes use of ImmutableJs List, and Record primitives.","archived":false,"fork":false,"pushed_at":"2022-02-09T12:49:54.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-23T22:00:59.407Z","etag":null,"topics":["data","immutablejs","javascript","json","nodejs","parse","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/jahilldev.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":"2021-11-23T11:53:31.000Z","updated_at":"2021-12-03T13:21:01.000Z","dependencies_parsed_at":"2022-08-25T06:41:56.961Z","dependency_job_id":null,"html_url":"https://github.com/jahilldev/immutable-parsejs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jahilldev/immutable-parsejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Fimmutable-parsejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Fimmutable-parsejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Fimmutable-parsejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Fimmutable-parsejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jahilldev","download_url":"https://codeload.github.com/jahilldev/immutable-parsejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahilldev%2Fimmutable-parsejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31775749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"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":["data","immutablejs","javascript","json","nodejs","parse","typescript"],"created_at":"2024-10-01T17:12:25.907Z","updated_at":"2026-04-13T23:32:06.968Z","avatar_url":"https://github.com/jahilldev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# immutable-parsejs\n\nSometimes when working with large data sets that come from an external source, think API, we need someway of converting that data into Immutable structures. This is useful, not only for type safety, but also for comparison checks and the improved performance they provide.\n\nFor more on why, check out Immutable's documentation:\nhttps://immutable-js.com/\n\nThis package (**389 bytes** GZipped) exports a single function, `parseJs`, that can be used to wrap a nested data structure in Immutable objects, namely `List` and `Record`.\n\n# Getting Started\n\nInstall with Yarn:\n\n```bash\n$ yarn add immutable-parsejs\n```\n\nInstall with NPM:\n\n```bash\n$ npm i immutable-parsejs\n```\n\n# Using parseJs()\n\nOnce you have your data structure, either an object, or an array/map of objects, you can pass that into the `parseJs` function:\n\n```typescript\nimport { parseJs } from 'immutable-parsejs';\n\nconst dataSet = [\n  { userId: 1001, firstName: 'John' },\n  { userId: 1002, firstName: 'Joe' },\n];\n\nconst result = parseJs(dataSet); // \u003c-- List\u003cRecord\u003e;\nconst { firstName } = result.get(0);\n\n/*[...]*/\n\nconsole.log(firstName); // \u003c-- John\n\n/*[...]*/\n\nconsole.log(result === result.setIn([0, 'firstName'], 'John')); // \u003c-- true\nconsole.log(result === result.setIn([0, 'firstName'], 'Sam')); // \u003c-- false\n```\n\nNow your data set is wrapped recursively, objects will now be `Record`'s, and arrays will be `List`'s.\n\n# Known issues\n\nWhen working with complex structures in TypeScript, getting nested types to work is tricky. Types are automatically infered, but they can only do so much. If you have an array of objects, that themselves have arrays, TypeScript will incorrectly infer the arrays within an object to be array primitives, not `List`'s. To get around this, I'd suggest that you define your data structure via an interface upfront (this is good practice, anyway).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahilldev%2Fimmutable-parsejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahilldev%2Fimmutable-parsejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahilldev%2Fimmutable-parsejs/lists"}