implementing grayrest's suggested cleanup for object comprehensions

This commit is contained in:
Jeremy Ashkenas
2010-02-14 17:35:14 -05:00
parent e110042275
commit 7667e16732
6 changed files with 44 additions and 74 deletions

View File

@@ -54,11 +54,9 @@
return __a;
}
__f = obj;
for (key in __f) {
for (key in __f) if (__hasProp.call(__f, key)) {
val = __f[key];
if (__hasProp.call(__f, key)) {
iterator.call(context, val, key, obj);
}
iterator.call(context, val, key, obj);
}
} catch (e) {
if (e !== breaker) {
@@ -180,12 +178,10 @@
return _.indexOf(obj, target) !== -1;
}
__a = obj;
for (key in __a) {
for (key in __a) if (__hasProp.call(__a, key)) {
val = __a[key];
if (__hasProp.call(__a, key)) {
if (val === target) {
return true;
}
if (val === target) {
return true;
}
}
return false;
@@ -528,11 +524,9 @@
return _.range(0, obj.length);
}
__a = []; __b = obj;
for (key in __b) {
for (key in __b) if (__hasProp.call(__b, key)) {
val = __b[key];
if (__hasProp.call(__b, key)) {
__a.push(key);
}
__a.push(key);
}
return __a;
};
@@ -550,11 +544,9 @@
_.extend = function extend(destination, source) {
var __a, key, val;
__a = source;
for (key in __a) {
for (key in __a) if (__hasProp.call(__a, key)) {
val = __a[key];
if (__hasProp.call(__a, key)) {
destination[key] = val;
}
destination[key] = val;
}
return destination;
};