manis
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -123,2 +123,19 @@ /** | ||
// windows 下可能存在盘符不一致, 或者盘符大小写不一致的情况 | ||
// 比如此处,可能存在下列几种情况: | ||
// 1: root === 'C:\', start === 'C:\test.js' | ||
// 2: root === 'C:\', start === 'c:\test.js' | ||
// 3: root === 'C:\', start === 'D:\test.js' | ||
// 4: root === 'C:\', start === 'd:\test.js' | ||
// 其中, 2, 3, 4 三种情况会导致后续的 while 循环变成无限循环 | ||
// 此处将 root 的大小写和 start 保持一致 | ||
if (/^[a-z]:/i.test(root) && /^[a-z]:/i.test(start)) { | ||
if (/^[a-z]:/.test(start)) { | ||
root = root.toLowerCase(); | ||
} | ||
else { | ||
root = root.toUpperCase(); | ||
} | ||
} | ||
stopper = stopper || function (start, root, configs) { | ||
@@ -130,2 +147,3 @@ return start === root; | ||
var filepath; | ||
var last; | ||
@@ -148,3 +166,12 @@ /* eslint-disable no-constant-condition */ | ||
last = start; | ||
start = path.resolve(start, '..'); | ||
// windows 下, 如果进行到根目录, 上面的 resolve 执行后没有变化 | ||
// 即 path.resolve('D:\', '..') === 'D:\' | ||
// 此时若 root 为不同盘符, 比如'C:\', 上面的默认 stopper 会永远返回 false | ||
// 成为无限循环, 此处判断后 break | ||
if (last === start) { | ||
break; | ||
} | ||
} | ||
@@ -151,0 +178,0 @@ /* eslint-enable no-constant-condition */ |
@@ -27,5 +27,8 @@ /** | ||
if (toString.call(src[key]) === '[object Object]' | ||
&& toString.call(target[key]) === '[object Object]' | ||
) { | ||
if (toString.call(src[key]) === '[object Object]') { | ||
if (toString.call(target[key]) !== '[object Object]') { | ||
target[key] = {}; | ||
} | ||
extend(target[key], src[key]); | ||
@@ -32,0 +35,0 @@ } |
{ | ||
"name": "manis", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Find and read your configuration files recursively", | ||
@@ -5,0 +5,0 @@ "main": "lib/manis.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22624
524
1