New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@fbem/utils

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fbem/utils

Functional BEM utils

latest
Source
npmnpm
Version
2.0.17
Version published
Maintainers
1
Created
Source

@fbem/utils npm

@fbem/utils is a package which contains useful utils for functional BEM.

Getting started

npm i @fbem/utils

API

compose: (...fns: BemFunction[]) => BemFunction

Description

Use this function when you have multiple style files (e.g. a separate file for each modifier) ​​to compose different BEM functions into one. compose merges interfaces fields and their types. Take a look below.

Example #1

import { compose } from '@fbem/utils';
// or import compose from '@fbem/utils/dist/compose';

import { cnButton as modDisabled } from './_disabled/button_disabled.css';
import { cnButton as modStyle } from './_style/button_style.css';
import { cnButton as base } from './button.css';

const cnButton = compose(base, modDisabled, modStyle);

cnButton({ style: 'flat', disabled: true }, ['mix']); // 'button button_style_flat button_disabled mix'

Example #2

import { compose } from '@fbem/utils';
// or import compose from '@fbem/utils/dist/compose';

import { cnButton as modTypePrimary } from './_type/_primary/button_type_primary.css';
import { cnButton as modTypeSecondary } from './_type/_secondary/button_type_secondary.css';
import { cnButton as base } from './button.css';

const cnButton = compose(base, modTypePrimary, modTypeSecondary);

cnButton({ type: 'primary' }); // 'button button_type_primary'

Keywords

bem

FAQs

Package last updated on 14 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts