New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cleanify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cleanify

strip single/multiline comments

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Cleanify

Nodejs module for stripping single/multiline comments from string/s.

Install:

npm install cleanify

To run tests enter module dir and run:

node test.js

Usage:

var fs = require('fs');
var Cleanify = require('cleanify');

/*
 * Choose literal string skip type:
 *   SINGLE: skip only single quoted strings -> 'b//la'
 *   DOUBLE: skip only double quoted strings -> "b//a"
 *   MULTI: skip both string types -> "b//la" 'b//a'
 */
var cleanify = new Cleanify(Cleanify.SINGLE);
var cleanify = new Cleanify(Cleanify.DOUBLE);
var cleanify = new Cleanify(Cleanify.MULTI);

// Multi is default
var cleanify = new Cleanify();

var lol = fs.readFileSync('./test/lol.js', 'utf8');

// One argument -> return stripped string
var string = cleanify.strip(lol);

// require() can load .json but comments are not allowed
var wtf = fs.readFileSync('./test/wtf.json', 'utf8');
var oh = fs.readFileSync('./test/oh.txt', 'utf8');

// More then one arguments -> return array of stripped strings
var array = cleanify.strip(lol, oh, wtf);

console.log('string: ' + string);
console.log('array: ' + JSON.stringify(array));

Keywords

FAQs

Package last updated on 05 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc