This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Filters an array of objects using custom predicates. | |
| * | |
| * @param {Array} array: the array to filter | |
| * @param {Object} filters: an object with the filter criteria | |
| * @return {Array} | |
| */ | |
| function filterArray(array, filters) { | |
| const filterKeys = Object.keys(filters); | |
| return array.filter(item => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /// result from db | |
| // cause_id/cause_parent_id are for the relation parent/child | |
| // challangers is the name of children array | |
| $db_result = array( | |
| array( | |
| "cause_id" => 1, | |
| "cause_parent_id" => 1, | |
| "name" => "my title 1" | |
| ), |