# @fbem/core

> Functional BEM core

Latest version **2.0.13** (published 2023-12-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fbem/core
pnpm add @fbem/core
yarn add @fbem/core
bun add @fbem/core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.13 |
| Published | 2023-12-14 |
| First published | 2022-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Vladislav Ivanov |
| Maintainers | yungvldai |
| Keywords | bem, fbem, core |

## Links

- npm: https://www.npmjs.com/package/@fbem/core
- Repository: https://github.com/yungvldai/fbem
- Homepage: https://github.com/yungvldai/fbem/tree/master/packages/core
- Issues: https://github.com/yungvldai/fbem/issues
- npm.io page: https://npm.io/package/@fbem/core

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 2.0.13 (latest) — 2023-12-14
- 2.0.12 — 2022-12-18
- 2.0.11 — 2022-11-19
- 2.0.10 — 2022-11-19
- 2.0.7 — 2022-11-18
- 2.0.0 — 2022-11-16
- 1.0.8 — 2022-11-16
- 1.0.7 — 2022-11-15
- 1.0.6 — 2022-11-15
- 1.0.5 — 2022-11-15
- 1.0.4 — 2022-11-15
- 1.0.3 — 2022-11-14
- 1.0.2 — 2022-11-14
- 1.0.1 — 2022-11-14
- 1.0.0 — 2022-11-14

## README

# @fbem/core [![npm](https://img.shields.io/npm/v/@fbem/core)](https://www.npmjs.com/package/@fbem/core)

**@fbem/core** is a core package for functional BEM.
It provides utility for parsing BEM entities into BEM structure, 
which is used for code generation.

This package is base for all other packages. Basically you shouldn't use it.

## Getting started

```console
npm i @fbem/core
```

## Types

```typescript
type NamingOptions = {
  prefix: string;
  elem: string;
  modName: string;
  modVal: string;
};

type StringMod = {
  type: 'string';
  values: Record<string, string>;
};

type BooleanMod = {
  type: 'boolean';
  value: string;
};

type Mod = StringMod | BooleanMod;

type BemParams = {
  base: string;
  mods: Record<string, Mod>;
};

type BemFunctionName = string;

type BemStructure = Record<BemFunctionName, BemParams>;

const createBemStructure: (classesMap: Record<string, string>, naming: NamingOptions) => BemStructure;

const parseBem: (className: string, naming: NamingOptions) => {
  block: string;
  elem: string;
  modName: string;
  modVal: string;
}
```

## API

### `createBemStructure: (classesMap: Record<string, string>, naming: NamingOptions) => BemStructure`

#### Description
The function is used to convert a map of CSS classes into a structure that is used for code generation.

### `parseBem: (className: string, naming: NamingOptions) => { block: string; elem: string; modName: string; modVal: string; }`

#### Description
The function is used to parse the CSS class into its constituent entities.

---
_Source: https://npm.io/package/@fbem/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
