mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Escape path separator when using it as part of a regexp. [closes #233]
Former-commit-id: 95d28187ee573ecc26e44f30cb5fb7457877dd06
This commit is contained in:
5
build.js
5
build.js
@@ -25,7 +25,7 @@
|
|||||||
var push = arrayRef.push;
|
var push = arrayRef.push;
|
||||||
|
|
||||||
/** Used to detect the Node.js executable in command-line arguments */
|
/** Used to detect the Node.js executable in command-line arguments */
|
||||||
var reNode = RegExp('(?:^|' + path.sep + ')node(?:\\.exe)?$');
|
var reNode = RegExp('(?:^|' + path.sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')node(?:\\.exe)?$');
|
||||||
|
|
||||||
/** Shortcut used to convert array-like objects to arrays */
|
/** Shortcut used to convert array-like objects to arrays */
|
||||||
var slice = arrayRef.slice;
|
var slice = arrayRef.slice;
|
||||||
@@ -291,9 +291,6 @@
|
|||||||
'node'
|
'node'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Add `path.sep` for older versions of Node.js */
|
|
||||||
path.sep || (path.sep = process.platform == 'win32' ? '\\' : '/');
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
var mediaType = 'application/vnd.github.v3.raw';
|
var mediaType = 'application/vnd.github.v3.raw';
|
||||||
|
|
||||||
/** Used to detect the Node.js executable in command-line arguments */
|
/** Used to detect the Node.js executable in command-line arguments */
|
||||||
var reNode = RegExp('(?:^|' + path.sep + ')node(?:\\.exe)?$');
|
var reNode = RegExp('(?:^|' + path.sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')node(?:\\.exe)?$');
|
||||||
|
|
||||||
/** Used to reference parts of the blob href */
|
/** Used to reference parts of the blob href */
|
||||||
var location = (function() {
|
var location = (function() {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
var sep = path.sep;
|
var sep = path.sep;
|
||||||
|
|
||||||
// ensure relative paths are prefixed with `./`
|
// ensure relative paths are prefixed with `./`
|
||||||
if (!RegExp('^\\.?' + sep).test(dirname)) {
|
if (!RegExp('^\\.?' + sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).test(dirname)) {
|
||||||
dirname = '.' + sep + dirname;
|
dirname = '.' + sep + dirname;
|
||||||
}
|
}
|
||||||
dirname.split(sep).reduce(function(currPath, segment) {
|
dirname.split(sep).reduce(function(currPath, segment) {
|
||||||
|
|||||||
Reference in New Issue
Block a user