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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dense-parser

v1.0.2

Published

Dense.js JSON-HTML parser script

Downloads

18

Readme

DENSE JSON-to-HTML PARSER

This nodejs library parses json objects to html directly, with emmet abbreviation built in, helps increasing coding speed, reduce time messing with html

Installation

NodeJS, Deno

Just simply install the library using npm, yarn or pnpm

npm install dense-parser
yarn add dense-parser
pnpm i dense-parser

then

const dense_parser = require("dense-parser") // Of course, you can use methods directly for short

Browser

Add this to your html source

<script language="javascript" type="text/javascript" src="https://github.com/shadichy/dense-parser/raw/master/dist/parser.umd.js"></script>

or

<script language="javascript" type="text/javascript" src="https://github.com/shadichy/dense-parser/raw/master/dist/parser.iife.js"></script>

Usage

To parse an object that represents a document, just pass it to dense-parser's parse function

const htmlObject = {
    title: "This is title",
    logo: "/path/to/your/favicon.png",
    stylesheet: [
        "/path/to/style1.css", 
        "/path/to/style2.css" , 
        "/path/to/style3.css"
    ],
    script: [
        "/path/to/script1.js", 
        "/path/to/script2.js"
    ],
    _: {
        _: "This is a div inside body!"
    }
}

console.log(dense_parser.parse(htmlObject)) 

Output:

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible"content="IE=edge"/><meta name="viewport"content="width=device-width,initial-scale=1.0"/><title>This is title</title><link rel="shortcut icon"href="/path/to/your/favicon.png"type="image/png"/><meta property="og:title"content="This is title"/><meta property="og:type"content="website"/><link rel="stylesheet"href="/path/to/style1.css"><link rel="stylesheet"href="/path/to/style2.css"><link rel="stylesheet"href="/path/to/style3.css"><script language="javascript"type="text/javascript"src="/path/to/script1.js"></script><script language="javascript"type="text/javascript"src="/path/to/script2.js"></script></head><body><div>This is a div inside body!</div></body></html>

(You'll need to "beautify" it, for sure :))

To parse an object that represents a single html element, pass it to parseElement function

const elementObject = {
    tag: "span",
    id: "someRandomTag",
    class: ["dense"],
    style: {
        display: "block",
        "border-radius": "10px",
        width: "100%"
    },
    content: "div>p{This is the span content}",
    title: "get this when your hover"
}

console.log(dense_parser.parseElement(elementObject))

Output:

'<span tag="span"id="someRandomTag"style="display:block;border-radius:10px;width:100%"title="get this when your hover"class="dense"><div><p>This is the span content</p></div></span>'

(A html beautify library is recommended :))

Syntax

Element snippets

| Property | Type | Desciption | ------------- | ------------- | ----------------------------------------------------------------- | | tag | String | HTML tag | class | String, Array | Element classes | style | String, Object | Element CSS style | -, content | String, Array, Object | Element inner content, can be single element or array of children | # | String | Comment

And all other HTML element attributes inherited

Document snippets

Inherited from Element syntax with some additions

| Property | Type | Description | ------------- | ------------- | ----------------------------------------------------------------- | | title | String | Page title | desc | String | Page desciption | logo | String | URL to favicon path | preview | String | URL to preview picture (for social network) | type | String | Page type, can be website or article | lang | String | Page language | keyword | String, Array | Keywords for SEO | stylesheet | String, Array, Object | Define document stylesheet (Object) or link to external CSS paths | script | String, Array, Object | Create <script> tag that contains JavaScript code (String) or link to external JavaScript paths ()

For Dense-eco users

Execute useDense() after import

const { parse, parseElement, useDense } = require("dense-parser")

useDense()

... // Do whatever