tuijs-meta 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/lib/tuiMeta.js +5 -5
package/README.md
CHANGED
|
@@ -126,4 +126,4 @@ tuiMeta(siteData['*']);
|
|
|
126
126
|
2. The function then validates that the 'meta' key exists.
|
|
127
127
|
- If the 'meta' key exists, the function then validates that the value of the 'meta' key is an Array, throwing an error if it is not.
|
|
128
128
|
-If the 'meta' key value is an Array, then the function attempts to update the document meta tags with the 'meta' key Array data. As as reminder this Array consists of Objects, each representing a single meta tag. Within each Object, there is a set as many or as few key/value pairs as needed, each representing a single meta tag attribute and its value.
|
|
129
|
-
- If the 'meta' key DOES NOT exists, no error is generated and the function just
|
|
129
|
+
- If the 'meta' key DOES NOT exists, no error is generated and the function just moves on.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tuijs-meta",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "A JavaScript utility that manipulates meta data tags based on provided data.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "TechTB",
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
"repository": "github:TechTB-OpenSource/tuijs-meta",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"tuijs-util": "^1.
|
|
11
|
+
"tuijs-util": "^1.4.9"
|
|
12
12
|
}
|
|
13
13
|
}
|
package/src/lib/tuiMeta.js
CHANGED
|
@@ -42,7 +42,7 @@ export function metaUpdateHead(data) {
|
|
|
42
42
|
}
|
|
43
43
|
return;
|
|
44
44
|
} catch (er) {
|
|
45
|
-
throw new Error(er.message);
|
|
45
|
+
throw new Error(`TUI Meta Error: ${er.message}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -50,8 +50,7 @@ export function metaUpdateHead(data) {
|
|
|
50
50
|
* Creates a new meta tag with the provided meta data.
|
|
51
51
|
* Any existing meta tag with any matching attribute key/value pair, excluding 'content' keys, will be removed.
|
|
52
52
|
* @param {MetaDataArray} data - The meta data for the site or route.
|
|
53
|
-
* @returns {
|
|
54
|
-
* @throws {Error} - If the provided data is not an object.
|
|
53
|
+
* @returns {boolean} - Returns boolean indicating the success of the meta update.
|
|
55
54
|
*/
|
|
56
55
|
export function metaUpdateTag(data) {
|
|
57
56
|
try {
|
|
@@ -85,9 +84,10 @@ export function metaUpdateTag(data) {
|
|
|
85
84
|
elmMeta.setAttribute(key, data[key]);
|
|
86
85
|
});
|
|
87
86
|
document.head.appendChild(elmMeta);
|
|
88
|
-
return;
|
|
87
|
+
return true;
|
|
89
88
|
} catch (er) {
|
|
90
|
-
|
|
89
|
+
console.error(`TUI Meta Error: ${er.message}`);
|
|
90
|
+
return false;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|