alunny / node-xcode

tools and utilities for working with xcode/ios projects
Apache License 2.0
227 stars 105 forks source link

Fix maximum callstack when merging two strings #114

Closed Mitko-Kerezov closed 6 years ago

Mitko-Kerezov commented 7 years ago

Whenever trying to merge two string values maximum callstack error is thrown. Fix it by simply returning the second occurrence rather than the first if the type of the values differs from object.

For a simple repro:

function merge_obj(obj, secondObj) {
        if (!obj)
        return secondObj;

         for(var i in secondObj)
             obj[i] = merge_obj(obj[i], secondObj[i]);

         return obj;
}

merge_obj("test", "other")

Ping @alunny for review.

Mitko-Kerezov commented 6 years ago

Ping @alunny, rebased on master

imhotep commented 6 years ago

@Mitko-Kerezov This repository is out of date and no longer maintained. Please head to https://github.com/apache/cordova-node-xcode (as stated in the README.md).