{"id":22086199,"url":"https://github.com/imjaroiswebdev/curry-remap-keys","last_synced_at":"2025-07-24T17:31:47.660Z","repository":{"id":123516017,"uuid":"147116639","full_name":"imjaroiswebdev/curry-remap-keys","owner":"imjaroiswebdev","description":"Utility for remapping key names of an object shallowly and depply nested too, that supports currying for partial application.","archived":false,"fork":false,"pushed_at":"2019-01-04T09:37:54.000Z","size":123,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T02:50:48.362Z","etag":null,"topics":["es6","npm-package","utility"],"latest_commit_sha":null,"homepage":"","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/imjaroiswebdev.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,"zenodo":null}},"created_at":"2018-09-02T19:48:00.000Z","updated_at":"2023-03-08T13:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"52a62cad-6383-4c88-90bb-a2053921d67a","html_url":"https://github.com/imjaroiswebdev/curry-remap-keys","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/imjaroiswebdev/curry-remap-keys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjaroiswebdev%2Fcurry-remap-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjaroiswebdev%2Fcurry-remap-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjaroiswebdev%2Fcurry-remap-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjaroiswebdev%2Fcurry-remap-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imjaroiswebdev","download_url":"https://codeload.github.com/imjaroiswebdev/curry-remap-keys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjaroiswebdev%2Fcurry-remap-keys/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266878573,"owners_count":23999619,"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-07-24T02:00:09.469Z","response_time":99,"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":["es6","npm-package","utility"],"created_at":"2024-12-01T01:21:53.768Z","updated_at":"2025-07-24T17:31:47.624Z","avatar_url":"https://github.com/imjaroiswebdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# curry-remap-keys [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flt-square)](https://standardjs.com) [![NPM version](https://img.shields.io/npm/v/curry-remap-keys.svg?style=flat)](https://www.npmjs.com/package/curry-remap-keys) [![NPM monthly downloads](https://img.shields.io/npm/dm/curry-remap-keys.svg?style=flat)](https://npmjs.org/package/curry-remap-keys) [![NPM total downloads](https://img.shields.io/npm/dt/curry-remap-keys.svg?style=flat)](https://npmjs.org/package/curry-remap-keys)\n\n\u003e Utility for remapping key names of an object shallowly and depply nested too, that supports currying for partial application.\n\nIt embraces functional programming not mutating its entry, but returning a new object that maintains the original prototype chain and properties enumerables or not, respecting referential transparency.\n\n## Install\n\n```shell\n$ npm install curry-remap-keys --save\n```\n\n## Usage (Basic)\n\n```javascript\nconst { remapKeys } = require('curry-remap-keys')\n// As ES6 Module\nimport { remapKeys } from 'curry-remap-keys'\n\nconst user = {\n  user_id: '9e947a10-af08-11e8-9b04-d3ce91a97e8d',\n  order_id: 'aa4025d0-af08-11e8-9215-1106c9538c60',\n  productName: 'The best notebook of the whole world',\n  qty: '1'\n}\n\nconst remapping = {\n  user_id: 'userId',\n  order_id: 'orderId'\n}\n\nconst remappedUser = remapKeys(remapping, user)\n\nconsole.log(remappedUser)\n// {\n//   userId: '9e947a10-af08-11e8-9b04-d3ce91a97e8d',\n//   orderId: 'aa4025d0-af08-11e8-9215-1106c9538c60',\n//   productName: 'The best notebook of the whole world',\n//   qty: '1'\n// }\n```\n\n\u003cbr\u003e\n\n## Usage (Nested keys)\n\n\u003e This will follow or create the necessary key names that fulfills the supplied path.\n\n```javascript\nconst { remapKeys } = require('curry-remap-keys')\n// As ES6 Module\nimport { remapKeys } from 'curry-remap-keys'\n\nconst user = {\n  user_id: '9e947a10-af08-11e8-9b04-d3ce91a97e8d',\n  order_id: 'aa4025d0-af08-11e8-9215-1106c9538c60',\n  productName: 'The best notebook of the whole world',\n  qty: '1',\n  billingInfo: {\n    locationInfo: {\n      billing_address: '1368 Meadowbrook Mall Road',\n      city: 'Los Angeles, CA',\n      zip: '90017'\n    }\n  },\n  customerInfo: {\n    interested_in: ['notebooks', 'smartphones', 'smart tv'],\n    isOneTimeBuyer: false\n  }\n}\n\nconst remapping = {\n  user_id: 'userId',\n  billing_address: ['billingAddress', ['billingInfo', 'locationInfo']],\n  // Natural point notation for path to nested key also supported like...\n  // billing_address: ['billingAddress', 'billingInfo.locationInfo'],\n  interested_in: ['interestedIn', ['customerInfo']]\n}\n\nconst remappedUser = remapKeys(remapping, user)\n\nconsole.log(remappedUser)\n// {\n//   userId: '9e947a10-af08-11e8-9b04-d3ce91a97e8d',\n//   order_id: 'aa4025d0-af08-11e8-9215-1106c9538c60',\n//   productName: 'The best notebook of the whole world',\n//   qty: '1',\n//   billingInfo: {\n//     locationInfo: {\n//       billingAddress: '1368 Meadowbrook Mall Road',\n//       city: 'Los Angeles, CA',\n//       zip: '90017'\n//     }\n//   },\n//   customerInfo: {\n//     interestedIn: ['notebooks', 'smartphones', 'smart tv'],\n//     isOneTimeBuyer: false\n//   }\n// }\n```\n\n\u003cbr\u003e\n\n## Currying\n\n```javascript\nconst { remapKeys } = require('curry-remap-keys')\n// As ES6 Module\nimport { remapKeys } from 'curry-remap-keys'\n\n// Same user and remapping object as above\n\n// Partially apply remapKeys for reusing\nconst userRemapper = remapKeys(remapping)\n\nconsole.log(userRemapper(user))\n// {\n//   userId: '9e947a10-af08-11e8-9b04-d3ce91a97e8d',\n//   orderId: 'aa4025d0-af08-11e8-9215-1106c9538c60',\n//   productName: 'The best notebook of the whole world',\n//   qty: '1'\n// }\n```\n\n## See also\n* [API documentation](https://github.com/imjaroiswebdev/curry-remap-keys/blob/master/docs/API.md)\n\n## License\nCopyright © 2018, [José Antonio Reyes](https://imjaroiswebdev.tech).\nReleased under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjaroiswebdev%2Fcurry-remap-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimjaroiswebdev%2Fcurry-remap-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjaroiswebdev%2Fcurry-remap-keys/lists"}