Skip to content

Commit 4d76f96

Browse files
committed
Changed name to follow snake_case convention
Added validation
1 parent e378778 commit 4d76f96

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,18 @@ function sort_nums(arr, reverse = false) {
165165

166166
/**
167167
* To get all the elements of an array with given key and value.
168-
* More like Where claus in php just for js array
168+
* More like Where clause in php just for js array
169169
*
170170
*
171-
* @param array arr
171+
* @param array arr
172172
* @param string key
173173
* @param string value
174174
* @param number value
175175
* @returns array
176176
*/
177-
178-
function getElementByKeyValue(arr,key,value){
179-
return arr.filter(item=>item[key]==value)
177+
function get_element_by_key_value(arr, key, value) {
178+
is_array(arr);
179+
return arr.filter((item) => item[key] == value);
180180
}
181181

182182
export {
@@ -194,5 +194,5 @@ export {
194194
array_sum,
195195
array_slice_sum,
196196
sort_nums,
197-
getElementByKeyValue,
197+
get_element_by_key_value,
198198
};

0 commit comments

Comments
 (0)