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

can-map

Package Overview
Dependencies
Maintainers
7
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-map - npm Package Compare versions

Comparing version

to
4.0.0-pre.5

58

can-map_test.js

@@ -483,1 +483,59 @@ /* jshint asi:true */

});
QUnit.test("can.onInstancePatches", function(){
var Person = Map.extend({
first: "any",
last: "any"
});
var calls = [];
function handler(obj, patches) {
calls.push([obj, patches]);
}
Person[canSymbol.for("can.onInstancePatches")](handler);
var person = new Person({first: "Justin", last: "Meyer"});
canReflect.setKeyValue(person,"first", "Payal");
canReflect.setKeyValue(person,"last", "Shah");
canReflect.setKeyValue(person,"middle", "p");
Person[canSymbol.for("can.offInstancePatches")](handler);
canReflect.setKeyValue(person,"first", "Ramiya");
canReflect.setKeyValue(person,"last", "Mayer");
canReflect.setKeyValue(person,"middle", "P");
QUnit.deepEqual(calls,[
[person, [{type: "set", key: "first", value: "Payal"} ] ],
[person, [{type: "set", key: "last", value: "Shah"} ] ],
[person, [{type: "set", key: "middle", value: "p"} ] ]
]);
});
QUnit.test("can.onInstanceBoundChange basics", function(){
var Person = Map.extend({
first: "any",
last: "any"
});
var calls = [];
function handler(obj, patches) {
calls.push([obj, patches]);
}
Person[canSymbol.for("can.onInstanceBoundChange")](handler);
var person = new Person({first: "Justin", last: "Meyer"});
var bindHandler = function(){};
canReflect.onKeyValue(person,"first", bindHandler);
canReflect.offKeyValue(person,"first", bindHandler);
Person[canSymbol.for("can.offInstanceBoundChange")](handler);
canReflect.onKeyValue(person,"first", bindHandler);
canReflect.offKeyValue(person,"first", bindHandler);
QUnit.deepEqual(calls,[
[person, true ],
[person, false ]
]);
});

8

can-map.js

@@ -20,2 +20,3 @@ /* jshint -W079 */

var canEvent = require('can-event-queue');
var addTypeEvents = require("can-event-queue/type-events/type-events");
var Construct = require('can-construct');

@@ -67,3 +68,3 @@ var ObservationRecorder = require('can-observation-recorder');

if (Map) {
addTypeEvents(this);
// Provide warnings if can.Map is used incorrectly.

@@ -511,3 +512,4 @@ //!steal-remove-start

target: this,
batchNum: batchNum
batchNum: batchNum,
patches: [{type: "set", key: attr, value: newVal}]
}, [newVal, oldVal]);

@@ -546,3 +548,3 @@

computedBinding.count = 1;
canReflect.onValue(computedBinding.compute, computedBinding.handler);
canReflect.onValue(computedBinding.compute, computedBinding.handler, "notify");
} else {

@@ -549,0 +551,0 @@ computedBinding.count++;

{
"name": "can-map",
"version": "4.0.0-pre.4",
"version": "4.0.0-pre.5",
"description": "Observable Objects",

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