# ts-rplc

> Utility tool for replacing properties in an object

Latest version **0.0.7** (published 2022-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-rplc
pnpm add ts-rplc
yarn add ts-rplc
bun add ts-rplc
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2022-11-29 |
| First published | 2022-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jarkko Skyttälä |
| Maintainers | jarkkosk |
| Keywords | typescript, replace, test, deterministic, fp-ts, functional, utils, utilities, fp, point-free, curried, pure |

## Links

- npm: https://www.npmjs.com/package/ts-rplc
- Repository: https://github.com/jarkkoSky/ts-rplc
- Homepage: https://github.com/jarkkoSky/ts-rplc#readme
- Issues: https://github.com/jarkkoSky/ts-rplc/issues
- npm.io page: https://npm.io/package/ts-rplc

## Dependencies (1)

- [fp-ts](https://npm.io/package/fp-ts.md) ^2.13.1

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2022-11-29
- 0.0.6 — 2022-11-29
- 0.0.5 — 2022-11-29
- 0.0.4 — 2022-11-29
- 0.0.3 — 2022-11-24
- 0.0.2 — 2022-11-24
- 0.0.1 — 2022-11-24

## README

[![CI](https://github.com/jarkkoSky/ts-rplc/actions/workflows/ci.yml/badge.svg)](https://github.com/jarkkoSky/ts-rplc/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/jarkkoSky/ts-rplc/branch/master/graph/badge.svg?token=OL4MLK8WK6)](https://codecov.io/gh/jarkkoSky/ts-rplc)
[![npm version](https://badge.fury.io/js/ts-rplc.svg)](https://badge.fury.io/js/ts-rplc)

# TS-RPLC

ts-rplc is a utility tool to replace properties in an object.
The catch is that this tool replaces properties anywhere in the object. It can handle complex structure including arrays etc. <b>TL;DR replace property anywhere in an object</b>

## Motivation

Motivation for creating this tool came from the need to sometimes make test data deterministic. Rather than always write a sketchy solution to this trivial task, I implemented a simple package utilizing fp-ts

## Install

`npm install ts-rplc --save`

## Usage

All exported functions are curried

### <b>replaceProperty</b>

`string -> string -> Object | Object[] -> Object | Object[]`

```javascript
import { replaceProperty } from 'ts-rplc';

const obj = {
  test: 123,
};

/**
 * 'test' => property name to search
 * 'NewValue' => new value for property
 * 'obj' => object or object array to transform
 * */
const result = replaceProperty('test')('NewValue')(obj);

const expectedResult = {
  test: 'NewValue',
};

// More examples can be found in src/replace-property/index.test.ts
```

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