tobie (owner)

Revisions

gist: 44308 Download_button fork
public
Public Clone URL: git://gist.github.com/44308.git
Embed All Files: show embed
JavaScript #
1
2
3
4
5
6
7
8
9
10
11
Object.extend = Object.extend.wrap(function(proceed, destination, source, safe) {
  if (!safe) return proceed(destination, source);
  for (var property in source) {
    if (!(property in destination))
      destination[property] = source[property];
  }
  return destination;
});
 
Object.extend({foo: 123}, {foo: 456}, true).foo
// -> 123