# props-replace

> Applies String.replace in every Object's prop that contains the substring. It can be shallow copied or full cloned.

Latest version **0.0.3** (published 2018-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install props-replace
pnpm add props-replace
yarn add props-replace
bun add props-replace
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-12-10 |
| First published | 2018-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Lucas Gomes |
| Maintainers | lmoa |
| Keywords | props, replace, String.replace, Object, properties |

## Links

- npm: https://www.npmjs.com/package/props-replace
- Repository: https://DREZZ3R@github.com/DREZZ3R/props-replace
- npm.io page: https://npm.io/package/props-replace

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.0.3 (latest) — 2018-12-10
- 0.0.2 — 2018-12-07
- 0.0.1 — 2018-12-07

## README

# props-replace
Applies String.replace in every Object's prop's name that contain the substring. It can be shallow copied or full cloned.

````javascript
propsReplace(obj, searchValue, replaceValue, clone)
````

 - `obj` Object - where we will search for the props that you want to replace
 - `searchValue` String - Will check for props that contain the searchValue
 - `replaceValue` String - Value that will replace the `searchValue` in props
 - `clone=true` Boolean - Clones the `obj` to prevent mutation.
 

## How to use it
````javascript
var propsReplace = require("props-replace");

var testObj = {
	"fullDocument._id": "123",
  $or: [
  	{
    	"fullDocument.name": "Jotaro",
      $and: [
      	{"fullDocument.shout": "ORA ORA ORA!!"},
        {"fullDocument.catchphrase": "Yare Yare Daze"}
      ]
    },
    {
    	"fullDocument.dio": "WRYYYYY!"
    }
  ]
}

var propsWithoutFullDocument = propsReplace(testObj, "fullDocument.", "");
````

Now we have a new object with the following props:
````
{
  "_id":"123"
  "$or":[
    {
      "name":"Jotaro"
      "$and":[
        {
          "shout":"ORA ORA ORA"
        },
        {
          "catchphrase":"Yare Yare Daze"
        }
      ],
    },
    {
      "dio":"WRYYYYY!"
    }
  ],
  
}
````

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