Welcome to mirror list, hosted at ThFree Co, Russian Federation.

utils.js « shared « analytics « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 52901d4c5bbfc86bb4fb47b44c5163d9efc7a776 (plain)
1
2
3
4
5
6
7
8
9
import dateFormat from 'dateformat';
import { dateFormats } from './constants';

export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => {
  if (!searchTerm?.length) return data;
  return data.filter((item) => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase()));
};

export const toYmd = (date) => dateFormat(date, dateFormats.isoDate);