| 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
|
| index b38cb6d485faa298d5cc20722a4afc9997b1a29f..07ef5218ed91f02d51995ec23ed6cbb6e28ab25f 100644
|
| --- 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
|
| @@ -1,28 +1,57 @@
|
| 'use strict';
|
|
|
| -
|
| var Type = require('../../type');
|
|
|
| +function resolveJavascriptRegExp(data) {
|
| + if (null === data) {
|
| + return false;
|
| + }
|
| +
|
| + if (0 === data.length) {
|
| + return false;
|
| + }
|
|
|
| -function resolveJavascriptRegExp(state) {
|
| - var regexp = state.result,
|
| - tail = /\/([gim]*)$/.exec(state.result),
|
| - modifiers;
|
| + var regexp = data,
|
| + tail = /\/([gim]*)$/.exec(data),
|
| + 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];
|
| + // if regexp starts with '/' it can have modifiers and must be properly closed
|
| + // `/foo/gim` - modifiers tail can be maximum 3 chars
|
| + if ('/' === regexp[0]) {
|
| + if (tail) {
|
| + modifiers = tail[1];
|
| + }
|
| +
|
| + if (modifiers.length > 3) { return false; }
|
| + // if expression starts with /, is should be properly terminated
|
| + if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
|
| +
|
| + regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
| }
|
|
|
| try {
|
| - state.result = new RegExp(regexp, modifiers);
|
| + var dummy = new RegExp(regexp, modifiers);
|
| return true;
|
| } catch (error) {
|
| return false;
|
| }
|
| }
|
|
|
| +function constructJavascriptRegExp(data) {
|
| + var regexp = data,
|
| + tail = /\/([gim]*)$/.exec(data),
|
| + modifiers = '';
|
| +
|
| + // `/foo/gim` - tail can be maximum 4 chars
|
| + if ('/' === regexp[0]) {
|
| + if (tail) {
|
| + modifiers = tail[1];
|
| + }
|
| + regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
| + }
|
| +
|
| + return new RegExp(regexp, modifiers);
|
| +}
|
|
|
| function representJavascriptRegExp(object /*, style*/) {
|
| var result = '/' + object.source + '/';
|
| @@ -42,15 +71,14 @@ function representJavascriptRegExp(object /*, style*/) {
|
| 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
|
| + kind: 'scalar',
|
| + resolve: resolveJavascriptRegExp,
|
| + construct: constructJavascriptRegExp,
|
| + predicate: isRegExp,
|
| + represent: representJavascriptRegExp
|
| });
|
|
|