🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

cleanify

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cleanify

strip single/multiline comments

0.0.4
latest
70

Supply Chain Security

100

Vulnerability

80

Quality

76

Maintenance

100

License

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Version published
Weekly downloads
7
-22.22%
Maintainers
1
Weekly downloads
 
Created

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));

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