0.2.2 • Published 7 years ago

bem-immutable v0.2.2

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

What is it?

bem-immutable is a library for web interface development. It provides the minimal stack for coding client-side JavaScript and templating.

Installation

Yarn: yarn add bem-immutable

Or npm: npm i --save bem-immutable

Use

import { BemRoot } from 'bem-immutable';
// or import Bem from 'bem-immutable';

const box = new BemRoot('block');
const elem = box.element('element');

const nextElem = elem.mod('active');

console.log(nextElem == elem); // false
console.log(elem.toString()); // 'block__element'
console.log(nextElem.toString()); // 'block__element block__element_active'

console.log(elem.mod('mod1 mod2')); // block__element block__element_mod1 block__element_mod2
console.log(elem.mix('mix1 mix2')); // block__element mix1 mix2

console.log(elem.mod(['mod1', 'mod2'])); // block__element block__element_mod1 block__element_mod2
console.log(elem.mix(['mix1', 'mix2'])); // block__element mix1 mix2

console.log(elem.mod({ mod1: 1, mod2: true, mod3: 0, mod4: false })); // block__element block__element_mod1 block__element_mod2
console.log(elem.mix({ mix1: 1, mix2: true, mix3: 0, mix4: false })); // block__element mix1 mix2

console.log(elem.mod('a').mod('b').mix('c')); // block__element block__element_a block__element_b c

console.log(elem.mod('a').mix(box.element('y').mod('is'))); // block__element block__element_a block__y block__y_is
0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago