From ad673fedd1f07f519c4499b4f9e1633f6aa09a8d Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Fri, 27 Apr 2018 11:30:08 +0100 Subject: [PATCH] Extract isRestorable to own file --- lib/sinon/util/core/is-restorable.js | 7 +++++++ lib/sinon/util/core/restore.js | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 lib/sinon/util/core/is-restorable.js diff --git a/lib/sinon/util/core/is-restorable.js b/lib/sinon/util/core/is-restorable.js new file mode 100644 index 000000000..4fc3a9f2e --- /dev/null +++ b/lib/sinon/util/core/is-restorable.js @@ -0,0 +1,7 @@ +"use strict"; + +function isRestorable(obj) { + return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; +} + +module.exports = isRestorable; diff --git a/lib/sinon/util/core/restore.js b/lib/sinon/util/core/restore.js index 3e4abeb21..4ea4a73ed 100644 --- a/lib/sinon/util/core/restore.js +++ b/lib/sinon/util/core/restore.js @@ -1,11 +1,8 @@ "use strict"; +var isRestorable = require("./is-restorable"); var walk = require("./walk"); -function isRestorable(obj) { - return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; -} - module.exports = function restore(object) { if (object !== null && typeof object === "object") { walk(object, function (prop) {