{"id":25830885,"url":"https://github.com/lab5e/data-mapper-chain","last_synced_at":"2026-06-10T08:31:00.742Z","repository":{"id":57126078,"uuid":"386641076","full_name":"lab5e/data-mapper-chain","owner":"lab5e","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-19T05:38:38.000Z","size":2255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-08T18:53:23.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lab5e.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":"2021-07-16T13:09:09.000Z","updated_at":"2021-07-19T05:37:39.000Z","dependencies_parsed_at":"2022-08-31T08:21:00.676Z","dependency_job_id":null,"html_url":"https://github.com/lab5e/data-mapper-chain","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/lab5e/data-mapper-chain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Fdata-mapper-chain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Fdata-mapper-chain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Fdata-mapper-chain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Fdata-mapper-chain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lab5e","download_url":"https://codeload.github.com/lab5e/data-mapper-chain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Fdata-mapper-chain/sbom","scorecard":{"id":576321,"data":{"date":"2025-08-11","repo":{"name":"github.com/lab5e/data-mapper-chain","commit":"c17335f2814d0fc70eee54ed46848406b7b02c26"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/18 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/doc.yml:1","Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/size.yml:1","Info: no jobLevel write permissions found"],"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/doc.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/doc.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/doc.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/doc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/size.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/size.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/size.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/lab5e/data-mapper-chain/size.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"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":"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: Apache License 2.0: 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 'main'"],"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":"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":"Vulnerabilities","score":0,"reason":"47 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-20T17:53:24.269Z","repository_id":57126078,"created_at":"2025-08-20T17:53:24.269Z","updated_at":"2025-08-20T17:53:24.269Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34144679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":"2025-02-28T19:34:32.519Z","updated_at":"2026-06-10T08:31:00.713Z","avatar_url":"https://github.com/lab5e.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data mapper chain\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Documentation](https://img.shields.io/badge/docs-tsdoc-blue.svg)](https://lab5e.github.io/data-mapper-chain/)\n[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@lab5e/data-mapper-chain.svg)](#tiny)\n[![data-mapper-chain](https://img.shields.io/npm/v/@lab5e/data-mapper-chain.svg)](https://www.npmjs.com/package/@lab5e/data-mapper-chain)\n[![CI](https://github.com/lab5e/data-mapper-chain/actions/workflows/main.yml/badge.svg)](https://github.com/lab5e/data-mapper-chain/actions/workflows/main.yml)\n\nSimple data mapper library meant to be run in browser to ease data transformation for IoT devices in JS.\n\n## Example: Simple in browser\n\n```html\n\u003cbody\u003e\n  ...\n  \u003cscript src=\"https://cdn.jsdelivr.net/npm/@lab5e/data-mapper-chain\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    var myMapper = dmc\n      .create()\n      .chunk({ start: 2, size: 2 })\n      .hexToInt();\n\n    console.log(myMapper.mapData(\"babe\")); // Prints 190\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n\n### Codepen example\n\nPlay around with this [Codepen pen](https://codepen.io/pkkummermo/pen/MLgVPO?editors=1010) for a real life example usage of\nthe data-mapper-chain.\n\n## Example: In ts\n\nYou must first install the dependency\n\n```bash\nnpm i @lab5e/data-mapper-chain\n```\n\n### Using shorthand\n\n```ts\nimport { DataMapperChain } from \"@lab5e/data-mapper-chain\";\n\n// Create a chain and add mappers\nconst dataMapperChain = new DataMapperChain()\n  .chunk({\n    start: 50,\n    size: 4,\n  })\n  .hexToInt();\n\n// Raw data from device\nconst deviceData: string = `47eee3803e3a8c713f8daf7242fc6666423c28c04111d84000024b00a3030c261b010b91d3`;\n\n// Run mapper\ndataMapperChain.mapData(deviceData); // prints 587\n```\n\n### Instanciating mappers directly\n\n```ts\nimport { DataMapperChain, Mappers } from \"@lab5e/data-mapper-chain\";\n\n/**\n * We know that on byte 25 there is 2 bytes of data which is a hex encoded uint16\n * We solve this by doing the following:\n */\n\n/**\n * Create a Chunk mapper\n */\nconst chunk = Mappers.chunk({\n  start: 50,\n  size: 4,\n});\n\n/**\n * Create a HexToInt mapper\n */\nconst hexToInt = Mappers.hexToInt();\n\n// Create a DataMapperChain\nconst dataMapperChain = new DataMapperChain();\n\n// Add mappers\ndataMapperChain.addMapper(chunk);\ndataMapperChain.addMapper(hexToInt);\n\n// Raw data from device\nconst deviceData: string = `47eee3803e3a8c713f8daf7242fc6666423c28c04111d84000024b00a3030c261b010b91d3`;\n\n// Run mapper\ndataMapperChain.mapData(deviceData); // prints 587\n```\n\n## Available mappers\n\nAll mappers have fully optional configurations, meaning if no configuration is provided it will fallback to sane defaults. It also supports partly providing parameters if you want to just override one option of the mapper.\n\n### Base64\n\nSupports encoding and decoding of base64 input.\n\n[Configuration](./tutorials/base64-tutorial.md)\n\n### Chunk\n\nTake a chunk of the input and return it.\n\n[Configuration](./tutorials/chunk-tutorial.md)\n\n### FromJSON\n\nTraverse a JSON struct and return value.\n\n[Configuration](./tutorials/fromJson-tutorial.md)\n\n### HexToFloat\n\nTake a hex input and convert it to a float.\n\n[Configuration](./tutorials/hexToFloat-tutorial.md)\n\n### HexToInt\n\nTake a hex input and convert it to an int.\n\n[Configuration](./tutorials/hexToInt-tutorial.md)\n\n### Offset\n\nTake an input and offset it by a positive or negative value.\n\n[Configuration](./tutorials/offset-tutorial.md)\n\n## History\n\n### What\n\nThe main workhorse is the `DataMapperChain` which serves a couple of purposes. It contains the different mappers you want to use in your \"chain\" of mappers and has functions to apply all mappers on a data set. It also allows for serializing configuration of both the chain and the added mappers. This serialized version can again be loaded directly into a new `DataMapperChain` which is now fully configured with the saved params.\n\n### Why\n\nI found myself fiddling with a lot of IoT data recently and a need to graph it easily. The libs which which I found either relied heavily on `eval` or didn't have any typings. I put together this lib which is modular and pluggable and hopefully solves someones problem alongside mine.\n\n### Pluggable\n\nWhile the lib provide a decent amount of mappers as a starting point, I know I don't cover every use case out there.\n\n### Tiny\n\nThe library relies mostly on native functions meaning it shouldn't get too big. More complex mappers should be application specific and be a part of the application which imports the library.\n\n## Development\n\nWe use [TSDX](https://github.com/formium/tsdx) for pretty much everything, and most npm scripts just proxy to `tsdx`.\n\n### Run single build\n\nUse `npm run build`.\n\n### Run tests\n\nTo run tests, use `npm test`.\n\n## Configuration\n\nCode quality is set up with `prettier`, `husky`, and `lint-staged`.\n\n### Jest\n\nJest tests are set up to run with `npm test`.\n\n#### Watch mode\n\nTo run in watch mode run `npm run test:watch`\n\n#### Coverage\n\nTo see coverage run `npm run test:coverage`\n\n### Bundle Analysis\n\n[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.\n\n### Rollup\n\nWe us TSDX which uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.\n\nWe create UMD, CommonJS, and JavaScript Modules in our build. The appropriate paths are configured in `package.json` and `dist/index.js`\n\n### TypeScript\n\nWe use TypeScript for everything, giving us types for all the published packages.\n\n## Continuous Integration\n\n### GitHub Actions\n\n- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix\n- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)\n\n## Publishing to NPM\n\nWe use `np`. To publish a new version, write `npx np` and follow the interactive tutorial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Fdata-mapper-chain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flab5e%2Fdata-mapper-chain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Fdata-mapper-chain/lists"}