# pc__replace_string_in_js

> This is plugin for nmp-package "Post-Compression". He`s searching and replaces long string on short string, in the JS code.

Latest version **0.0.1** (published 2016-01-27) · 0 weekly downloads

## Install

```sh
npm install pc__replace_string_in_js
pnpm add pc__replace_string_in_js
yarn add pc__replace_string_in_js
bun add pc__replace_string_in_js
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-01-27 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexey Bakhirev |
| Maintainers | bakhirev |
| Keywords | plugin, post compression, gulp, grunt, build, minify, optimization, js, css, html, javascript, html5, uglifyjs, uglifycss, google compiler, searching |

## Links

- npm: https://www.npmjs.com/package/pc__replace_string_in_js
- Repository: https://github.com/bakhirev/pc__replace_string_in_js
- Homepage: https://github.com/bakhirev/pc__replace_string_in_js#readme
- Issues: https://github.com/bakhirev/pc__replace_string_in_js/issues
- npm.io page: https://npm.io/package/pc__replace_string_in_js

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.1 (latest) — 2016-01-27

## README

Replace string in JS
========================

This is plugin for nmp-package "[Post-Compression](https://github.com/bakhirev/post_compression)".  
He`s searching and replaces long string on short string, in the JS code.

#### An example of using: ####
```js
var replaceStringInJS = require("pc__replace_string_in_js");

gulp.src("./*.js")
        replaceStringInJS()
    ], shortNames));
```

Where:  
 - shortNames - an object of type JSON with rules replace the long words to short words.
 
An example of using with parameters:
gulp.src("./*.js")
        replaceStringInJS({
            type: "events_in_js",
            prefix: "addEvent\(",
            postfix: "\)",
        })
    ], shortNames));

#### An example of the JSON object "shortNames": ####
```js
{
    "string_in_js": {              // the name of the group names
        "someLongStringA": "a",    // long string: short string
        "someLongStringB": "b"
    }
}
```

#### An example of JS code before: ####
```js
...someObject.addEvent("someLongStringA", function() {...
...someObject.triggerEvent("someLongStringB")...
```

#### An example of JS code after: ####
```js
...someObject.addEvent("a", function() {...
...someObject.triggerEvent("b")...
```

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