diff --git a/assets/collection/collection.js b/assets/collection/collection.js
index c9cb0c6..714859a 100644
--- a/assets/collection/collection.js
+++ b/assets/collection/collection.js
@@ -1,4 +1,7 @@
/** @module collection */
+/**
+ * в разработке
+ */
kit.PluginManager.register('Collection',function(module, exports, require, global) {
var support = require('support');
@@ -42,7 +45,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
/**
* @param key
* @param value
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.set = Collection.prototype.put = function (key, value) {
this.data[key] = value;
@@ -50,7 +53,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
};
/**
* @param value
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.push = function (value) {
if(this.type === 'Array') {
@@ -77,7 +80,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
};
/**
* @param callback
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.map = function (callback) {
var res = getSimilarInstance(this.type);
@@ -88,7 +91,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
};
/**
* @param callback
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.each = function (callback = true) {
var BreakException = {}, keys, i, key;
@@ -108,7 +111,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
};
/**
* @param callback
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.eachReverse = function (callback = true) {
var BreakException = {}, keys, i, key;
@@ -128,7 +131,7 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
};
/**
* @param callback
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.filter = function (callback = filter) {
var res = getSimilarInstance(this.type);
@@ -186,14 +189,34 @@ kit.PluginManager.register('Collection',function(module, exports, require, globa
});
return res;
};
+ Collection.prototype.forget = function (key) {
+ key = '' + valueEx(key);
+ if(!this.has(key)) {
+ return this;
+ }
+ switch (this.type) {
+ case 'Array':
+ case 'object':
+ delete this.data[key];
+ break;
+ case 'NodeList':
+ var newCollection = this.filter(function (v, k, arr) {
+ return key !== Number(k).toString();
+ });
+ this.data = newCollection.data;
+ break;
+ default:
+ }
+ return this;
+ };
/**
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.keys = function () {
return new Collection(Object.keys(this.data));
};
/**
- * @return {kitCore.Collection}
+ * @return {kit.Collection}
*/
Collection.prototype.dump = Collection.prototype.dd = function () {
console.log('Collection', this.data);
diff --git a/tests/kit.Collection.php b/tests/kit.Collection.php
index 62d18c6..7aa51a2 100644
--- a/tests/kit.Collection.php
+++ b/tests/kit.Collection.php
@@ -2,6 +2,14 @@
+
+$x = [];
+
+$x[10] = 10;
+$x[1] = 1;
+print_r($x);
+
+?>