Skip to content

Commit

Permalink
Extract isPropertyConfigurable to own file
Browse files Browse the repository at this point in the history
  • Loading branch information
mroderick committed Apr 30, 2018
1 parent 738638d commit afec7b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 1 addition & 7 deletions 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;
Expand All @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions 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;

0 comments on commit afec7b2

Please sign in to comment.