Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-tag

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-tag - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

5

dist/get-tag.js

@@ -9,7 +9,8 @@ "use strict";

* @param {string} tag HTML tag name.
* @param {Attributes} attributes An object representing attribute key/value pairs.
* @param {string} textContent Text content for the element.
* @param {Attributes} attributes Object representing attribute key/value pairs.
* @param {boolean} selfClosing Boolean representing a self closing element. Default: false
* @return {string} A string representing the constructed HTML element.
*/
module.exports = (tag, textContent = "", attributes, isSelfClosing = false) => {
module.exports = (tag, textContent, attributes, isSelfClosing = false) => {
const selfClosingTags = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"];

@@ -16,0 +17,0 @@ tag = tag.toLowerCase();

{
"name": "get-tag",
"version": "0.1.0",
"description": "Create an HTML tag string on the fly.",
"version": "0.1.1",
"description": "Create HTML tag strings on the fly.",
"main": "./dist/get-tag.js",

@@ -16,2 +16,3 @@ "scripts": {

],
"types": "./dist/get-tag.d.ts",
"repository": {

@@ -18,0 +19,0 @@ "type": "git",

24

README.md
# get-tag
Create an HTML tag string on the fly.
Create HTML tag strings on the fly.

@@ -7,3 +7,3 @@ ## Installation

```js
```bash
npm install get-tag

@@ -16,4 +16,4 @@ ```

getTag("meta", null, {name: "author", content: "foo"});
// <meta name="author" content="foo">
getTag("title", "Some Title");
// <title>Some Title</title>

@@ -23,6 +23,18 @@ getTag("a", "Some Link", {href: "foo.com"});

getTag("title", "Some Title");
// <title>Some Title</title>
getTag("meta", null, {name: "author", content: "foo"});
// <meta name="author" content="foo">
```
### Details
```js
/**
* @param {string} tag HTML tag name.
* @param {string} textContent Text content for the element.
* @param {Attributes} attributes Object representing attribute key/value pairs.
* @param {boolean} selfClosing Boolean representing a self closing element. Default: false
* @return {string} A string representing the constructed HTML element.
*/
getTag(tag, textContent, attributes, selfClosing);
```
## License

@@ -29,0 +41,0 @@ MIT

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