Fix string multiplication with a value between 0.0 and 1.0
This commit fixes a regression of 6306ac8966.
This commit is contained in:
1 parent
af57893bc2
commit
88b45771bd
2 files changed
+6
-1
No files matched your search
+2
-1
@@ -360,7 +360,8 @@ static jv f_multiply(jq_state *jq, jv input, jv a, jv b) {
|
||||
num = a;
|
||||
}
|
||||
jv res = jv_null();
|
||||
int n = jv_number_value(num);
|
||||
double d = jv_number_value(num);
|
||||
int n = 0.0 < d && d < 1.0 ? 1 : d;
|
||||
if (n > 0) {
|
||||
size_t alen = jv_string_length_bytes(jv_copy(str));
|
||||
res = jv_string_empty(alen * n);
|
||||
|
||||
@@ -1284,6 +1284,10 @@ indices(", ")
|
||||
["a", "ab", "abc"]
|
||||
["aaa", "ababab", "abcabcabc"]
|
||||
|
||||
[.[] * "abc"]
|
||||
[-1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 3.7, 10.0]
|
||||
[null,null,null,"abc","abc","abc","abcabcabc","abcabcabcabcabcabcabcabcabcabc"]
|
||||
|
||||
[.[] / ","]
|
||||
["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"]
|
||||
[["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]]
|
||||
|
||||
Reference in new issue
Block a user