{"id":20311102,"url":"https://github.com/mcmath/deep-map","last_synced_at":"2025-10-06T20:13:43.109Z","repository":{"id":60775043,"uuid":"51401469","full_name":"mcmath/deep-map","owner":"mcmath","description":"Transforms nested values of complex objects","archived":false,"fork":false,"pushed_at":"2019-02-01T08:17:45.000Z","size":63,"stargazers_count":44,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-20T22:59:24.273Z","etag":null,"topics":[],"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/mcmath.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":"2016-02-09T21:30:26.000Z","updated_at":"2024-08-28T10:40:33.000Z","dependencies_parsed_at":"2022-10-04T16:15:50.255Z","dependency_job_id":null,"html_url":"https://github.com/mcmath/deep-map","commit_stats":null,"previous_names":["akim-mcmath/deep-map"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/mcmath/deep-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fdeep-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fdeep-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fdeep-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fdeep-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcmath","download_url":"https://codeload.github.com/mcmath/deep-map/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fdeep-map/sbom","scorecard":{"id":632228,"data":{"date":"2025-08-11","repo":{"name":"github.com/mcmath/deep-map","commit":"b99c008ca0e0f4001fe1a691d16a843113bf26fd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"36 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T08:15:49.884Z","repository_id":60775043,"created_at":"2025-08-21T08:15:49.884Z","updated_at":"2025-08-21T08:15:49.884Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278671794,"owners_count":26025757,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"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":[],"created_at":"2024-11-14T17:36:10.037Z","updated_at":"2025-10-06T20:13:43.086Z","avatar_url":"https://github.com/mcmath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Map\n\n[![Version][version-badge]][npm]\n[![License][license-badge]][license]\n[![Build][build-badge]][travis]\n[![Coverage][coverage-badge]][coveralls]\n\n[Install](#install) | [Usage](#usage) | [API](#api) | [TypeScript](#typescript) | [License](#license)\n\n**Deep Map** recurses through an object and transforms its primitive values\n\u0026ndash; including nested values \u0026ndash; according to some function. Essentially,\nit's a deep version of [`Array.prototype.map()`][array-prototype-map] that\nworks on all objects rather than just on Arrays. Circular references are\nsupported.\n\nTo transform the *keys* of an object rather than its values, use\n[Deep Map Keys][deep-map-keys].\n\n## Install\n\nInstall Deep Map via [npm][npm].\n\n```sh\nnpm install --save deep-map\n```\n\n## Usage\n\nLet's say we have an object like this:\n\n```js\nconst info = {\n  name: '\u003c%- name %\u003e',\n  email: '\u003c%- email %\u003e',\n  keywords: ['\u003c%- keyword1 %\u003e', '\u003c%- keyword2 %\u003e'],\n  hobbies: {\n    primary: '\u003c%- hobby1 %\u003e',\n    secondary: '\u003c%- hobby2 %\u003e'\n  }\n};\n```\n\nAnd we want to fill it with this data:\n\n```js\nconst data = {\n  name: 'Samuel Johnson',\n  email: 'sam.johnson@dictionary.com',\n  keyword1: 'dictionary',\n  keyword2: 'lexicography',\n  hobby1: 'writing',\n  hobby2: 'torying',\n};\n```\n\nWe can use Deep Map like this:\n\n```js\nconst deepMap = require('deep-map');\nconst template = require('lodash/template');\n\nlet result = deepMap(info, value =\u003e template(value)(data));\n```\n\nAnd the result looks like this:\n\n```js\n{\n  name: 'Samuel Johnson',\n  email: 'sam.johnson@dictionary.com',\n  keywords: ['dictionary', 'lexicography'],\n  hobbies: {\n    primary: 'writing',\n    secondary: 'torying'\n  }\n}\n```\n\n## API\n\n#### `deepMap(object, mapFn, [options])`\n\n#### Parameters\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003eParam\u003c/th\u003e\n      \u003cth align=\"left\"\u003eType\u003c/th\u003e\n      \u003cth align=\"left\"\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eobject\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003eany\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        The object whose values are to be transformed. Typically, this will be\n        a complex object containing other nested objects. This object may be an\n        \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array\"\u003e\n        \u003ccode\u003eArray\u003c/code\u003e\u003c/a\u003e, and may contain nested arrays whose values will\n        be deeply transformed in the same way. The object may contain circular\n        references.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003emapFn\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003efunction\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        The function used to transform each primitive value. The function is\n        called with two arguments:\n        \u003cul\u003e\n          \u003cli\u003e\n            \u003cstrong\u003evalue\u003c/strong\u003e \u0026lt;\u003ccode\u003eany\u003c/code\u003e\u0026gt;\n            The value being transformed.\n          \u003c/li\u003e\n          \u003cli\u003e\n            \u003cstrong\u003ekey\u003c/strong\u003e \u0026lt;\u003ccode\u003estring | number\u003c/code\u003e\u0026gt;\n            The key or index of the value being transformed. In the case\n            of plain objects, this will be a string; in the case of arrays,\n            this will be a number.\n          \u003c/li\u003e\n        \u003c/ul\u003e\n        The return value determines the value at the same position on the\n        resulting object.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e[options]\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003eobject\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        An optional options object. The following options are accepted:\n        \u003cul\u003e\n          \u003cli\u003e\n            \u003cstrong\u003einPlace\u003c/strong\u003e \u0026lt;\u003ccode\u003eboolean=false\u003c/code\u003e\u0026gt;\n            Mutate \u003ccode\u003eobject\u003c/code\u003e rather than constructing a new\n            object. Nested objects will also be mutated.\n          \u003c/li\u003e\n          \u003cli\u003e\n            \u003cstrong\u003ethisArg\u003c/strong\u003e \u0026lt;\u003ccode\u003eany=undefined\u003c/code\u003e\u0026gt;\n            Sets the value of\n            \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this\"\u003e\u003ccode\u003ethis\u003c/code\u003e\u003c/a\u003e\n            within \u003ccode\u003emapFn()\u003c/code\u003e.\n          \u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### Returns\n\nReturns a new object with the same keys as `object`. If `options.inPlace` is set\nto `true`, the original object is returned, mutated.\n\n## TypeScript\n\n[TypeScript][typescript] declarations are included in the package. Just import\nthe module, and things will just work.\n\nBy default, the compiler will assume that the return value will have the same\nshape as the input object. In most use cases, this is likely to be true. But in\nsome cases \u0026ndash; like the one below \u0026ndash; the assumption breaks down.\n\n```ts\nfunction isPositive(n: number): boolean {\n  return n \u003e= 0;\n}\n\n// COMPILER ERROR: number not assignable to boolean :(\nlet bool: boolean = deepMap({n: 2}, isPositive).n;\n```\n\nPass a type argument to describe the shape of the return value, and everything\nwill be happy.\n\n```ts\nlet bool: boolean = deepMap\u003c{n: boolean}\u003e({n: 2}, isPositive).n; // :)\n```\n\n## License\n\nCopyright \u0026copy; 2016\u0026ndash;2019 Akim McMath. Licensed under the [MIT License][license].\n\n[version-badge]: https://img.shields.io/npm/v/deep-map.svg?style=flat-square\n[license-badge]: https://img.shields.io/npm/l/deep-map.svg?style=flat-square\n[build-badge]: https://img.shields.io/travis/mcmath/deep-map/master.svg?style=flat-square\n[coverage-badge]: https://img.shields.io/coveralls/mcmath/deep-map/master.svg?style=flat-square\u0026service=github\n[npm]: https://www.npmjs.com/package/deep-map\n[license]: LICENSE\n[travis]: https://travis-ci.org/mcmath/deep-map\n[coveralls]: https://coveralls.io/github/mcmath/deep-map?branch=master\n[deep-map-keys]: https://github.com/mcmath/deep-map-keys\n[typescript]: http://www.typescriptlang.org/\n[array-prototype-map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmath%2Fdeep-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmath%2Fdeep-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmath%2Fdeep-map/lists"}