// Derived state. These are the posts that will actually be displayed
const searchedPosts = searchQuery.length > 0 ? posts.filter((post) => `${post.title} ${post.body}`.toLowerCase().includes(searchQuery.toLowerCase())) : posts;
# importing pandas as pd
import pandas as pd
# Creating the dataframe
df = pd.read_csv("nba.csv")
# Using regular expression to extract all
# columns which has letter 'a' or 'A' in its name.
df.filter(regex ='[aA]')
To Filter Model Array:
var filteredItems = unfilteredItems.filter { $0.cat == "garden" }
Arrange :
self.chatModelArray = self.chatModelArray.sorted { $0.time == $1.time }
To Filter name :
var filteredItems = unfilteredItems.filter { $0.name.localizedCaseInsensitiveContains(textField.text ?? "") }
To Filter an Array:
let result = arr.filter {$0.contains("ali")}
/**
* WooCommerce woocommerce_order_item_line_item_html action hook registeration.
*/
add_action('woocommerce_order_item_line_item_html', 'woocommerce_order_item_line_item_html', 1, 3);
/**
* Callback Listener for customised line item functionality in the admin.
*/
function woocommerce_order_item_line_item_html($item_id, $item, $order){
// Add your custom line item functionality.
// A good example would be order fulfillment for a line item.
}
//get list of buttons and make sure there are no duplicates
function displayButtons(){
const companies = products.reduce((total, item) => {
total.push(item.company)
total = [...new Set(total)]
return total
},['All'])
const buttons = companies.map((item) => {
return `<button class="company-btn">${item}</button>`
}).join('')
buttonsContainer.innerHTML = buttons
}
// or we could do this...
const someBtns = ['all',...new Set(products.map((product) => product.company)),];
console.log(someBtns)
Comments