Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
furcan committed Nov 11, 2022
1 parent b2c5911 commit 56ab861
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Notiflix
* Description: Next.js configuration.
* Version: 1.0.0
* Author: Furkan MT ('https://github.com/furcan')
* Author: Furkan ('https://github.com/furcan')
* Copyright 2019-Present Notiflix, GPL-3.0 License ('https://opensource.org/licenses/GPL-3.0')
*/

Expand Down
2 changes: 1 addition & 1 deletion src/_database/app/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _dbAppMeta:
metaDescription: Notiflix is a pure JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more to that makes your web projects much better.
metaRobots: noindex, nofollow, noodp, noydir
metaYearInit: 2019.
metaAuthor: 'Furkan MT - https://github.com/furcan'
metaAuthor: 'Furkan - https://github.com/furcan'
metaCopyright: All Rights Reserved.
metaThemeColor: "#32c682"
metaTwitterUser: "@notiflixjs"
Expand Down
12 changes: 6 additions & 6 deletions src/application/helpers/utilities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ const isString = (value: unknown): value is string => typeof value === 'string'

const isObject = (args: unknown): args is Record<string, unknown> => typeof args === 'object' || args instanceof Object;

const classNamesCombiner = (names: (string | null)[]): string => names.filter((name) => isString(name)).join(' ');
const classNamesCombine = (names: (string | null)[]): string => names.filter((name) => isString(name)).join(' ');

const classNamesReplacer = (text: string): string | null => text.replace(/\s/gm, '') || null;
const classNamesTrim = (text: string): string | null => text.trim() || null;

type TClassNamesParamAll = string | number | boolean | undefined | null;
type TClassNamesParamObject = Record<string, TClassNamesParamAll>;
type TClassNamesParams = TClassNamesParamAll | TClassNamesParamObject;

const classNames = (...params: TClassNamesParams[]): string => classNamesCombiner(
const classNames = (...params: TClassNamesParams[]): string => classNamesCombine(
params.map((param) => {
if (isString(param)) {
return classNamesReplacer(param);
return classNamesTrim(param);
}

if (isObject(param)) {
return classNamesCombiner(Object.entries(param).map(([key, value]) => {
return classNamesCombine(Object.entries(param).map(([key, value]) => {
if (isString(key) && value === true) {
return classNamesReplacer(key);
return classNamesTrim(key);
}
return null;
}));
Expand Down

0 comments on commit 56ab861

Please sign in to comment.