mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
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:
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user