Permalink
Browse files

- due to popular demand, the usePlural argument in overloadSetter is…

… back, now conveniently called forceObjectArgument.

 - de-reverted Array.each. I didnt think it was mistakenly committed to 1.3 with a closure, but I respect the backwards compatibility aspect of this insanity.
 - yes, these two unrelated changes reside in the same commit, deal with it.
  • Loading branch information...
1 parent 7e196ff commit 068ef42663950893efe420a2aaaa07c590bf21ed @kamicane kamicane committed Apr 12, 2011
Showing with 16 additions and 7 deletions.
  1. +16 −7 Source/Core/Core.js
View
23 Source/Core/Core.js
@@ -12,7 +12,7 @@
---
name: Core
description: The heart of MooTools.
-provides: [MooTools, Type, typeOf, instanceOf, String.uniqueID]
+provides: [MooTools, Type, typeOf, instanceOf, String.uniqueID, Object.each, Object.merge, Object.clone, Array.each, Array.clone, Date.new, Function.from, Array.from, Number.from, String.from]
...
*/
@@ -31,11 +31,11 @@ var slice = Array.prototype.slice,
for (var i in {toString: 1}) enumerables = null;
if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
-Function.prototype.overloadSetter = function(){
+Function.prototype.overloadSetter = function(forceObjectArgument){
var self = this;
return function(a, b){
if (a == null) return this;
- if (typeof a != 'string'){
+ if (forceObjectArgument || typeof a != 'string'){
@cpojer
MooTools member
cpojer added a line comment Apr 12, 2011

thank you.

@ibolmo
MooTools member
ibolmo added a line comment Apr 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
for (var k in a) self.call(this, k, a[k]);
if (enumerables) for (var i = enumerables.length; i--;){
k = enumerables[i];
@@ -269,11 +269,20 @@ Object.extend('forEach', function(object, fn, bind){
}
}).extend('each', Object.forEach);
-Array.implement('forEach', function(fn, context){
- for (var i = 0, l = this.length; i < l; i++){
- if (i in this) fn.call(context, this[i], i, this);
+Array.implement({
+
+ forEach: function(fn, context){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (i in this) fn.call(context, this[i], i, this);
+ }
+ },
+
+ each: function(fn, context){
+ this.forEach(fn, context);
+ return this;
}
-}).alias('each', 'forEach');
+
+});
// Array & Object cloning

0 comments on commit 068ef42

Please sign in to comment.