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

domb

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domb

DOM Builder, a simple cross-platform DOM generation library

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

domb

NPM Version Node.js CI Coverage Status NPM

DomB [domby] is a DOM Builder.

This is a simple cross-platform DOM generation library. It is a handy tool for creating templates and testing.

Features

  • Convenient JS-compatible syntax
  • Cross-platform, works both in NodeJS and in the browser
  • Support for ES2015 named imports
  • Small footprint, 1KB after gzip

Installation

npm install domb

Usage

ES2015

import { div } from 'domb'

CommonJS

const { div } = require('domb')

Browser

<script src="https://unpkg.com/domb@latest/dist/domb.js"></script>
<script>
  const { div } = domb
</script>

Example

DomB can be used both in NodeJS and in the browser:

import { form, label, input, button } from 'domb'

const node = form({
  action : 'https://google.com/search',
  target : '_blank',
  children : [
    label([
      'Search ',
      input({ type : 'search', name : 'q' }),
    ]),
    button('Find'),
  ],
})

// browser
document.body.append(node)

// nodejs
app.get('/form', (req, res) => res.send(node.outerHTML))

The node variable is a DOM structure with the appropriate markup:

<form action=//google.com/search target=_blank>
    <label>
        Search 
        <input type=search name=q>
    </label>
    <button>Find</button>
</form>

License

The MIT License (MIT)

Keywords

FAQs

Package last updated on 01 Jun 2022

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