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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tojs

v1.2.2

Published

Convert between plain text, javascript strings, and document.write() statements.

Downloads

3

Readme

tojs

Project Page

Github Page

Description

tojs lets you convert between plain text, javascript strings, and document.write() statements.

It's original purpose, was to read in an .html file, and output it as a series of document.write() statements. This is useful when creating bookmarklets. You can code your .html page, then run tojs on it. Now all your bookmarklet has to do is include a script tag that points to the file you created with tojs.

Since version 1.2.0, tojs was converted to a node.js project, and now supports a few different input/output formats. To see the new options, check out the Usage and Options sections below.

Installation

npm install -g tojs

Usage

tojs [options] <input_filenames>
tojs [options] <input_filenames> > <output_filename>
echo -e "one\ntwo\nthree" | tojs [options]

Options

-h, --help           output usage information
-v, --version        output the version number
-i, --input [type]   The type of input [plain|js|jsvar|docwrite]
-o, --output [type]  The type of input [plain|js|jsvar|docwrite]
-n, --name [name]    If output is "jsvar", this is the variable name
--oneline            Force output to be on one line only
--single-quotes      Use single-quotes instead of double-quotes for output
--no-var             var keyword will not be included in output
--no-open            document.open() will not be included in output
--no-close           document.close() will not be included in output

Version History

v1.2.0 (Released December 27, 2012)

  • converting to a node.js project so installation instructions have changed

  • command line options have changed

  • now supports the following input/output types:

    • plain

    • js

    • jsvar

    • docwrite

  • can now pipe data from stdin or use a list of files as input (similar to the unix cat command)

v1.1.0 (Released November 5, 2012)

  • fixing formatting of help text

  • adding 2 new command line options

    • -o | --no-open -- don't print the document.open() statement

    • -c | --no-close -- don't print the document.close() statement

v1.0.0 (Released November 4, 2012)

  • Initial Release