Add a recursive object merge strategy and bind it to *

This commit adds a jv_object_merge_recursive function, that performs
recursive object merging, and binds it to multiply when applied to
two objects.

Added docs and tests.

Closes #320
This commit is contained in:
Filippo Valsorda committed 2014-03-08 03:56:05 +01:00
1 parent 219bb9ecb7
commit 2aa8a43c5b
5 files changed
+44 -1

No files matched your search

+2
View File
@@ -172,6 +172,8 @@ static jv f_multiply(jv input, jv a, jv b) {
return jv_null();
}
return res;
} else if (jv_get_kind(a) == JV_KIND_OBJECT && jv_get_kind(b) == JV_KIND_OBJECT) {
return jv_object_merge_recursive(a, b);
} else {
return type_error2(a, b, "cannot be multiplied");
}