Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

I was going to post this as a comment to palacsint's answer palacsint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

One way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});

I was going to post this as a comment to palacsint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

One way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});

I was going to post this as a comment to palacsint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

One way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});
edited body
Source Link
palacsint
  • 30.4k
  • 9
  • 82
  • 157

I was going to post this as a comment to palascint'spalacsint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

oneOne way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});

I was going to post this as a comment to palascint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

one way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});

I was going to post this as a comment to palacsint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

One way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});
Source Link
seand
  • 2.5k
  • 1
  • 20
  • 29

I was going to post this as a comment to palascint's answer but it helps to have code blocks.

Because you're using this pattern in several places:

for (var prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 ...
 }
}

one way you can reduce the depth of the "arrowing" is to extract that out into its own function:

function iterateMap(obj, fn, scope) {
 for(prop in obj) {
 if(obj.hasOwnProperty(prop)) {
 fn.call(scope || this, prop);
 }
 }
}
...
iterateMap(obj, function(prop) {
 ...
});
lang-xml

AltStyle によって変換されたページ (->オリジナル) /