Replace the comments in a string.
npm install replace-comments-x href="https://travis-ci.org/Xotic750/replace-comments-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/replace-comments-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/replace-comments-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/replace-comments-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/replace-comments-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/replace-comments-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/replace-comments-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/replace-comments-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
Replace the comments in a string.
This method replaces comments in a string.
Kind: Exported function
Returns: string - The new string with the comments replaced.
Throws:
- TypeError If string is null or undefined or not coercible.
- TypeError If replacement is not coercible.
| Param | Type | Description |
| ------------- | ------------------- | --------------------------------------- |
| string | string | The string to be stripped. |
| [replacement] | string | The string to be used as a replacement. |
Example
``js
import replaceComments from 'replace-comments-x';
console.log(replaceComments('test; / test /', '')); // 'test;'
console.log(replaceComments('test; // test', '')); // 'test;'
``