# field-mapper

> A field-mapping engine for managing field-to-property relationships and mapping objects.

Latest version **1.2.0** (published 2021-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install field-mapper
pnpm add field-mapper
yarn add field-mapper
bun add field-mapper
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-04-22 |
| First published | 2020-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Aaron Huggins |
| Maintainers | ahuggins_nhs |
| Keywords | field, mapper, engine, property |

## Links

- npm: https://www.npmjs.com/package/field-mapper
- Repository: https://github.com/ahuggins-nhs/field-mapper
- Homepage: https://github.com/ahuggins-nhs/field-mapper#readme
- Issues: https://github.com/ahuggins-nhs/field-mapper/issues
- npm.io page: https://npm.io/package/field-mapper

## Recent versions

- 1.2.0 (latest) — 2021-04-22
- 1.1.0 — 2021-01-16
- 1.0.0 — 2020-10-29
- 0.1.0 — 2020-08-18

## README

# field-mapper

A field-mapping engine for managing field-to-property relationships and mapping objects. Provides a simple dictionary based on `Map` to take an array of field-map-like objects, and supports output of modified field-maps as an Azure-like table row. Full support for Typescript included.

## Usage

Install via [NPM](https://www.npmjs.com/package/field-mapper) and require in your project. There is also an ESM export, for use with browser or Deno.

```js
const { FieldMapper } = require('field-mapper')
const fieldData = [{ fieldName: 'foo', propertyName: 'bar', objectName: 'FooBar' }]
const myMapper = new FieldMapper(fieldData)
const unmappedObj = { foo: 'hello, world!' }
const mappedObj = Object.create(null)

for (const [key, value] of Object.entries(unmappedObj)) {
  mappedObj[myMapper.getObjectMap('FooBar').getPropertyName(key)] = value
}

console.log(mappedObj.bar) // Expected output: hello, world!
```

---
_Source: https://npm.io/package/field-mapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
