Skip to content

Commit 7b13076

Browse files
committed
Update to 1.1.4
1 parent 4b9f9db commit 7b13076

File tree

1 file changed

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

1 file changed

+25
-1
lines changed

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

Lines changed: 25 additions & 1 deletion
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.3
7+
* @version 1.0.4
88
*
99
*/
1010
public class JsArray {
@@ -75,4 +75,28 @@ public static String addAll(String array,String elements) {
7575
public static String removeByProperty(String array,String property,String value) {
7676
return array+".splice("+array+".findIndex(e => e."+property+"=="+value+"),1);";
7777
}
78+
79+
public static String findByProperty(String array,String property,String value) {
80+
return array+".find(e => e."+property+"=="+value+");";
81+
}
82+
83+
public static String findIndexByProperty(String array,String property,String value) {
84+
return array+".findIndex(e => e."+property+"=="+value+");";
85+
}
86+
87+
public static String containsByProperty(String array,String property,String value) {
88+
return array+".findIndex(e => e."+property+"=="+value+")>-1;";
89+
}
90+
91+
public static String contains(String array,String element) {
92+
return array+".indexOf("+element+")>-1;";
93+
}
94+
95+
public static String letFindByProperty(String variable,String array,String property,String value) {
96+
return "let "+variable+"="+findByProperty(array,property,value);
97+
}
98+
99+
public static String letRemoveByProperty(String variable,String array,String property,String value) {
100+
return "let "+variable+"="+removeByProperty(array,property,value);
101+
}
78102
}

0 commit comments

Comments
 (0)