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

Unified Diff: node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/js/regexp.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/configstore/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
diff --git a/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
new file mode 100644
index 0000000000000000000000000000000000000000..b38cb6d485faa298d5cc20722a4afc9997b1a29f
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
@@ -0,0 +1,56 @@
+'use strict';
+
+
+var Type = require('../../type');
+
+
+function resolveJavascriptRegExp(state) {
+ var regexp = state.result,
+ tail = /\/([gim]*)$/.exec(state.result),
+ modifiers;
+
+ // `/foo/gim` - tail can be maximum 4 chars
+ if ('/' === regexp[0] && tail && 4 >= tail[0].length) {
+ regexp = regexp.slice(1, regexp.length - tail[0].length);
+ modifiers = tail[1];
+ }
+
+ try {
+ state.result = new RegExp(regexp, modifiers);
+ return true;
+ } catch (error) {
+ return false;
+ }
+}
+
+
+function representJavascriptRegExp(object /*, style*/) {
+ var result = '/' + object.source + '/';
+
+ if (object.global) {
+ result += 'g';
+ }
+
+ if (object.multiline) {
+ result += 'm';
+ }
+
+ if (object.ignoreCase) {
+ result += 'i';
+ }
+
+ return result;
+}
+
+
+function isRegExp(object) {
+ return '[object RegExp]' === Object.prototype.toString.call(object);
+}
+
+
+module.exports = new Type('tag:yaml.org,2002:js/regexp', {
+ loadKind: 'scalar',
+ loadResolver: resolveJavascriptRegExp,
+ dumpPredicate: isRegExp,
+ dumpRepresenter: representJavascriptRegExp
+});

Powered by Google App Engine
This is Rietveld 408576698