From 23160c9fb383eadf2c472a72540260adf2650599 Mon Sep 17 00:00:00 2001 From: Shane Thacker Date: Sun, 1 Nov 2015 12:34:54 -0600 Subject: [PATCH] Added hasOwnProperty check This ensures that the result output is clean of extended type methods --- src/ua-parser.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 37f3036..cf00131 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -89,11 +89,13 @@ if (typeof result === UNDEF_TYPE) { result = {}; for (p in props) { - q = props[p]; - if (typeof q === OBJ_TYPE) { - result[q[0]] = undefined; - } else { - result[q] = undefined; + if (props.hasOwnProperty(p)){ + q = props[p]; + if (typeof q === OBJ_TYPE) { + result[q[0]] = undefined; + } else { + result[q] = undefined; + } } } }