{"id":21414870,"url":"https://github.com/magic/deep","last_synced_at":"2025-03-16T18:42:02.786Z","repository":{"id":54292935,"uuid":"129685922","full_name":"magic/deep","owner":"magic","description":"work with deeply nested objects and arrays","archived":false,"fork":false,"pushed_at":"2023-02-16T07:40:34.000Z","size":518,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T20:37:43.632Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magic.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":"2018-04-16T04:45:22.000Z","updated_at":"2021-12-26T16:43:57.000Z","dependencies_parsed_at":"2024-11-22T18:47:23.183Z","dependency_job_id":null,"html_url":"https://github.com/magic/deep","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Fdeep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Fdeep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Fdeep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic%2Fdeep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magic","download_url":"https://codeload.github.com/magic/deep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243911273,"owners_count":20367651,"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-22T18:34:09.513Z","updated_at":"2025-03-16T18:42:02.766Z","avatar_url":"https://github.com/magic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### @magic/deep\n\nWork with deeply nested objects and arrays.\n\n[![NPM version][npm-image]][npm-url]\n[![Linux Build Status][travis-image]][travis-url]\n[![Windows Build Status][appveyor-image]][appveyor-url]\n[![Coverage Status][coveralls-image]][coveralls-url]\n[![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n\n[npm-image]: https://img.shields.io/npm/v/@magic/deep.svg\n[npm-url]: https://www.npmjs.com/package/@magic/deep\n[travis-image]: https://api.travis-ci.com/magic/deep.svg?branch=master\n[travis-url]: https://travis-ci.com/magic/deep\n[appveyor-image]: https://img.shields.io/appveyor/ci/magic/deep/master.svg\n[appveyor-url]: https://ci.appveyor.com/project/magic/deep/branch/master\n[coveralls-image]: https://coveralls.io/repos/github/magic/deep/badge.svg\n[coveralls-url]: https://coveralls.io/github/magic/deep\n[greenkeeper-image]: https://badges.greenkeeper.io/magic/deep.svg\n[greenkeeper-url]: https://badges.greenkeeper.io/magic/deep.svg\n[snyk-image]: https://snyk.io/test/github/magic/deep/badge.svg\n[snyk-url]: https://snyk.io/test/github/magic/deep\n\n##### install\n\n```bash\nnpm i --save --save-exact @magic/deep\n```\n\n##### import\n\n```javascript\n// single function\nimport { equal, flatten, loop, merge } from '@magic/deep'\n\n// object with all functions\nimport deep from '@magic/deep'\n```\n\nCurrently implemented:\n\n##### deep.equal\n\n```javascript\n// test equality\ndeep.equal(['shallow', ['deep']], ['shallow', ['deep']])\n// true\n\n// alias\ndeep.equals, deep.eq\n```\n\n##### deep.different\n\n```javascript\n// test difference\ndeep.different(['shallow', ['deep']], ['shallow', ['deep']])\n// false\n\n// alias\ndeep.diff\n```\n\n##### deep.flatten\n\n```javascript\n// flatten a deeply nested array\ndeep.flatten(['shallow', ['deep']])\n// ['shallow', 'deep']\n```\n\n##### deep.loop\n\n```javascript\n// apply function add\nconst add = e =\u003e e + 1\n\n// for each item\nconst items = [1, 2, [3]]\n\n// using a deeply nested array\ndeep.loop(add, items)\n// or\ndeep.loop(items, add)\n// returns [2, 3, [4]]\n```\n\n##### deep.merge\n\n```javascript\n// merge objects and arrays, with infinite recursion if needed.\n// this can be slow...\n\ndeep.merge({ obj1Key: { val: 1 } }, { obj2Key: { val: 2 } })\n\n// { obj1Key: { val: 1}, obj2Key: { val: 2 } }\n\ndeep.merge({ key: { val: 1, str: 'test' } }, { key: { val: 2, str: 'overwritten' } })\n\n// { key: { val: 2, str: 'overwritten' } }\n```\n\n### Changelog\n\n#### 0.1.0\n\nuse ecmascript modules instead of commonjs.\n\n#### 0.1.1\n\n- update readme\n- also export deep.eq alias for deep.equal\n\n#### 0.1.2\n\n- require node 13.5.0\n- use deep.equal and deep.different from @magic/types\n\n#### 0.1.3\n\nbump required node version to 14.2.0\n\n#### 0.1.4\n\nupdate dependencies\n\n#### 0.1.5\n\n- bump required node version to 14.15.4\n- update dependencies\n\n##### 0.1.6\n\n- merge now checks if o2.hasOwnProperty is a function before using it to check if we should overwrite keys of o1 or not.\n\n##### 0.1.7\n\nupdate @magic/types to avoid circular dependency\n\n##### 0.1.8\n\n- update dependencies\n- use @magic/types for all type comparisons\n\n##### 0.1.9\n\nupdate dependencies\n\n##### 0.1.10\n\nupdate dependencies\n\n##### 0.1.11\n\nupdate dependencies\n\n##### 0.1.12\n\nupdate dependencies\n\n##### 0.0.13\n\nupdate dependencies\n\n##### 0.0.14\n\nupdate dependencies\n\n##### 0.0.15\n\nupdate dependencies\n\n##### 0.0.16\n\nupdate dependencies\n\n##### 0.0.17 - unreleased\n\n...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic%2Fdeep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagic%2Fdeep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic%2Fdeep/lists"}