Skip to content

Commit

Permalink
Deprecate cid-map and cid-set
Browse files Browse the repository at this point in the history
  • Loading branch information
imaustink committed Sep 29, 2017
1 parent d184050 commit fce3514
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 254 deletions.
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion dom/events/make-mutation-event/make-mutation-event.js
Expand Up @@ -9,7 +9,7 @@ var getMutationObserver = require("can-globals/mutation-observer/mutation-observ
var domDispatch = require("../../dispatch/dispatch");
var mutationDocument = require("../../mutation-observer/document/document");
var getDocument = require('can-globals/document/document');
var CIDMap = require("../../../js/cid-map/cid-map");
var CIDMap = require("can-cid/map/map");
var string = require("../../../js/string/string");

require("../../is-of-global-document/is-of-global-document");
Expand Down
2 changes: 1 addition & 1 deletion dom/mutation-observer/document/document.js
Expand Up @@ -4,7 +4,7 @@ var getDocument = require('can-globals/document/document');
var domDataState = require("can-dom-data-state");
var getMutationObserver = require("can-globals/mutation-observer/mutation-observer");
var each = require("../../../js/each/each");
var CIDStore = require("../../../js/cid-set/cid-set");
var CIDStore = require("can-cid/set/set");
var makeArray = require("../../../js/make-array/make-array");
var string = require("../../../js/string/string");

Expand Down
49 changes: 0 additions & 49 deletions js/cid-map/cid-map-test.js

This file was deleted.

56 changes: 10 additions & 46 deletions js/cid-map/cid-map.js
@@ -1,51 +1,15 @@
'use strict';

var GLOBAL = require('can-globals/global/global');
var each = require("../each/each");
var getCID = require("../cid/get-cid");
//var canDev = require("can-util/js/dev/dev");

var CIDMap;
/**
* @module can-util/js/cid-map/cid-map cid-map
* @parent can-util/js
* @description Deprecated. Use [can-cid/map/map] instead.
*/

if(GLOBAL().Map) {
CIDMap = GLOBAL().Map;
} else {
var CIDMap = function(){
this.values = {};
};
CIDMap.prototype.set = function(key, value){
this.values[getCID(key)] = {key: key, value: value};
};
CIDMap.prototype["delete"] = function(key){
var has = getCID(key) in this.values;
if(has) {
delete this.values[getCID(key)];
}
return has;
};
CIDMap.prototype.forEach = function(cb, thisArg) {
each(this.values, function(pair){
return cb.call(thisArg || this, pair.value, pair.key, this);
}, this);
};
CIDMap.prototype.has = function(key) {
return getCID(key) in this.values;
};
CIDMap.prototype.get = function(key) {
var obj = this.values[getCID(key)];
return obj && obj.value;
};
CIDMap.prototype.clear = function(key) {
return this.values = {};
};
Object.defineProperty(CIDMap.prototype,"size",{
get: function(){
var size = 0;
each(this.values, function(){
size++;
});
return size;
}
});
}
//!steal-remove-start
// canDev.warn('js/cid-map/cid-map is deprecated; please use can-globals instead: https://github.com/canjs/can-cid');
//!steal-remove-end

module.exports = CIDMap;
module.exports = require('can-cid/map/map');
34 changes: 0 additions & 34 deletions js/cid-map/cid-map.md

This file was deleted.

46 changes: 0 additions & 46 deletions js/cid-set/cid-set-test.js

This file was deleted.

50 changes: 10 additions & 40 deletions js/cid-set/cid-set.js
@@ -1,45 +1,15 @@
'use strict';

var GLOBAL = require('can-globals/global/global');
var each = require("../each/each");
var getCID = require("../cid/get-cid");
//var canDev = require("can-util/js/dev/dev");

var CIDSet;
/**
* @module can-util/js/cid-set/cid-set cid-set
* @parent can-util/js
* @description Deprecated. Use [can-cid/set/set] instead.
*/

if(GLOBAL().Set) {
CIDSet = GLOBAL().Set;
} else {
var CIDSet = function(){
this.values = {};
};
CIDSet.prototype.add = function(value){
this.values[getCID(value)] = value;
};
CIDSet.prototype["delete"] = function(key){
var has = getCID(key) in this.values;
if(has) {
delete this.values[getCID(key)];
}
return has;
};
CIDSet.prototype.forEach = function(cb, thisArg) {
each(this.values, cb, thisArg);
};
CIDSet.prototype.has = function(value) {
return (getCID(value) in this.values);
};
CIDSet.prototype.clear = function(key) {
return this.values = {};
};
Object.defineProperty(CIDSet.prototype,"size",{
get: function(){
var size = 0;
each(this.values, function(){
size++;
});
return size;
}
});
}
//!steal-remove-start
// canDev.warn('js/cid-set/cid-set is deprecated; please use can-globals instead: https://github.com/canjs/can-cid');
//!steal-remove-end

module.exports = CIDSet;
module.exports = require('can-cid/set/set');
34 changes: 0 additions & 34 deletions js/cid-set/cid-set.md

This file was deleted.

2 changes: 0 additions & 2 deletions js/tests.js
Expand Up @@ -2,8 +2,6 @@

require('./assign-non-enumerable/assign-non-enumerable-test');
require('./base-url/base-url-test');
require('./cid-map/cid-map-test');
require('./cid-set/cid-set-test');

require('./deep-assign/deep-assign-test');
require('./defaults/defaults-test');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"can-ajax": "^1.0.0",
"can-assign": "^1.0.0",
"can-cid": "^1.0.0",
"can-cid": "^1.1.0",
"can-deparam": "^1.0.0",
"can-dom-data-state": "^0.1.0",
"can-event-dom-enter": "^1.0.0",
Expand Down

0 comments on commit fce3514

Please sign in to comment.