🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

create-html-element

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

create-html-element

Create a HTML element string

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1.8K
20.26%
Maintainers
1
Weekly downloads
 
Created
Source

create-html-element Build Status

Create a HTML element string

Install

$ npm install create-html-element

Usage

const createHtmlElement = require('create-html-element');

createHtmlElement({
	name: 'h1',
	attributes: {
		class: 'unicorn',
		rainbow: true,
		horse: false,
		number: 1,
		multiple: ['a', 'b']
	},
	value: '🦄'
});
//=> '<h1 class="unicorn" rainbow number="1" multiple="a b">🦄</h1>'

API

createHtmlElement(options)

options

Type: Object

name

Type: string
Default: div

HTML tag name.

attributes

Type: Object

HTML tag attributes.

value

HTML tag value.

  • stringify-attributes - Turn an object into a string of HTML attributes

License

MIT © Sindre Sorhus

Keywords

html

FAQs

Package last updated on 17 Jun 2017

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