File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ describe(bem2arr.name, () => {
1515 [ { base : true } , "base" ] ,
1616 [ { base : "mod" } , "base base--mod" ] ,
1717 //@ts -expect-error //TODO #40
18- [ { base : [ "mod" ] } , "base base--0-- mod" /* TODO #40 "base base--mod"*/ ] ,
18+ [ { base : [ "mod" ] } , "base base--mod" /* TODO #40 "base base--mod"*/ ] ,
1919 //@ts -expect-error //TODO #40
2020 [ { base : [ false ] } , "base" ] ,
2121 [ { base : { } } , "base" ] ,
Original file line number Diff line number Diff line change 11import type { BemInGeneral } from "./bem.types"
22
3+ const { isArray : $isArray } = Array
4+
35let modDelimiter = "--"
46, elementDelimiter = "__"
57
@@ -29,12 +31,19 @@ function bem2arr(query: BemInGeneral) {
2931 continue
3032 }
3133
34+ const isArray = $isArray ( baseQ )
35+
36+ // TODO check performance of `const in Array`
3237 for ( const mod in baseQ ) {
3338 const modValue = baseQ [ mod ]
3439 if ( ! modValue )
3540 continue
3641
37- $return . push ( `${ base } ${ modDelimiter } ${ mod } ${
42+ $return . push ( `${ base } ${
43+ isArray
44+ ? ""
45+ : `${ modDelimiter } ${ mod } `
46+ } ${
3847 typeof modValue !== "string"
3948 ? ""
4049 : `${ modDelimiter } ${ modValue } `
You can’t perform that action at this time.
0 commit comments