can-reflect
Advanced tools
Comparing version 1.15.1 to 1.15.2
{ | ||
"name": "can-reflect", | ||
"version": "1.15.1", | ||
"version": "1.15.2", | ||
"description": "reflection on unknown data types", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
@@ -575,2 +575,9 @@ var QUnit = require('steal-qunit'); | ||
QUnit.test("each loops without needing `this`", function(){ | ||
var each = shapeReflections.each; | ||
each({}, function(){}); | ||
QUnit.ok(true, "no error"); | ||
}); | ||
/*QUnit.test("getAllEnumerableKeys", function(){ | ||
@@ -577,0 +584,0 @@ |
@@ -305,5 +305,5 @@ var canSymbol = require("can-symbol"); | ||
if(typeReflections.isIteratorLike(obj) || typeReflections.isMoreListLikeThanMapLike(obj) ) { | ||
return this.eachIndex(obj,callback,context); | ||
return shapeReflections.eachIndex(obj,callback,context); | ||
} else { | ||
return this.eachKey(obj,callback,context); | ||
return shapeReflections.eachKey(obj,callback,context); | ||
} | ||
@@ -337,3 +337,3 @@ }, | ||
if(Array.isArray(list)) { | ||
return this.eachListLike(list, callback, context); | ||
return shapeReflections.eachListLike(list, callback, context); | ||
} else { | ||
@@ -357,3 +357,3 @@ var iter, iterator = list[canSymbol.iterator]; | ||
} else { | ||
this.eachListLike(list, callback, context); | ||
shapeReflections.eachListLike(list, callback, context); | ||
} | ||
@@ -407,3 +407,3 @@ } | ||
var arr = []; | ||
this.each(obj, function(value){ | ||
shapeReflections.each(obj, function(value){ | ||
arr.push(value); | ||
@@ -440,3 +440,3 @@ }); | ||
if(obj) { | ||
var enumerableKeys = this.getOwnEnumerableKeys(obj); | ||
var enumerableKeys = shapeReflections.getOwnEnumerableKeys(obj); | ||
@@ -446,3 +446,3 @@ // cache getKeyValue method if we can | ||
return this.eachIndex(enumerableKeys, function(key){ | ||
return shapeReflections.eachIndex(enumerableKeys, function(key){ | ||
var value = getKeyValue.call(obj, key); | ||
@@ -489,3 +489,3 @@ return callback.call(context || obj, value, key, obj); | ||
var found = false; | ||
this.eachIndex(getOwnKeys.call(obj), function(objKey){ | ||
shapeReflections.eachIndex(getOwnKeys.call(obj), function(objKey){ | ||
if(objKey === key) { | ||
@@ -540,4 +540,4 @@ found = true; | ||
var keys = []; | ||
this.eachIndex(this.getOwnKeys(obj), function(key){ | ||
var descriptor = this.getOwnKeyDescriptor(obj, key); | ||
shapeReflections.eachIndex(shapeReflections.getOwnKeys(obj), function(key){ | ||
var descriptor = shapeReflections.getOwnKeyDescriptor(obj, key); | ||
if(descriptor.enumerable) { | ||
@@ -698,3 +698,3 @@ keys.push(key); | ||
var setKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue; | ||
this.eachKey(source,function(value, key){ | ||
shapeReflections.eachKey(source,function(value, key){ | ||
// if the target doesn't have this key or the keys are not the same | ||
@@ -708,3 +708,3 @@ if(!hasOwnKey(key) || getKeyValue.call(target, key) !== value) { | ||
assignList: function(target, source) { | ||
var inserting = this.toArray(source); | ||
var inserting = shapeReflections.toArray(source); | ||
getSetReflections.splice(target, 0, inserting, inserting ); | ||
@@ -749,5 +749,5 @@ return target; | ||
// copy to array and add these keys in place | ||
this.assignList(target, source); | ||
shapeReflections.assignList(target, source); | ||
} else { | ||
this.assignMap(target, source); | ||
shapeReflections.assignMap(target, source); | ||
} | ||
@@ -762,3 +762,3 @@ return target; | ||
this.eachKey(source, function(newVal, key){ | ||
shapeReflections.eachKey(source, function(newVal, key){ | ||
if(!hasOwnKey(key)) { | ||
@@ -776,3 +776,3 @@ // set no matter what | ||
} else { | ||
this.assignDeep(curVal, newVal); | ||
shapeReflections.assignDeep(curVal, newVal); | ||
} | ||
@@ -817,6 +817,6 @@ } | ||
// list-like | ||
this.assignDeepList(target, source); | ||
shapeReflections.assignDeepList(target, source); | ||
} else { | ||
// map-like | ||
this.assignDeepMap(target, source); | ||
shapeReflections.assignDeepMap(target, source); | ||
} | ||
@@ -826,3 +826,3 @@ return target; | ||
updateMap: function(target, source) { | ||
var sourceKeyMap = makeMap( this.getOwnEnumerableKeys(source) ); | ||
var sourceKeyMap = makeMap( shapeReflections.getOwnEnumerableKeys(source) ); | ||
@@ -832,3 +832,3 @@ var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue; | ||
this.eachKey(target, function(curVal, key){ | ||
shapeReflections.eachKey(target, function(curVal, key){ | ||
if(!sourceKeyMap.get(key)) { | ||
@@ -847,3 +847,3 @@ getSetReflections.deleteKeyValue(target, key); | ||
this.eachIndex(sourceKeyMap.keys(), function(key){ | ||
shapeReflections.eachIndex(sourceKeyMap.keys(), function(key){ | ||
if(sourceKeyMap.get(key)) { | ||
@@ -857,3 +857,3 @@ targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key) ); | ||
updateList: function(target, source) { | ||
var inserting = this.toArray(source); | ||
var inserting = shapeReflections.toArray(source); | ||
@@ -898,5 +898,5 @@ getSetReflections.splice(target, 0, target, inserting ); | ||
// copy to array and add these keys in place | ||
this.updateList(target, source); | ||
shapeReflections.updateList(target, source); | ||
} else { | ||
this.updateMap(target, source); | ||
shapeReflections.updateMap(target, source); | ||
} | ||
@@ -906,3 +906,3 @@ return target; | ||
updateDeepMap: function(target, source) { | ||
var sourceKeyMap = makeMap( this.getOwnEnumerableKeys(source) ); | ||
var sourceKeyMap = makeMap( shapeReflections.getOwnEnumerableKeys(source) ); | ||
@@ -912,3 +912,3 @@ var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue; | ||
this.eachKey(target, function(curVal, key){ | ||
shapeReflections.eachKey(target, function(curVal, key){ | ||
@@ -926,3 +926,3 @@ if(!sourceKeyMap.get(key)) { | ||
} else { | ||
this.updateDeep(curVal, newVal); | ||
shapeReflections.updateDeep(curVal, newVal); | ||
} | ||
@@ -932,3 +932,3 @@ | ||
this.eachIndex(sourceKeyMap.keys(), function(key){ | ||
shapeReflections.eachIndex(sourceKeyMap.keys(), function(key){ | ||
if(sourceKeyMap.get(key)) { | ||
@@ -975,6 +975,6 @@ targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key) ); | ||
// list-like | ||
this.updateDeepList(target, source); | ||
shapeReflections.updateDeepList(target, source); | ||
} else { | ||
// map-like | ||
this.updateDeepMap(target, source); | ||
shapeReflections.updateDeepMap(target, source); | ||
} | ||
@@ -1054,3 +1054,3 @@ return target; | ||
assignSymbols: function(target, source){ | ||
this.eachKey(source, function(value, key){ | ||
shapeReflections.eachKey(source, function(value, key){ | ||
var symbol = typeReflections.isSymbolLike(canSymbol[key]) ? canSymbol[key] : canSymbol.for(key); | ||
@@ -1103,3 +1103,3 @@ getSetReflections.setKeyValue(target, symbol, value); | ||
this.each(obj, function(){ | ||
shapeReflections.each(obj, function(){ | ||
count++; | ||
@@ -1106,0 +1106,0 @@ }); |
169986
4602