Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-define

Package Overview
Dependencies
Maintainers
15
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-define - npm Package Compare versions

Comparing version 2.3.3 to 2.3.4

28

can-define.js

@@ -781,2 +781,19 @@ "use strict";

});
// normalize Type that implements can.new
if(def.Type) {
var value = def.Type;
var serialize = value[serializeSymbol];
if(serialize) {
definition.serialize = function(val){
return serialize.call(val);
};
}
if(value[newSymbol]) {
definition.type = value[newSymbol];
delete definition.Type;
}
}
// We only want to add a defaultDefinition if def.type is not a string

@@ -811,12 +828,3 @@ // if def.type is a string it is handled in addDefinition

else if(value && (value[serializeSymbol] || value[newSymbol]) ) {
definition = {};
var serialize = value[serializeSymbol];
if(serialize) {
definition.serialize = function(val){
return serialize.call(val);
};
}
if(value[newSymbol]) {
definition.type = value[newSymbol];
}
definition = { Type: value };
}

@@ -823,0 +831,0 @@ else if(typeof value === "function") {

@@ -1331,1 +1331,47 @@ var QUnit = require("steal-qunit");

});
QUnit.test("primitive types work with val: Type", function(){
var UpperCase = {};
UpperCase[canSymbol.for("can.new")] = function(val){
return val.toUpperCase();
};
var Type = DefineMap.extend({
val: UpperCase
});
var type = new Type({ val: "works" });
QUnit.equal(type.val, "WORKS", "it worked");
});
QUnit.test("primitive types work with val: {Type: Type}", function(){
var UpperCase = {};
UpperCase[canSymbol.for("can.new")] = function(val){
return val.toUpperCase();
};
var Type = DefineMap.extend({
val: {
Type: UpperCase
}
});
var type = new Type({ val: "works" });
QUnit.equal(type.val, "WORKS", "it worked");
});
QUnit.test("primitive types work with val: {type: Type}", function(){
var UpperCase = {};
UpperCase[canSymbol.for("can.new")] = function(val){
return val.toUpperCase();
};
var Type = DefineMap.extend({
val: {
type: UpperCase
}
});
var type = new Type({ val: "works" });
QUnit.equal(type.val, "WORKS", "it worked");
});
{
"name": "can-define",
"version": "2.3.3",
"version": "2.3.4",
"description": "Create observable objects with JS dot operator compatibility",

@@ -5,0 +5,0 @@ "main": "can-define.js",

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