Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public getProducts(name: string, limit: number): Array<Product> {
- const search = '.*' + name + '.*';
- const searchBegining = new RegExp(search, 'g');
- return this.products.filter((product: Product) => {
- console.log(searchBegining);
- console.log(searchBegining.test(product.getName()));
- return searchBegining.test(product.getName());
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement