forked from vortex-design/bem-neon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbem.node.d.ts
38 lines (35 loc) · 838 Bytes
/
bem.node.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export type BEMElement<TName extends string, TModifiers extends string[]> = {
name: TName
modifiers: TModifiers
}
export type BEMBlock<
TName extends string,
TElements extends BEMElement<string, string[]>[],
TModifiers extends string[]
> = BEMElement<TName, TModifiers> & {
elements: TElements
}
/**
* @param bem Raw (unparsed) BEM input string.
* @see https://crates.io/crates/bem
* @example
* parseBEM('foo[bar,baz]\nqux')
* {
* name: 'foo',
* modifiers: [ 'bar', 'baz' ],
* elements: [ { name: 'qux', modifiers: [] } ]
* }
*
* @example
parseBEM('!')
// Uncaught TypeError: Failed to parse BEM: Pest parsing error: --> 1:1
// |
// 1 | !
// | ^---
// |
// = expected name
@throws TypeError
*/
export declare function parseBEM(
bem: string
): BEMBlock<string, BEMElement<string, string[]>[], string[]>