npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

coffee-util

v1.0.7

Published

Coffee-Utils contains utils that help you better convert coffeescripts to javascripts.

Downloads

15

Readme

Introduction

Coffee-Utils contains utils that help you better convert coffeescripts to javascripts.

It seems that coffeescript compiler (at least at the year of 2013) will strip out single line comments started with #.

Yes, it can keep the block comments ###...###.

However, not everybody prefer coffeescript syntax. Sometimes, one may prefer to use the converted .js file or read the converted .js file, especially for some java/javascript programmers, they may prefer the .js syntax while browsing/using the source code.

In those cases, lacking of the original source code may be useful, as people said from

https://github.com/souparno/coffee-util/issues

"For this reason I'd find it useful to have certain single-line CoffeeScript comments appear as single-line JavaScript comments in the compiled output. Perhaps something like¡­"

"Please add single line comments to the compiled code. Even if you support some limited syntax of it its fully acceptable. Just support some easy common cases, thats it!

I haven't found old discussions about it, so I just tell what I think why its so important: I am at the point to think about to use cs. To ensure my code will not die if cs will die I need to be sure that generated javascript can be used instead. If all the comments gets dropped away, generated js is only half worth of its original, so I think without single line comments I am LOCKED to coffee script"

"Also people who are not familiar with cs reading generated code without single line comments is much harder."

Also it seems that there might be some difficulties in fixing this immediately in the current version of coffee-script: "To summarize: We'd love to do it, but we can't figure out how to parse 'em in order to preserve comment behavior, even in theory." "Sticking comments to the nearest tokens is easy. Propagating those to AST/compilation is the hard part."

So, here is an alternative way which allows one to compile the coffeescript but keep the original single line comments - anything after # will be replace to // in the output js file.

Install

$ npm install coffee-util

Usage

	node coffee2js.js FILE1.coffee [ FILE2.coffee .... ]
		or
	coffee2js FILE1.coffee [ FILE2.coffee .... ]
	

How it is implemented

Rather than dig into the original coffee-script compiler, since current coffee-script compiler supports block comments, so I use a clever approach - pre-process the coffee script and replace single line comments into block comments and feed into the coffeescript compiler, then post-process it to generate the final output. Isn't that interesting ?!

TODO

More test cases like edge cases or something like /* */ inside String