{"id":21722582,"url":"https://github.com/mdor/js-extensions","last_synced_at":"2026-05-10T17:03:36.808Z","repository":{"id":58700411,"uuid":"532274718","full_name":"MDOR/js-extensions","owner":"MDOR","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-10T19:01:23.000Z","size":479,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T02:48:43.644Z","etag":null,"topics":[],"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/MDOR.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":"2022-09-03T13:54:03.000Z","updated_at":"2023-03-09T01:55:01.000Z","dependencies_parsed_at":"2023-02-19T12:40:15.549Z","dependency_job_id":null,"html_url":"https://github.com/MDOR/js-extensions","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDOR%2Fjs-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDOR%2Fjs-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDOR%2Fjs-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDOR%2Fjs-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MDOR","download_url":"https://codeload.github.com/MDOR/js-extensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244700594,"owners_count":20495574,"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-26T02:30:05.491Z","updated_at":"2026-05-10T17:03:31.767Z","avatar_url":"https://github.com/MDOR.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nSet of JavasScript utilities, modular, performant, and easy to use.\n\n## Install\n\n**npm**\n\n```sh\nnpm i @mdor/js-extensions -S\nnpm install @mdor/js-extensions --save\n```\n\n**yarn**\n\n```sh\nyarn add @mdor/js-extensions\nyarn workspace \u003cworkspace-name\u003e @mdor/js-extensions\n```\n\n## Documentation\n\n### Object\n\n- #### getFrom\n  Extracts a property from any given input, if the property is not present, then a fallback value will be returned.\n\n```js\nconst user = {\n  id: \"123123456\",\n  active: true,\n  attributes: {\n    name: \"Joe\",\n  },\n  trades: [\n    {\n      id: \"werwe224\",\n      bill: 123454,\n    },\n  ],\n};\nconst userName = getFrom(\"attributes.name\")(user);\nconst userFirstBill = getFrom('attributes.trades.[0][\"bill\"]')(user);\n```\n\n#### `setInto`\n\nSet or override a property in any given input, if the path is not present, then it will be created.\n\n```js\nconst user = {\n  id: \"123123456\",\n  active: true,\n  attributes,\n};\n\nsetInto(\"attributes.name\", \"Marco\")(user);\n// equivalent   setInto([\"attributes\", \"name\"], \"Marco\")(user);\n// output Joe\nsetInto('attributes.trades.[0][\"bill\"]', 100)(user);\n// equivalent   setInto([\"attributes\", \"trades\", 0, \"bill\"], 100)(user);\n// output 123454\nsetInto(\"attributes.trades.1.bill\", 0)(user);\n// equivalent   setInto([\"attributes\", \"trades\", 1, \"bill\"], 0)(user);\n// output 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdor%2Fjs-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdor%2Fjs-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdor%2Fjs-extensions/lists"}