[Pkg-javascript-commits] [node-acorn-jsx] 124/484: Don't assume options object has a hasOwnProperty method

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit adf16e33c0e1610ce26bf46ba0bd126943f4596b
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Sat Jun 8 20:36:44 2013 +0200

    Don't assume options object has a hasOwnProperty method
    
    Closes #43
---
 acorn.js   | 2 +-
 index.html | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/acorn.js b/acorn.js
index 76d1090..e7d8c44 100644
--- a/acorn.js
+++ b/acorn.js
@@ -101,7 +101,7 @@
 
   function setOptions(opts) {
     options = opts || {};
-    for (var opt in defaultOptions) if (!options.hasOwnProperty(opt))
+    for (var opt in defaultOptions) if (!Object.prototype.hasOwnProperty.call(options, opt))
       options[opt] = defaultOptions[opt];
     sourceFile = options.sourceFile || null;
   }
diff --git a/index.html b/index.html
index b92bc13..045d0fb 100644
--- a/index.html
+++ b/index.html
@@ -65,7 +65,7 @@ file in every node's <code>loc</code> object.</p>             </td>
 
   <span class="kd">function</span> <span class="nx">setOptions</span><span class="p">(</span><span class="nx">opts</span><span class="p">)</span> <span class="p">{</span>
     <span class="nx">options</span> <span class="o">=</span> <span class="nx">opts</span> <span class="o">||</span> <span class="p">{};</span>
-    <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">opt</span> <span class="k">in</span> <span class="nx">defaultOptions</span><span class="p">)</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">options</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="nx">opt</span><span class="p">))</span>
+    <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">opt</span> <span class="k">in</span> <span class="nx">defaultOptions</span><span class="p">)</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">Object</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">.</span><span class="nx">call</span><span class="p">( [...]
       <span class="nx">options</span><span class="p">[</span><span class="nx">opt</span><span class="p">]</span> <span class="o">=</span> <span class="nx">defaultOptions</span><span class="p">[</span><span class="nx">opt</span><span class="p">];</span>
     <span class="nx">sourceFile</span> <span class="o">=</span> <span class="nx">options</span><span class="p">.</span><span class="nx">sourceFile</span> <span class="o">||</span> <span class="kc">null</span><span class="p">;</span>
   <span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">¶</a>               </div>               <p>The <code>getLineInfo</code> function is mostly useful when the

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list