{"id":17398453,"url":"https://github.com/vweevers/map-tabular-keys","last_synced_at":"2025-03-29T20:15:36.444Z","repository":{"id":32955682,"uuid":"36557393","full_name":"vweevers/map-tabular-keys","owner":"vweevers","description":"Transform the keys of a tabular object stream","archived":false,"fork":false,"pushed_at":"2015-05-30T15:39:15.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T21:39:06.557Z","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/vweevers.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":"2015-05-30T12:36:27.000Z","updated_at":"2015-05-30T15:36:39.000Z","dependencies_parsed_at":"2022-06-27T03:27:24.290Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/map-tabular-keys","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/vweevers%2Fmap-tabular-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmap-tabular-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmap-tabular-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmap-tabular-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/map-tabular-keys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237436,"owners_count":20745348,"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-10-16T14:56:42.757Z","updated_at":"2025-03-29T20:15:36.424Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# map-tabular-keys\r\n\r\n**Transform the keys of a tabular object stream with a map function. Because the data is assumed to be tabular, only the keys of the first row are mapped. The resulting keys are then used for all rows.**\r\n\r\n[![npm status](http://img.shields.io/npm/v/map-tabular-keys.svg?style=flat-square)](https://www.npmjs.org/package/map-tabular-keys) [![Travis build status](https://img.shields.io/travis/vweevers/map-tabular-keys.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/map-tabular-keys) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/map-tabular-keys.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/map-tabular-keys) [![Dependency status](https://img.shields.io/david/vweevers/map-tabular-keys.svg?style=flat-square)](https://david-dm.org/vweevers/map-tabular-keys)\r\n\r\n## example\r\n\r\n```js\r\nvar map    = require('map-tabular-keys')\r\n  , snake  = require('snake-case')\r\n  , from   = require('from2-array')\r\n  , concat = require('concat-stream')\r\n\r\nfrom.obj([\r\n  { 'column a': 3, columnB: 0.2 },\r\n  { 'column a': 4, columnB: 0.3, ignored: true }\r\n])\r\n\r\n.pipe( map(snake) )\r\n.pipe( concat(console.log.bind(console)) )\r\n```\r\n\r\nThe output would be:\r\n```js\r\n[\r\n  { column_a: 3, column_b: 0.2 },\r\n  { column_a: 4, column_b: 0.3 }\r\n]\r\n```\r\n\r\n## api\r\n\r\n### `map([options], mapFunction)`\r\n\r\n`mapFunction` receives a single argument, for every key of the first row. If it returns an empty string or anything other than a string, the key is ignored (i.e., not included in the emitted objects).\r\n\r\n```js\r\nmap(function(key) {\r\n  if (key === 'useless') return false\r\n  return key.toUpperCase()\r\n})\r\n```\r\n\r\nOptions:\r\n\r\n- `defaultValue: mixed` (default is `0`): fallback to use for `null` and `undefined` values\r\n- `bare: boolean` (default is `false`): whether to emit bare objects (created with `Object.create(null)`) or plain objects\r\n\r\n## install\r\n\r\nWith [npm](https://npmjs.org) do:\r\n\r\n```\r\nnpm install map-tabular-keys\r\n```\r\n\r\n## license\r\n\r\n[MIT](http://opensource.org/licenses/MIT) © [Vincent Weevers](http://vincentweevers.nl)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fmap-tabular-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fmap-tabular-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fmap-tabular-keys/lists"}