undersc_rext.js | |
---|---|
| |
those are cobras, man | /*globals exports:true,module*/
;(function() {
var undersc_re = this._;
if (typeof exports !== 'undefined')
undersc_re = exports = module.exports = require('underscore');
undersc_re.mixin({ |
_.memo(list, iterator, [memo], [context])just like params:
returns: the return value from the last call of | memo: function(list, iterator, memo, context) {
memo = typeof memo === 'undefined'? {} : memo;
context = typeof context === 'undefined'? memo : context;
return undersc_re.reduce(list, function(memo) {
iterator.apply(context, arguments);
return memo;
}, memo);
}, |
_.prop(obj, value, [key])kinda like jquery
params:
returns: the object. what did you expect? | prop: function(obj, key, value) {
var props = {};
typeof value === 'undefined'? props = key : props[key] = value;
return undersc_re.extend(obj, props);
}
});
}).apply(this);
|