/
lostSun
/
project-client-server-apps
Обзор
Документация
Войти
/
lostSun
/
project-client-server-apps
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/postcss-import/lib/join-media.js
28 строк
872 B
1lostsun
initial commit
05 май 2025, 11:35
05 май 2025, 11:35
fe8f535
Код
Авторство
О чём код?
"use strict" const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i module.exports = function (parentMedia, childMedia) { if (!parentMedia.length && childMedia.length) return childMedia if (parentMedia.length && !childMedia.length) return parentMedia if (!parentMedia.length && !childMedia.length) return [] const media = [] parentMedia.forEach(parentItem => { const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem) childMedia.forEach(childItem => { const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem) if (parentItem !== childItem) { if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) { media.push(`${childItem} and ${parentItem}`) } else { media.push(`${parentItem} and ${childItem}`) } } }) }) return media }