Comparing version 1.1.3 to 1.1.4
@@ -10,3 +10,3 @@ (function (global, factory) { | ||
title: cycni | ||
version: 1.1.3 | ||
version: 1.1.4 | ||
license: mpl-2.0 | ||
@@ -50,2 +50,3 @@ author: alexander elias | ||
traverse: function (collection, path, callback) { | ||
path = typeof path === 'number' ? path.toString() : path; | ||
path = typeof path === 'string' ? this.paths(path) : path; | ||
@@ -97,5 +98,4 @@ | ||
delete c[k]; | ||
return collection[k]; | ||
} else if (c.constructor.name === 'Array') { | ||
return c.splice(k, 1)[0]; | ||
c.splice(k, 1); | ||
} | ||
@@ -102,0 +102,0 @@ }); |
/* | ||
@preserve | ||
title: cycni | ||
version: 1.1.3 | ||
version: 1.1.4 | ||
license: mpl-2.0 | ||
author: alexander elias | ||
*/ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b():'function'==typeof define&&define.amd?define('Cycni',b):a.Cycni=b()})(this,function(){'use strict';return{clone:function(b){var d;if(null===b||b===void 0||'object'!=typeof b)return b;if('Date'===b.constructor.name)d=new Date,d.setTime(b.getTime());else if('Array'===b.constructor.name){d=[];for(var e=0,f=b.length;e<f;e++)d[e]=this.clone(b[e])}else if('Object'===b.constructor.name)for(var g in d={},b)b.hasOwnProperty(g)&&(d[g]=this.clone(b[g]));else throw new Error('Unable to clone variable. Type is not supported');return d},paths:function(b){return b.split('.')},traverse:function(b,d,e){d='string'==typeof d?this.paths(d):d;var f,g=0,h=d.length,j=0===h?0:h-1;for(g;g<h;g++){if(f=d[g],g==j)return e.call(this,b,f);b=b[f]}},set:function(b,d,e){return this.traverse(b,d,function(f,g){return f[g]=e})},get:function(b,d){return this.traverse(b,d,function(e,f){return e[f]})},has:function(b,d,e){return this.traverse(b,d,function(f,g){return'Function'===e.constructor.name?e(f[g])||!1:'RegExp'===e.constructor.name?e.test(f[g]):f[g]===e})},remove:function(b,d){return this.traverse(b,d,function(e,f){return'Object'===e.constructor.name?(delete e[f],b[f]):'Array'===e.constructor.name?e.splice(f,1)[0]:void 0})}}}); | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b():'function'==typeof define&&define.amd?define('Cycni',b):a.Cycni=b()})(this,function(){'use strict';return{clone:function(b){var d;if(null===b||b===void 0||'object'!=typeof b)return b;if('Date'===b.constructor.name)d=new Date,d.setTime(b.getTime());else if('Array'===b.constructor.name){d=[];for(var e=0,f=b.length;e<f;e++)d[e]=this.clone(b[e])}else if('Object'===b.constructor.name)for(var g in d={},b)b.hasOwnProperty(g)&&(d[g]=this.clone(b[g]));else throw new Error('Unable to clone variable. Type is not supported');return d},paths:function(b){return b.split('.')},traverse:function(b,d,e){d='number'==typeof d?d.toString():d,d='string'==typeof d?this.paths(d):d;var f,g=0,h=d.length,j=0===h?0:h-1;for(g;g<h;g++){if(f=d[g],g==j)return e.call(this,b,f);b=b[f]}},set:function(b,d,e){return this.traverse(b,d,function(f,g){return f[g]=e})},get:function(b,d){return this.traverse(b,d,function(e,f){return e[f]})},has:function(b,d,e){return this.traverse(b,d,function(f,g){return'Function'===e.constructor.name?e(f[g])||!1:'RegExp'===e.constructor.name?e.test(f[g]):f[g]===e})},remove:function(b,d){return this.traverse(b,d,function(e,f){'Object'===e.constructor.name?delete e[f]:'Array'===e.constructor.name&&e.splice(f,1)})}}}); |
{ | ||
"name": "cycni", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Collection manipulation tool.", | ||
@@ -5,0 +5,0 @@ "browser": "dist/cycni.min.js", |
/* | ||
@preserve | ||
title: cycni | ||
version: 1.1.3 | ||
version: 1.1.4 | ||
license: mpl-2.0 | ||
@@ -43,2 +43,3 @@ author: alexander elias | ||
traverse: function (collection, path, callback) { | ||
path = typeof path === 'number' ? path.toString() : path; | ||
path = typeof path === 'string' ? this.paths(path) : path; | ||
@@ -90,5 +91,4 @@ | ||
delete c[k]; | ||
return collection[k]; | ||
} else if (c.constructor.name === 'Array') { | ||
return c.splice(k, 1)[0]; | ||
c.splice(k, 1); | ||
} | ||
@@ -95,0 +95,0 @@ }); |
33807