mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
feat: rating for dishes
This commit is contained in:
@@ -12,21 +12,16 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import glob from 'glob';
|
||||
import {glob} from 'glob';
|
||||
import {readFileSync} from 'fs';
|
||||
import {matchPropertyContent, matchTagProperties} from '../src/app/util/ion-icon/icon-match';
|
||||
|
||||
const globPromise = (pattern: string) =>
|
||||
new Promise<string[]>((resolve, reject) =>
|
||||
glob(pattern, (error, files) => (error ? reject(error) : resolve(files))),
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export async function getUsedIconsHtml(glob = 'src/**/*.html'): Promise<Record<string, string[]>> {
|
||||
export async function getUsedIconsHtml(pattern = 'src/**/*.html'): Promise<Record<string, string[]>> {
|
||||
return Object.fromEntries(
|
||||
(await globPromise(glob))
|
||||
(await glob(pattern))
|
||||
.map(file => [
|
||||
file,
|
||||
(readFileSync(file, 'utf8')
|
||||
@@ -43,9 +38,9 @@ export async function getUsedIconsHtml(glob = 'src/**/*.html'): Promise<Record<s
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export async function getUsedIconsTS(glob = 'src/**/*.ts'): Promise<Record<string, string[]>> {
|
||||
export async function getUsedIconsTS(pattern = 'src/**/*.ts'): Promise<Record<string, string[]>> {
|
||||
return Object.fromEntries(
|
||||
(await globPromise(glob))
|
||||
(await glob(pattern))
|
||||
.map(file => [file, readFileSync(file, 'utf8').match(/(?<=Icon`)[\w-]+(?=`)/g) || []])
|
||||
.filter(([, values]) => values.length > 0),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user