# serialize-js-model

> Utility for transforming one set of JS objects into another

Latest version **2.0.1** (published 2018-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install serialize-js-model
pnpm add serialize-js-model
yarn add serialize-js-model
bun add serialize-js-model
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-05-23 |
| First published | 2018-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | victor stone |
| Maintainers | victor-stone |
| Keywords | functional, serialize, data-last |

## Links

- npm: https://www.npmjs.com/package/serialize-js-model
- Repository: https://github.com/victor-stone/serialize
- Homepage: https://www.npmjs.com/package/serialize-js-model
- Issues: https://github.com/victor-stone/serialize/issues
- npm.io page: https://npm.io/package/serialize-js-model

## Recent versions

- 2.0.1 (latest) — 2018-05-23
- 2.0.0 — 2018-05-23
- 1.1.1 — 2018-05-23
- 1.1.0 — 2018-05-08

## README

# About
A single mechanism for objects and arrays that convert butt-ugly, ancient crufty data shapes into beautifully semantically rich objects of desire.

Hot Buzzwords: functional, currying, data-last

# Install

`npm i serialize-js-model`

# Usage

````javascript
import { mapper } from 'serialize-js-model'

const myMapper = 
  ({ ID: id, User: userId }) =>
    ({ id, userId, context: `imported` })

const curriedMapper = mapper(myMapper)

fetch(url)
  .then(curriedMapper)
  .then(({ id, userId, context}) => ...)

// works on single objects

const oldObject = {
  ID: 123,
  User: 984
}

const newObject = curriedMapper(oldObject)

// also arrays 

const oldRecords = [
  { ID: 123, User: 999 },
  { ID: 124, User: 998 },
  { ID: 125, User: 996 },
  { ID: 126, User: 995 }
]

const newRecords = curriedMapper(oldRecords)

````

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