From afec7b28ee7f975f7cdc2b3b4cde9b5eea5cc48e Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Fri, 27 Apr 2018 11:30:08 +0100 Subject: [PATCH] Extract isPropertyConfigurable to own file --- lib/sinon/default-behaviors.js | 8 +------- lib/sinon/util/core/is-property-configurable.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 lib/sinon/util/core/is-property-configurable.js diff --git a/lib/sinon/default-behaviors.js b/lib/sinon/default-behaviors.js index cb11869ee..a9230df3a 100644 --- a/lib/sinon/default-behaviors.js +++ b/lib/sinon/default-behaviors.js @@ -1,6 +1,6 @@ "use strict"; -var getPropertyDescriptor = require("./util/core/get-property-descriptor"); +var isPropertyConfigurable = require("./util/core/is-property-configurable"); var slice = [].slice; var useLeftMostCallback = -1; @@ -24,12 +24,6 @@ function throwsException(fake, error, message) { } } -function isPropertyConfigurable(obj, propName) { - var propertyDescriptor = getPropertyDescriptor(obj, propName); - - return propertyDescriptor ? propertyDescriptor.configurable : true; -} - module.exports = { callsFake: function callsFake(fake, fn) { fake.fakeFn = fn; diff --git a/lib/sinon/util/core/is-property-configurable.js b/lib/sinon/util/core/is-property-configurable.js new file mode 100644 index 000000000..9ed1a681b --- /dev/null +++ b/lib/sinon/util/core/is-property-configurable.js @@ -0,0 +1,11 @@ +"use strict"; + +var getPropertyDescriptor = require("./get-property-descriptor"); + +function isPropertyConfigurable(obj, propName) { + var propertyDescriptor = getPropertyDescriptor(obj, propName); + + return propertyDescriptor ? propertyDescriptor.configurable : true; +} + +module.exports = isPropertyConfigurable;