get-tag
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

get-tag

Create HTML tag strings on the fly.

Installation

Install the package from npm:

npm install get-tag

Usage

const getTag = require('get-tag');

console.log(getTag('title', 'Some Title'));
// <title>Some Title</title>

console.log(getTag('a', 'Some Link', {href: 'foo.com'}));
// <a href="foo.com">Some link</a>

console.log(getTag('meta', null, {name: 'author', content: 'foo'}));
// <meta name="author" content="foo">

If the provided HTML tag name is included in the void-elements list, then selfClosing will be set to true.

Package Sidebar

Install

npm i get-tag

Weekly Downloads

211

Version

0.1.10

License

MIT

Unpacked Size

5.29 kB

Total Files

5

Last publish

Collaborators

  • tannerdolby