1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

adding a new comprehension 'for all key, value of object', which compiles to the naked JS for..in, including enumerable properties inherited from prototypes.

This commit is contained in:
Jeremy Ashkenas 2010-07-15 21:18:35 -04:00
parent 2a932597e4
commit 72c4efbc39
12 changed files with 177 additions and 124 deletions

View file

@ -1,6 +1,5 @@
(function(){
var compact, count, del, ends, extend, flatten, helpers, include, indexOf, merge, starts;
var __hasProp = Object.prototype.hasOwnProperty;
if (!(typeof process !== "undefined" && process !== null)) {
this.exports = this;
}
@ -53,26 +52,26 @@
var _a, _b, fresh, key, val;
fresh = {};
_a = options;
for (key in _a) { if (__hasProp.call(_a, key)) {
for (key in _a) {
val = _a[key];
(fresh[key] = val);
}}
}
if (overrides) {
_b = overrides;
for (key in _b) { if (__hasProp.call(_b, key)) {
for (key in _b) {
val = _b[key];
(fresh[key] = val);
}}
}
}
return fresh;
});
helpers.extend = (extend = function(object, properties) {
var _a, _b, key, val;
_a = []; _b = properties;
for (key in _b) { if (__hasProp.call(_b, key)) {
for (key in _b) {
val = _b[key];
_a.push(object[key] = val);
}}
}
return _a;
});
helpers.flatten = (flatten = function(array) {