Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/lib/utils.js

Issue 125733002: Add vulcanize to tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/lib/utils.js
diff --git a/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/lib/utils.js b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/lib/utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..54afaaed69dd84e73e5d8e4fa185270cdc6aebc4
--- /dev/null
+++ b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/lib/utils.js
@@ -0,0 +1,42 @@
+/**
+ * Module Dependencies
+ */
+var entities = require('entities');
+
+/**
+ * HTML Tags
+ */
+
+var tags = { tag: true, script: true, style: true };
+
+/**
+ * Check if the DOM element is a tag
+ *
+ * isTag(type) includes <script> and <style> tags
+ */
+
+exports.isTag = function(type) {
+ if (type.type) type = type.type;
+ return tags[type] || false;
+};
+
+/**
+ * Convert a string to camel case notation.
+ * @param {String} str String to be converted.
+ * @return {String} String in camel case notation.
+ */
+
+exports.camelCase = function(str) {
+ return str.replace(/[_.-](\w|$)/g, function(_, x) {
+ return x.toUpperCase();
+ });
+};
+
+/**
+ * Expose encode and decode methods from FB55's node-entities library
+ *
+ * 0 = XML, 1 = HTML4 and 2 = HTML5
+ */
+
+exports.encode = function(str) { return entities.encode(String(str), 0); };
+exports.decode = function(str) { return entities.decode(str, 2); };

Powered by Google App Engine
This is Rietveld 408576698