# @anchan828/typeorm-transformers

> [TypeORM](https://github.com/typeorm/typeorm) transformers

Latest version **1.0.100** (published 2024-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @anchan828/typeorm-transformers
pnpm add @anchan828/typeorm-transformers
yarn add @anchan828/typeorm-transformers
bun add @anchan828/typeorm-transformers
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.100 |
| Published | 2024-03-17 |
| First published | 2019-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 81 |
| Author | anchan828 |
| Maintainers | anchan828 |

## Links

- npm: https://www.npmjs.com/package/@anchan828/typeorm-transformers
- Repository: https://github.com/anchan828/typeorm-helpers
- Homepage: https://github.com/anchan828/typeorm-helpers/tree/master/packages/transformers#readme
- Issues: https://github.com/anchan828/typeorm-helpers/issues
- npm.io page: https://npm.io/package/@anchan828/typeorm-transformers

## Recent versions

- 1.0.100 (latest) — 2024-03-17
- 1.0.99 — 2024-03-10
- 1.0.98 — 2024-03-03
- 1.0.97 — 2024-02-25
- 1.0.96 — 2024-02-18
- 1.0.95 — 2024-02-11
- 1.0.94 — 2024-02-04
- 1.0.93 — 2024-01-28
- 1.0.92 — 2024-01-21
- 1.0.91 — 2024-01-14
- 1.0.90 — 2024-01-07
- 1.0.89 — 2023-12-31
- 1.0.88 — 2023-12-24
- 1.0.87 — 2023-12-17
- 1.0.86 — 2023-12-10
- … 234 more at https://npm.io/package/@anchan828/typeorm-transformers/versions

## README

# @anchan828/typeorm-transformers

![npm](https://img.shields.io/npm/v/@anchan828/typeorm-transformers.svg)
![NPM](https://img.shields.io/npm/l/@anchan828/typeorm-transformers.svg)

## Description

Transformer collection for [TypeORM](http://typeorm.io)

## Installation

```bash
$ npm i --save typeorm @anchan828/typeorm-transformers
```

## Transformers

### BooleanTransformer

Transform value between integer and boolean.

```ts
@Entity()
class BooleanTransformerTest extends BaseEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @Column({
    type: "tinyint",
    width: 1,
    nullable: true,
    transformer: new BooleanTransformer(),
  })
  public bool!: boolean;
}
```

### JsonTransformer

Transform value between object and json.

Note: The JsonTransformer stores JSON as a string, not as a JSON type.

```ts
class TestJson {
  name!: string;
}
@Entity()
class JsonTransformerTest extends BaseEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @Column({
    type: "varchar",
    width: 255,
    nullable: true,
    transformer: new JsonTransformer<TestJson>({ name: "test" }),
  })
  public data!: TestJson;
}
```

### StaticFileTransformer

Transform value between data and filePath.

```ts
@Entity()
class StaticFileTransformerTest extends BaseEntity {
  @PrimaryGeneratedColumn()
  public id!: number;

  @Column({
    transformer: new StaticFileTransformer({ dirname: tmpdir() }),
    type: "varchar",
  })
  public file!: BinaryLike;
}
```

## License

[MIT](LICENSE)

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