New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

can-reflect

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-reflect - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "can-reflect",
"version": "0.0.2",
"version": "0.0.3",
"description": "reflection on unknown data types",

@@ -5,0 +5,0 @@ "homepage": "http://canjs.com",

@@ -106,2 +106,14 @@ var QUnit = require('steal-qunit');

});
function ArrayLike() {}
ArrayLike.prototype = new Array();
ArrayLike.prototype[canSymbol.iterator] = null;
var noniterator = new ArrayLike();
noniterator.push("a");
shapeReflections.eachIndex(noniterator, function(value, index){
QUnit.equal(index, 0);
QUnit.equal(value,"a");
});
});

@@ -108,0 +120,0 @@

@@ -18,10 +18,9 @@ var canSymbol = require("can-symbol");

eachIndex: function(list, callback, context){
var iter;
var iter, iterator = list[canSymbol.iterator];
if(Array.isArray(list)) {
// do nothing
} else if(typeReflections.isIteratorLike(list)) {
// we are looping through an interator
// we are looping through an iterator
iter = list;
} else {
var iterator = list[canSymbol.iterator];
} else if(iterator) {
iter = iterator.call(list);

@@ -28,0 +27,0 @@ }

@@ -40,4 +40,8 @@ var QUnit = require('steal-qunit');

}), "object with 0 length");
var symboled = {};
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isListLike"), false);
ok(!typeReflections.isListLike(symboled), "!@@can.isListLike");
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isListLike"), true);
ok(typeReflections.isListLike(symboled), "@@can.isListLike");
if(typeof document !== "undefined") {

@@ -56,2 +60,7 @@ var ul = document.createElement("ul");

ok(typeReflections.isMapLike([]), "Array");
var symboled = {};
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isMapLike"), false);
ok(!typeReflections.isMapLike(symboled), "!@@can.isMapLike");
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isMapLike"), true);
ok(typeReflections.isMapLike(symboled), "@@can.isMapLike");

@@ -87,2 +96,8 @@ ok(!typeReflections.isMapLike("String"), "String");

ok(typeReflections.isValueLike(obj), "symboled");
var symboled = {};
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isValueLike"), false);
ok(!typeReflections.isValueLike(symboled), "!@@can.isValueLike");
getSetReflections.setKeyValue(symboled, canSymbol.for("can.isValueLike"), true);
ok(typeReflections.isValueLike(symboled), "@@can.isValueLike");
});

@@ -89,0 +104,0 @@

@@ -48,5 +48,10 @@ var canSymbol = require("can-symbol");

function isValueLike(obj) {
var symbolValue;
if(isPrimitive(obj)) {
return true;
}
symbolValue = obj[canSymbol.for("can.isValueLike")];
if( typeof symbolValue !== "undefined") {
return symbolValue;
}
var value = obj[canSymbol.for("can.getValue")];

@@ -59,5 +64,10 @@ if(value !== undefined) {

function isMapLike(obj) {
var symbolValue;
if(isPrimitive(obj)) {
return false;
}
symbolValue = obj[canSymbol.for("can.isMapLike")];
if( typeof symbolValue !== "undefined") {
return symbolValue;
}
var value = obj[canSymbol.for("can.getKeyValue")];

@@ -82,3 +92,4 @@ if(value !== undefined) {

function isListLike( list ) {
var type = typeof list;
var symbolValue,
type = typeof list;
if(type === "string") {

@@ -90,2 +101,6 @@ return true;

}
symbolValue = list[canSymbol.for("can.isListLike")];
if( typeof symbolValue !== "undefined") {
return symbolValue;
}
var value = list[canSymbol.iterator];

@@ -92,0 +107,0 @@ if(value !== undefined) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc