From 12a9fbc0ca6470ac6437cfd6eaa56ccf576d40dd Mon Sep 17 00:00:00 2001 From: narutowyh Date: Sat, 6 Jan 2018 11:57:17 +0800 Subject: [PATCH] fix: ignore prototype's keys in a handful of for...in loops --- src/core/components/layout-utils.jsx | 3 +++ src/core/plugins/samples/fn.js | 3 +++ src/core/utils.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/core/components/layout-utils.jsx b/src/core/components/layout-utils.jsx index 1601681f..b8b99ae2 100644 --- a/src/core/components/layout-utils.jsx +++ b/src/core/components/layout-utils.jsx @@ -57,6 +57,9 @@ export class Col extends React.Component { let classesAr = [] for (let device in DEVICES) { + if (!DEVICES.hasOwnProperty(device)) { + continue + } let deviceClass = DEVICES[device] if(device in this.props) { let val = this.props[device] diff --git a/src/core/plugins/samples/fn.js b/src/core/plugins/samples/fn.js index 9f166f20..0d19a726 100644 --- a/src/core/plugins/samples/fn.js +++ b/src/core/plugins/samples/fn.js @@ -181,6 +181,9 @@ export const sampleXmlFromSchema = (schema, config={}) => { example = example || {} for (let propName in props) { + if (!props.hasOwnProperty(propName)) { + continue + } if ( props[propName].readOnly && !includeReadOnly ) { continue } diff --git a/src/core/utils.js b/src/core/utils.js index 2b084ba4..97cb77a5 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -607,6 +607,9 @@ export const parseSearch = () => { let params = search.substr(1).split("&") for (let i in params) { + if (!params.hasOwnProperty(i)) { + continue + } i = params[i].split("=") map[decodeURIComponent(i[0])] = decodeURIComponent(i[1]) }