Comparing version 1.0.1-beta3 to 1.1.0
@@ -5,3 +5,3 @@ { | ||
"description": "生成随机数据 & 拦截 Ajax 请求", | ||
"version": "1.0.1-beta3", | ||
"version": "1.1.0", | ||
"homepage": "http://mockjs.com/", | ||
@@ -19,6 +19,6 @@ "keywords": [ | ||
"gulp": "^3.9.0", | ||
"gulp-connect": "*", | ||
"gulp-connect": "^5.7.0", | ||
"gulp-coveralls": "^0.1.4", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-jshint": "^2.0.0", | ||
"gulp-istanbul": "^0.10.4", | ||
"gulp-jshint": "^2.1.0", | ||
"gulp-mocha": "^2.2.0", | ||
@@ -25,0 +25,0 @@ "gulp-mocha-phantomjs": "^0.10.1", |
@@ -492,25 +492,29 @@ /* | ||
key = keyPathParts[keyPathParts.length - 1] | ||
var currentContext = options.context.root | ||
var templateCurrentContext = options.context.templateRoot | ||
for (var i = 1; i < absolutePathParts.length - 1; i++) { | ||
currentContext = currentContext[absolutePathParts[i]] | ||
templateCurrentContext = templateCurrentContext[absolutePathParts[i]] | ||
} | ||
// 引用的值已经计算好 | ||
if (currentContext && (key in currentContext)) return currentContext[key] | ||
try { | ||
key = keyPathParts[keyPathParts.length - 1] | ||
var currentContext = options.context.root | ||
var templateCurrentContext = options.context.templateRoot | ||
for (var i = 1; i < absolutePathParts.length - 1; i++) { | ||
currentContext = currentContext[absolutePathParts[i]] | ||
templateCurrentContext = templateCurrentContext[absolutePathParts[i]] | ||
} | ||
// 引用的值已经计算好 | ||
if (currentContext && (key in currentContext)) return currentContext[key] | ||
// 尚未计算,递归引用数据模板中的属性 | ||
if (templateCurrentContext && | ||
(typeof templateCurrentContext === 'object') && | ||
(key in templateCurrentContext) && | ||
(originalKey !== templateCurrentContext[key]) // fix #15 避免自己依赖自己 | ||
) { | ||
// 先计算被引用的属性值 | ||
templateCurrentContext[key] = Handler.gen(templateCurrentContext[key], key, { | ||
currentContext: currentContext, | ||
templateCurrentContext: templateCurrentContext | ||
}) | ||
return templateCurrentContext[key] | ||
} | ||
} catch(err) { } | ||
// 尚未计算,递归引用数据模板中的属性 | ||
if (templateCurrentContext && | ||
(typeof templateCurrentContext === 'object') && | ||
(key in templateCurrentContext) && | ||
(originalKey !== templateCurrentContext[key]) // fix #15 避免自己依赖自己 | ||
) { | ||
// 先计算被引用的属性值 | ||
templateCurrentContext[key] = Handler.gen(templateCurrentContext[key], key, { | ||
currentContext: currentContext, | ||
templateCurrentContext: templateCurrentContext | ||
}) | ||
return templateCurrentContext[key] | ||
} | ||
return '@' + keyPathParts.join('/') | ||
}, | ||
@@ -517,0 +521,0 @@ // https://github.com/kissyteam/kissy/blob/master/src/path/src/path.js |
@@ -92,2 +92,9 @@ /* global require, chai, describe, before, it */ | ||
it('Relative Path Fallback in Corner Case', function() { | ||
const STRING = 'https://test.org/@a/build/test.html' | ||
var data = Mock.mock({ | ||
a: STRING | ||
}) | ||
expect(data.a).to.equal(STRING) | ||
}) | ||
}) | ||
@@ -94,0 +101,0 @@ describe('Complex', function() { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1887322
19242
0
59
8