Skip to content

Commit

Permalink
Merge pull request #26 from adamk33n3r/master
Browse files Browse the repository at this point in the history
Change to using Object's hasOwnProperty
  • Loading branch information
nijikokun committed Feb 23, 2017
2 parents 4dcf1a5 + e3dbd6e commit 9d3bb5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils.js
Expand Up @@ -8,7 +8,7 @@ var utils = module.exports = exports = {
utils.extend = function (original, context) {
var output = JSON.parse(JSON.stringify(original || {})), key;
for (key in context)
if (context.hasOwnProperty(key))
if (Object.prototype.hasOwnProperty.call(context, key))
if (Object.prototype.toString.call(context[key]) === '[object Object]')
output[key] = utils.extend(output[key] || {}, context[key]);
else
Expand All @@ -22,7 +22,7 @@ utils.extend = function (original, context) {
utils.serialExtend = function (original, context, prefix) {
var output = JSON.parse(JSON.stringify(original || {})), i, key, value;
for (i in context) {
if (!context.hasOwnProperty(i)) continue;
if (!Object.prototype.hasOwnProperty.call(context, i)) continue;
else key = prefix ? prefix + "[" + i + "]" : i, value = context[i];
if (Object.prototype.toString.call(value) === '[object Object]')
output = utils.serialExtend(output, value, key);
Expand Down

0 comments on commit 9d3bb5f

Please sign in to comment.