Support multiple value while identify image.

When metadata has multiple value like keywords parser(./lib/getters.js)
just take the last because parser override the previous value.
Instead of override this commit cast it to array.
master
N.Ardi 8 years ago
parent d8e8d84b6e
commit 6cd305da48
  1. 16
      lib/getters.js

@ -228,7 +228,20 @@ module.exports = function (gm) {
level = indent;
if (val) {
o[key] = val;
// if previous key was exist and we got the same key
// cast it to an array.
if(o.hasOwnProperty(key)){
// cast it to an array and dont forget the previous value
if(!Array.isArray(o[key])){
var tmp = o[key];
o[key] = [tmp];
}
// set value
o[key].push(val);
} else {
o[key] = val;
}
if (key in helper) {
helper[key](o, val);
@ -330,3 +343,4 @@ module.exports = function (gm) {
}
};
}

Loading…
Cancel
Save