Comparing version 0.3.0 to 0.4.0
12
index.js
@@ -65,2 +65,11 @@ "use strict"; | ||
function unIsolateArrayOfStrings(data) { | ||
for(var i = 0; i != data.length; i++) { | ||
if(typeof data[i] === "string") { | ||
data[i] = unIsolate(data[i]); | ||
} | ||
} | ||
} | ||
function unIsolateObject(keys, object) { | ||
@@ -71,2 +80,5 @@ for(var key in object) { | ||
} | ||
else if(key in keys && (object[key] instanceof Array)) { | ||
unIsolateArrayOfStrings(object[key]); | ||
} | ||
else { | ||
@@ -73,0 +85,0 @@ if(object[key] instanceof Array) { |
{ | ||
"name": "eh-guid", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "EverHelper working with guid", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -93,2 +93,17 @@ var | ||
}); | ||
it("unisolate object which have field of array of strings", function() { | ||
var obj = { | ||
globalId: ["1-test", "1-guid"] | ||
}; | ||
var g = new GlobalId({ | ||
userId: 1, | ||
keys: ["globalId"] | ||
}); | ||
g.unIsolate(obj); | ||
var expected = { | ||
globalId: ['test', 'guid'] | ||
}; | ||
obj.should.eql(expected); | ||
}); | ||
}); |
9389
386