Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Ensure the "obj" passed as an argument has an object on @@can.meta
var ensureMeta = function ensureMeta(obj) {
var metaSymbol = canSymbol.for("can.meta");
var meta = obj[metaSymbol];
if (!meta) {
meta = {};
canReflect.setKeyValue(obj, metaSymbol, meta);
}
return meta;
};
// this is a very simple can-map like object
var SimpleMap = Construct.extend("SimpleMap",
{
// ### setup
// A setup function for the instantiation of a simple-map.
setup: function(initialData){
this._data = {};
if(initialData && typeof initialData === "object") {
this.attr(initialData);
}
},
// ### attr
// The main get/set interface simple-map.
// Either sets or gets one or more properties depending on how it is called.
attr: function(prop, value) {
var self = this;
if(arguments.length === 0 ) {
this.Map.prototype.setup = function(props){
if (connection.instanceStore.has( connection.id(props) )) {
return new Construct.ReturnValue( connection.hydrateInstance(props) );
}
return oldSetup.apply(this, arguments);
};
baseConnect.init.apply(this, arguments);