We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 14f1d2e + e233ff2 commit e378778Copy full SHA for e378778
index.js
@@ -163,6 +163,22 @@ function sort_nums(arr, reverse = false) {
163
}
164
165
166
+/**
167
+ * To get all the elements of an array with given key and value.
168
+ * More like Where claus in php just for js array
169
+ *
170
171
+ * @param array arr
172
+ * @param string key
173
+ * @param string value
174
+ * @param number value
175
+ * @returns array
176
+ */
177
+
178
+function getElementByKeyValue(arr,key,value){
179
+ return arr.filter(item=>item[key]==value)
180
+}
181
182
export {
183
is_array,
184
is_num_array,
@@ -178,4 +194,5 @@ export {
194
array_sum,
195
array_slice_sum,
196
sort_nums,
197
+ getElementByKeyValue,
198
};
0 commit comments