{"id":22382422,"url":"https://github.com/jcoreio/map-shape","last_synced_at":"2025-08-14T21:21:27.704Z","repository":{"id":40783640,"uuid":"241295271","full_name":"jcoreio/map-shape","owner":"jcoreio","description":"apply mapping functions to specific properties of an object","archived":false,"fork":false,"pushed_at":"2023-01-05T07:35:12.000Z","size":3462,"stargazers_count":0,"open_issues_count":21,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-01T17:49:07.286Z","etag":null,"topics":["convert","functional-programming","map","restructuring"],"latest_commit_sha":null,"homepage":null,"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/jcoreio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-18T07:08:43.000Z","updated_at":"2020-02-19T04:06:18.000Z","dependencies_parsed_at":"2023-02-03T18:31:53.819Z","dependency_job_id":null,"html_url":"https://github.com/jcoreio/map-shape","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fmap-shape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fmap-shape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fmap-shape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcoreio%2Fmap-shape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcoreio","download_url":"https://codeload.github.com/jcoreio/map-shape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245726806,"owners_count":20662544,"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":["convert","functional-programming","map","restructuring"],"created_at":"2024-12-05T00:12:58.015Z","updated_at":"2025-03-26T19:40:57.414Z","avatar_url":"https://github.com/jcoreio.png","language":"TypeScript","readme":"# map-shape\n\n[![CircleCI](https://circleci.com/gh/jcoreio/map-shape.svg?style=svg)](https://circleci.com/gh/jcoreio/map-shape)\n[![Coverage Status](https://codecov.io/gh/jcoreio/map-shape/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/map-shape)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm version](https://badge.fury.io/js/map-shape.svg)](https://badge.fury.io/js/map-shape)\n\nOne of those missing lodash functions. Includes TypeScript definitions and Flow definitions\n(they aren't prefect, there are some edge cases...)\n\n```js\nimport mapShape from 'map-shape'\n\nmapShape(\n  {\n    foo: 1,\n    bar: '2',\n    baz: 'hello',\n  },\n  {\n    foo: (value, key, obj) =\u003e `${value} ${key} ${obj.baz}`,\n    bar: value =\u003e parseInt(value),\n  }\n)\n// outputs { foo: '1 foo hello', bar: 2 }\n```\n\nEach mapper function is called with three arguments:\n\n- `value` - the value of the input property\n- `key` - the key of the input property\n- `obj` - the input object\n\n### Notes\n\nIf the input object is `null`, returns `null`. If the input object is `undefined`, returns `undefined`.\n\n## FP Version\n\nWorks better with `lodash/fp`. Only passes the `value` to each mapper function.\n\n```js\nimport mapShape from 'map-shape/fp'\n\nmapShape({\n  foo: String,\n  bar: parseInt,\n})({\n  foo: 1,\n  bar: '2',\n  baz: 'hello',\n})\n// outputs { foo: '1', bar: 2 }\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fmap-shape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcoreio%2Fmap-shape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcoreio%2Fmap-shape/lists"}