can-map-define
Advanced tools
Comparing version 3.0.0-pre.3 to 3.0.0-pre.4
@@ -1298,1 +1298,32 @@ /* jshint asi: false */ | ||
}); | ||
test("compute props can be set to null or undefined (#2372)", function(assert) { | ||
var VM = CanMap.extend({ define: { | ||
foo: { type: 'compute' } | ||
}}); | ||
var vmNull = new VM({foo: null}); | ||
assert.equal(vmNull.foo, null, "foo is null, no error thrown"); | ||
var vmUndef = new VM({foo: undefined}); | ||
assert.equal(vmUndef.foo, undefined, "foo is null, no error thrown"); | ||
}); | ||
test("can set properties to undefined", function(){ | ||
var MyMap = CanMap.extend({ | ||
define: { | ||
foo: { | ||
set: function(newVal) { | ||
return newVal; | ||
} | ||
} | ||
} | ||
}); | ||
var map = new MyMap(); | ||
map.attr('foo', 'bar'); | ||
equal(map.attr('foo'), 'bar', 'foo should be bar'); | ||
map.attr('foo', undefined); | ||
equal(typeof map.attr('foo'), 'undefined', 'foo should be undefined'); | ||
}); |
@@ -173,3 +173,3 @@ var dev = require('can-util/js/dev/dev'); | ||
// if it took a setter and returned nothing, don't set the value | ||
else if (setValue === undefined && !setterCalled && setter.length >= 1) { | ||
else if (setValue === undefined && !setterCalled && setter.length > 1) { | ||
//!steal-remove-start | ||
@@ -247,3 +247,3 @@ asyncTimer = setTimeout(function() { | ||
set: function(newValue, setVal, setErr, oldValue) { | ||
if (newValue.isComputed) { | ||
if (newValue && newValue.isComputed) { | ||
return newValue; | ||
@@ -250,0 +250,0 @@ } |
{ | ||
"name": "can-map-define", | ||
"version": "3.0.0-pre.3", | ||
"version": "3.0.0-pre.4", | ||
"description": "Define rich attribute behavior", | ||
@@ -31,12 +31,2 @@ "homepage": "https://canjs.com", | ||
"main": "dist/cjs/can-map-define", | ||
"browser": { | ||
"transform": [ | ||
"cssify" | ||
] | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"cssify" | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -47,12 +37,2 @@ "canjs" | ||
"main": "can-map-define", | ||
"configDependencies": [ | ||
"live-reload" | ||
], | ||
"npmIgnore": [ | ||
"documentjs", | ||
"testee", | ||
"generator-donejs", | ||
"donejs-cli", | ||
"steal-tools" | ||
], | ||
"npmAlgorithm": "flat" | ||
@@ -75,4 +55,2 @@ }, | ||
"can-stache": "^3.0.0-pre.11", | ||
"cssify": "^0.6.0", | ||
"documentjs": "^0.4.2", | ||
"done-serve": "^0.2.0", | ||
@@ -79,0 +57,0 @@ "donejs-cli": "^0.8.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
76762
15
1456