bem-sdk-archive / bem-decl

:capital_abcd: Manage declaration of BEM entities. DEPRECATED →
https://github.com/bem/bem-sdk/tree/master/packages/decl
Other
11 stars 3 forks source link

subtract, merge, intersect methods should work with bemfiles #48

Closed qfox closed 7 years ago

qfox commented 8 years ago

BemFile is a structure that has entity and tech. Normalize v2 returns items as bemfiles. bem-graph also uses this format to operate with deps.

Seems like we should support it everywhere.

qfox commented 8 years ago

Cross tech decl algebra:

// U — merge
[{ entity: A }] U [{ entity: A, tech: '1' }] →
    → [{ entity: A }, { entity: A, tech: '1' }] // Because any tech can be not '1' in result
[{ entity: A, tech: '1' }] U [{ entity: A, tech: '2' }] →
    → [{ entity: A, tech: '1' }, { entity: A, tech: '2' }]

// / — subtract
[{ entity: A }] / [{ entity: A, tech: 'specified' }] → [{ entity: A }]
[{ entity: A, tech: 'specified' }] / [{ entity: A }] → []
[{ entity: A, tech: 'specified' }] / [{ tech: 'specified' }] → []

// П — intersect
[{ entity: A }] П [{ entity: A, tech: 'specified' }] → [{ entity: A, tech: 'specified' }]
[{ entity: A, tech: '1' }] П [{ entity: A, tech: '2' }] → []
[{ tech: '1' }] П [{ entity: A, tech: '1' }] → [{ entity: A, tech: '1' }]
blond commented 7 years ago

closed favor of #81