# @samtietjen/mapped-classes

> Convert objects into class names

Latest version **1.3.1** (published 2018-12-10) · 0 weekly downloads

## Install

```sh
npm install @samtietjen/mapped-classes
pnpm add @samtietjen/mapped-classes
yarn add @samtietjen/mapped-classes
bun add @samtietjen/mapped-classes
```

## 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 | 1.3.1 |
| Published | 2018-12-10 |
| First published | 2018-06-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | samtietjen |

## Links

- npm: https://www.npmjs.com/package/@samtietjen/mapped-classes
- Repository: https://github.com/samtietjen/mapped-system
- Homepage: https://github.com/samtietjen/mapped-system#readme
- Issues: https://github.com/samtietjen/mapped-system/issues
- npm.io page: https://npm.io/package/@samtietjen/mapped-classes

## Recent versions

- 1.3.1 (latest) — 2018-12-10
- 1.3.0 — 2018-10-08
- 1.2.1 — 2018-09-25
- 1.2.0 — 2018-09-25
- 1.1.1 — 2018-09-24
- 1.1.0 — 2018-08-07
- 1.0.3 — 2018-06-05
- 1.0.2 — 2018-06-04
- 1.0.11 — 2018-06-04
- 1.0.1 — 2018-06-04
- 1.0.0 — 2018-06-03

## README

# Mapped Classes
Convert objects into consistent class name strings. 

## Installation
```shell
npm i @samtietjen/mapped-classes --save
```

## Usage
```js
import createMapper from '@samtietjen/mapped-classes';

const mapper = createMapper({
  breakpoints: [null, 'md', 'lg'],
  mappings: { fontSize: 'font-size', padding: 'p' },
  getter: ({ breakpoint, root, value }) => [breakpoint, root, value]
    .filter(x => x && value !== false || x === 0)
    .join('-')
});
 
const classes = mapper({ 
  fontSize: 1,
  padding: [1, 2, 3]
}); 

// 'font-size-1 p-1 md-p-2 lg-p-3'
```

## License
MIT © [Sam Tietjen](https://samtietjen.com)

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