Comparing version 0.1.0 to 0.1.1
@@ -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", |
# 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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4293
30
41