mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
11 lines
389 B
TypeScript
11 lines
389 B
TypeScript
import { flatten, isEmpty } from '~/utils/ramda';
|
|
|
|
export const splitTextByYoutube = (strings: string[]): string[] =>
|
|
flatten(
|
|
strings.map(str =>
|
|
str.split(/(https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch)?(?:\?v=)?[\w\-&=]+)/)
|
|
)
|
|
);
|
|
|
|
export const splitTextOmitEmpty = (strings: string[]): string[] =>
|
|
strings.map(el => el.trim()).filter(el => !isEmpty(el));
|