From d9ded15c45d9e50bbafaf8c9fea0b240aa632472 Mon Sep 17 00:00:00 2001 From: Ben Christel Date: Tue, 19 Jul 2016 15:02:08 -0700 Subject: [PATCH] Move functions in to a higher scope - Prevents them from accessing eq's local vars, which could cause bugs. --- src/core/matchers/matchersUtil.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/matchers/matchersUtil.js b/src/core/matchers/matchersUtil.js index 900c0950..db1545be 100644 --- a/src/core/matchers/matchersUtil.js +++ b/src/core/matchers/matchersUtil.js @@ -231,21 +231,21 @@ getJasmineRequireObj().matchersUtil = function(j$) { return extraKeys; } + } + + function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); + } - function has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); - } + function isFunction(obj) { + return typeof obj === 'function'; + } - function isFunction(obj) { - return typeof obj === 'function'; - } - - function isObjectConstructor(ctor) { - // aCtor instanceof aCtor is true for the Object and Function - // constructors (since a constructor is-a Function and a function is-a - // Object). We don't just compare ctor === Object because the constructor - // might come from a different frame with different globals. - return isFunction(ctor) && ctor instanceof ctor; - } + function isObjectConstructor(ctor) { + // aCtor instanceof aCtor is true for the Object and Function + // constructors (since a constructor is-a Function and a function is-a + // Object). We don't just compare ctor === Object because the constructor + // might come from a different frame with different globals. + return isFunction(ctor) && ctor instanceof ctor; } };