From 2cd7d4f43de91b8eea2d7b4a185cd2111e913398 Mon Sep 17 00:00:00 2001 From: Tomasz Tarnowski Date: Thu, 27 Aug 2020 22:06:51 +0100 Subject: [PATCH] Removed hasOwnProperty checks from object partial stub internals. --- package.json | 2 +- src/index.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index be154d9..5329e8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-sinon", - "version": "2.0.0", + "version": "2.0.1", "description": "sinon library extension to stub whole object and interfaces", "author": { "name": "Tomasz Tarnowski", diff --git a/src/index.ts b/src/index.ts index 7afc256..f8fa312 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ export function stubObject(object: T, methods?: ObjectMethodsK ]; for (let method in object) { - if (object.hasOwnProperty(method) && typeof object[method] == "function") { + if (typeof object[method] == "function") { objectMethods.push(method); } } @@ -40,10 +40,8 @@ export function stubObject(object: T, methods?: ObjectMethodsK } } else if (typeof methods == "object") { for (let method in methods) { - if (methods.hasOwnProperty(method)) { - stubObject[method] = sinon.stub(); - stubObject[method].returns(methods[method]); - } + stubObject[method] = sinon.stub(); + stubObject[method].returns(methods[method]); } } else { for (let method of objectMethods) {