Comparing version 8.0.2 to 8.0.3
8.0.3 / 2020-01-06 | ||
================== | ||
* Move .printf to proxy | ||
8.0.2 / 2019-12-30 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -9,2 +9,3 @@ "use strict"; | ||
var proxyInvoke = require("./proxy-invoke"); | ||
var sinonFormat = require("./util/core/format"); | ||
@@ -106,2 +107,21 @@ var push = arrayProto.push; | ||
formatters: require("./spy-formatters"), | ||
printf: function(format) { | ||
var spyInstance = this; | ||
var args = slice(arguments, 1); | ||
var formatter; | ||
return (format || "").replace(/%(.)/g, function(match, specifyer) { | ||
formatter = proxyApi.formatters[specifyer]; | ||
if (typeof formatter === "function") { | ||
return String(formatter(spyInstance, args)); | ||
} else if (!isNaN(parseInt(specifyer, 10))) { | ||
return sinonFormat(args[specifyer - 1]); | ||
} | ||
return "%" + specifyer; | ||
}); | ||
}, | ||
resetHistory: function() { | ||
@@ -108,0 +128,0 @@ if (this.invoking) { |
@@ -13,3 +13,2 @@ "use strict"; | ||
var wrapMethod = require("./util/core/wrap-method"); | ||
var sinonFormat = require("./util/core/format"); | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
@@ -36,4 +35,2 @@ | ||
var spyApi = { | ||
formatters: require("./spy-formatters"), | ||
withArgs: function() { | ||
@@ -79,20 +76,2 @@ var args = slice(arguments); | ||
}); | ||
}, | ||
printf: function(format) { | ||
var spyInstance = this; | ||
var args = slice(arguments, 1); | ||
var formatter; | ||
return (format || "").replace(/%(.)/g, function(match, specifyer) { | ||
formatter = spyApi.formatters[specifyer]; | ||
if (typeof formatter === "function") { | ||
return String(formatter(spyInstance, args)); | ||
} else if (!isNaN(parseInt(specifyer, 10))) { | ||
return sinonFormat(args[specifyer - 1]); | ||
} | ||
return "%" + specifyer; | ||
}); | ||
} | ||
@@ -99,0 +78,0 @@ }; |
{ | ||
"name": "sinon", | ||
"description": "JavaScript test spies, stubs and mocks.", | ||
"version": "8.0.2", | ||
"version": "8.0.3", | ||
"homepage": "https://sinonjs.org/", | ||
@@ -70,3 +70,3 @@ "author": "Christian Johansen", | ||
"@sinonjs/referee": "^4.0.0", | ||
"babel-plugin-istanbul": "^5.2.0", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
"babelify": "^10.0.0", | ||
@@ -85,7 +85,7 @@ "browserify": "^16.5.0", | ||
"lint-staged": "^9.4.1", | ||
"markdownlint-cli": "^0.18.0", | ||
"markdownlint-cli": "^0.20.0", | ||
"mocha": "^6.2.0", | ||
"mochify": "^6.6.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^14.1.1", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.18.2", | ||
@@ -92,0 +92,0 @@ "proxyquire": "^2.1.3", |
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 too big to display
Sorry, the diff of this file is too big to display
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
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
4669332