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

Unified Diff: node_modules/vulcanize/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/rc/node_modules/strip-json-comments/strip-json-comments.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years 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: node_modules/vulcanize/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/rc/node_modules/strip-json-comments/strip-json-comments.js
diff --git a/node_modules/vulcanize/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/rc/node_modules/strip-json-comments/strip-json-comments.js b/node_modules/vulcanize/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/rc/node_modules/strip-json-comments/strip-json-comments.js
new file mode 100644
index 0000000000000000000000000000000000000000..2e7fdef27f59817ae10516d071e52123336a9193
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/rc/node_modules/strip-json-comments/strip-json-comments.js
@@ -0,0 +1,64 @@
+/*!
+ strip-json-comments
+ Strip comments from JSON. Lets you use comments in your JSON files!
+ https://github.com/sindresorhus/strip-json-comments
+ by Sindre Sorhus
+ MIT License
+*/
+(function () {
+ 'use strict';
+
+ function stripJsonComments(str) {
+ var currentChar;
+ var nextChar;
+ var insideString = false;
+ var insideComment = false;
+ var ret = '';
+
+ for (var i = 0; i < str.length; i++) {
+ currentChar = str[i];
+ nextChar = str[i + 1];
+
+ if (!insideComment && str[i - 1] !== '\\' && currentChar === '"') {
+ insideString = !insideString;
+ }
+
+ if (insideString) {
+ ret += currentChar;
+ continue;
+ }
+
+ if (!insideComment && currentChar + nextChar === '//') {
+ insideComment = 'single';
+ i++;
+ } else if (insideComment === 'single' && currentChar + nextChar === '\r\n') {
+ insideComment = false;
+ i++;
+ } else if (insideComment === 'single' && currentChar === '\n') {
+ insideComment = false;
+ } else if (!insideComment && currentChar + nextChar === '/*') {
+ insideComment = 'multi';
+ i++;
+ continue;
+ } else if (insideComment === 'multi' && currentChar + nextChar === '*/') {
+ insideComment = false;
+ i++;
+ continue;
+ }
+
+ if (insideComment) {
+ continue;
+ }
+
+ ret += currentChar;
+ }
+
+ return ret;
+ }
+
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = stripJsonComments;
+ } else {
+ window.stripJsonComments = stripJsonComments;
+ }
+})();

Powered by Google App Engine
This is Rietveld 408576698