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

can-map-define

Package Overview
Dependencies
Maintainers
10
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 4.0.0 to 4.1.0

51

can-map-define_test.js

@@ -7,6 +7,7 @@ /* jshint asi: false */

var compute = require('can-compute');
var canReflect = require('can-reflect');
require('./can-map-define');
QUnit.module('can/map/define');
QUnit.module('can-map-define');

@@ -1509,1 +1510,49 @@ // remove, type, default

});
QUnit.test("can.hasKey", function() {
var Parent = CanMap.extend({
define: {
parentProp: {
type: "*"
},
parentDerivedProp: {
get: function() {
if (this.parentProp) {
return "parentDerived";
}
}
}
}
});
var VM = Parent.extend({
define: {
prop: {
type: "*"
},
derivedProp: {
get: function() {
if (this.prop) {
return "derived";
}
}
}
}
});
var vm = new VM();
// hasKey
equal(canReflect.hasKey(vm, "prop"), true, "vm.hasKey('prop') true");
equal(canReflect.hasKey(vm, "derivedProp"), true, "vm.hasKey('derivedProp') true");
equal(canReflect.hasKey(vm, "parentProp"), true, "vm.hasKey('parentProp') true");
equal(canReflect.hasKey(vm, "parentDerivedProp"), true, "vm.hasKey('parentDerivedProp') true");
equal(canReflect.hasKey(vm, "anotherProp"), false, "vm.hasKey('anotherProp') false");
vm.attr('lateProp', 'something');
equal(canReflect.hasKey(vm, "lateProp"), true, "vm.hasKey('lateProp') true");
});

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

var compute = require('can-compute');
var canReflect = require('can-reflect');
require('can-list');

@@ -71,3 +72,2 @@

var oldSetupDefaults = CanMap.prototype._setupDefaults;

@@ -373,2 +373,10 @@ CanMap.prototype._setupDefaults = function(obj) {

canReflect.assignSymbols(proto, {
"can.hasKey": function(key) {
var defined = this.define && key in this.define;
var exists = this._data && key in this._data;
return defined || exists;
}
});
module.exports = define;

3

package.json
{
"name": "can-map-define",
"version": "4.0.0",
"version": "4.1.0",
"description": "Define rich attribute behavior",

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

"can-queues": "^1.0.1",
"can-reflect": "^1.15.2",
"can-util": "^3.9.0"

@@ -45,0 +46,0 @@ },

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