bem / bem-sdk

BEM SDK packages
https://en.bem.info/toolbox/sdk/
88 stars 25 forks source link

stringify: return `undefined` if impossible to stringify BEM notation #55

Closed blond closed 8 years ago

blond commented 9 years ago

now need use try..catch:

try {
    var str = bemNaming.stringify({ elem: 'elem' });
} catch(e) { /* ... */ }

it will be easier to check for an empty string:

var str = bemNaming.stringify({ elem: 'elem' });

if (str) {
    /* ... */ 
}
tadatuta commented 9 years ago

I think semantically it should be undefined (like in sentence «BEM entity is undefined»)

blond commented 9 years ago

I think semantically it should be undefined (like in sentence «BEM entity is undefined»)

yep, it's better