@tadatuta said this module should ~store~ stringify entities since it's called bemjson2decl and decl is a file ...bemdecl.js (we've made an issue for that: #13)
I'm see we need to make public API clear, write docs and work on consistency between bem-sdk modules.
What we have:
convert(bemjson): BemEntityName[]
stringify(bemjson): String - returns formatted string with decl content, like bemDecl.stringify do, not sure we need a clone.
What I expect:
export function instead of object that will do the same as convert do but return BemCell[]: function(bemjson): BemCell[]
prob drop stringify(bemjson) since we have bemDecl, or, as @tadatuta said, just alias it to bemDecl.stringify and add opts with format and exportType params.
Something ilke:
module.exports = bemjsonToDecl;
bemjsonToDecl.convert = bemjsonToDecl; // To not make back-incomp changes
bemjsonToDecl.stringify = (bemjson, opts) => bemDecl.stringify(bemjsonToDecl(bemjson), opts);
function bemjsonToDecl(bemjson) {
...
}
@tadatuta said this module should ~store~ stringify entities since it's called
bemjson2decl
anddecl
is a file...bemdecl.js
(we've made an issue for that: #13)I'm see we need to make public API clear, write docs and work on consistency between bem-sdk modules.
What we have:
convert(bemjson): BemEntityName[]
stringify(bemjson): String
- returns formatted string with decl content, likebemDecl.stringify
do, not sure we need a clone.What I expect:
convert
do but returnBemCell[]
:function(bemjson): BemCell[]
stringify(bemjson)
since we havebemDecl
, or, as @tadatuta said, just alias it tobemDecl.stringify
and addopts
withformat
andexportType
params.Something ilke: