Skip to content

Commit 933cac2

Browse files
committed
Fix jsArray pb with remove and replace
1 parent 23fd73a commit 933cac2

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/io/github/jeemv/springboot/vuejs/utilities

1 file changed

+3
-3
lines changed

src/main/java/io/github/jeemv/springboot/vuejs/utilities/JsArray.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* JsArray Javascript array utilities This class is part of springBoot-VueJS
55
*
66
* @author jcheron myaddressmail@gmail.com
7-
* @version 1.0.1
7+
* @version 1.0.2
88
*
99
*/
1010
public class JsArray {
@@ -17,7 +17,7 @@ public class JsArray {
1717
* @return
1818
*/
1919
public static String remove(String array, String element) {
20-
return array + ".splice(array.indexOf(" + element + "), 1);";
20+
return array + ".splice(" + array + ".indexOf(" + element + "), 1);";
2121
}
2222

2323
/**
@@ -52,6 +52,6 @@ public static String add(String array, String element) {
5252
* @return
5353
*/
5454
public static String addOrReplace(String array, String index, String element) {
55-
return "if(" + index + ">-1){" + replace(" + array + ", index, element) + "}else{" + add(" + array + ", element) + "}";
55+
return "if(" + index + ">-1){" + replace(array, index, element) + "}else{" + add(array, element) + "}";
5656
}
5757
}

0 commit comments

Comments
 (0)