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

can-map-define

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-map-define - npm Package Compare versions

Comparing version 3.0.0-pre.2 to 3.0.0-pre.3

doc/apis.json

67

can-map-define_test.js

@@ -1104,3 +1104,3 @@ /* jshint asi: false */

equal(t.attr("boolean"), false, "converted to boolean");
equal(t.attr("boolean"), undefined, "converted to boolean");

@@ -1126,3 +1126,3 @@ equal(t.attr("htmlbool"), false, "converted to htmlbool");

equal(t.attr("boolean"), false, "converted to boolean");
equal(t.attr("boolean"), null, "converted to boolean");

@@ -1237,1 +1237,64 @@ equal(t.attr("htmlbool"), false, "converted to htmlbool");

});
test("nullish values are not converted for Type", function(assert) {
var VM = CanMap.extend({
define: {
map: {
Type: CanMap
},
notype: {},
}
});
var vm = new VM({
num: 1,
bool: true,
htmlbool: "foo",
str: "foo",
date: Date.now(),
map: {},
notype: {}
});
// Sanity check
assert.ok(vm.attr("map") instanceof CanMap, "map is a Map");
assert.ok(vm.attr("notype") instanceof CanMap, "notype is a Map");
vm.attr({
map: null,
notype: null
});
assert.equal(vm.attr("map"), null, "map is null");
assert.equal(vm.attr("map"), null, "notype is null");
});
test("Wildcard serialize doesn't apply to getter properties (#4)", function() {
var VM = CanMap.extend({
define: {
explicitlySerialized: {
get: function () {
return true;
},
serialize: true
},
implicitlySerialized: {
get: function () {
return true;
}
},
'*': {
serialize: true
}
}
});
var vm = new VM();
vm.bind('change', function() {});
deepEqual(vm.serialize(), {
explicitlySerialized: true,
implicitlySerialized: true
});
});

10

can-map-define.js

@@ -220,2 +220,5 @@ var dev = require('can-util/js/dev/dev');

'boolean': function(val) {
if(val == null) {
return val;
}
if (val === 'false' || val === '0' || !val) {

@@ -275,4 +278,4 @@ return false;

}
// If there's a Type create a new instance of it
if (Type && !(newValue instanceof Type)) {
// If there's a Type and newValue is non-null create a new instance of it
if (Type && newValue != null && !(newValue instanceof Type)) {
newValue = new Type(newValue);

@@ -356,3 +359,4 @@ }

// check there is a serializer so we aren't doing extra work on serializer:false
serializer = this.define && this.define[attr] && this.define[attr].serialize;
// also check for a wildcard serializer
serializer = this.define && (this.define[attr] && this.define[attr].serialize || this.define['*'] && this.define['*'].serialize);
if (serializer) {

@@ -359,0 +363,0 @@ val = serializeProp(this, attr, this.attr(attr));

{
"name": "can-map-define",
"version": "3.0.0-pre.2",
"version": "3.0.0-pre.3",
"description": "Define rich attribute behavior",

@@ -27,3 +27,3 @@ "homepage": "https://canjs.com",

"build": "node build.js",
"document": "documentjs",
"document": "bit-docs",
"develop": "done-serve --static --develop --port 8080"

@@ -67,3 +67,9 @@ },

"devDependencies": {
"bit-docs": "0.0.7",
"can-component": "^3.0.0-pre.11",
"can-fixture": "^0.3.0",
"can-list": "^3.0.0-pre.1",
"can-model": "^2.3.11",
"can-route": "^3.0.0-pre.8",
"can-stache": "^3.0.0-pre.11",
"cssify": "^0.6.0",

@@ -79,3 +85,23 @@ "documentjs": "^0.4.2",

"testee": "^0.2.4"
},
"bit-docs": {
"dependencies": {
"bit-docs-glob-finder": "^0.0.5",
"bit-docs-dev": "^0.0.3",
"bit-docs-js": "^0.0.3",
"bit-docs-generate-readme": "^0.0.8"
},
"glob": {
"pattern": "**/*.{js,md}",
"ignore": [
"**/node_modules/*",
"node_modules/**/*",
"**/*{-,_,}{test,qunit}{s,}.js"
]
},
"readme": {
"apis": "./doc/apis.json"
},
"parent": "can-map-define"
}
}
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