JSPM

  • Created
  • Published
  • Downloads 11685
  • Score
    100M100P100Q135007F
  • License MIT

Replace the comments in a string.

Package Exports

  • replace-comments-x

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (replace-comments-x) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score

replace-comments-x

Replace the comments in a string.

module.exports(string, [replacement])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

import replaceComments from 'replace-comments-x';

console.log(replaceComments('test; /* test */', '')); // 'test;'
console.log(replaceComments('test; // test', '')); // 'test;'