Socket
Socket
Sign inDemoInstall

mockjs

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockjs - npm Package Compare versions

Comparing version 1.0.1-beta3 to 1.1.0

8

package.json

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc