Skip to content

Commit

Permalink
docs(naming object): rename BEM-naming to naming object
Browse files Browse the repository at this point in the history
  • Loading branch information
blond committed Mar 27, 2016
1 parent 2d74024 commit 099ee42
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions README.md
Expand Up @@ -17,7 +17,7 @@ bem-naming
About
-----

This tool allows getting information about BEM entity using [string](#string-representation) as well as forming string representation based on [BEM-naming](#bem-naming).
This tool allows getting information about BEM entity using [string](#string-representation) as well as forming string representation based on [naming object](#object-representation-of-bem-entity).

Install
-------
Expand All @@ -42,7 +42,7 @@ Table of Contents

* [String representation](#string-representation)
* [Common misconceptions](#common-misconceptions)
* [BEM-naming](#bem-naming-1)
* [Object representation of BEM entity](#object-representation-of-bem-entity)
* [API](#api)
* [Custom naming convention](#custom-naming-convention)
* [Convention by Harry Roberts](#convention-by-harry-roberts)
Expand Down Expand Up @@ -81,10 +81,10 @@ Also there is no such BEM entity as a modifier and an element modifier simultane
'block_block-mod-name_block-mod-val__elem-name_elem-mod-name_elem-mod-val'
```

BEM-naming
----------
Object representation of BEM entity
-----------------------------------

BEM entities can be defined with a help of js-object with the following fields:
BEM entities can be defined with a help of JS object with the following fields:

* `block` — a block name. The field is required because only a block exists as an independent BEM entity
* `elem` — an element name.
Expand Down Expand Up @@ -169,7 +169,7 @@ bemNaming.validate('^*^'); // false

### parse(str)

It parses string `str` into BEM-naming.
It parses string into naming object.

Example:

Expand All @@ -180,7 +180,7 @@ bemNaming.parse('block__elem_mod_val'); // { block: 'block', elem: 'elem',

### stringify(obj)

It forms a string according to BEM-naming `obj`.
It forms a string according to naming object.

Example:

Expand Down Expand Up @@ -219,7 +219,7 @@ bemNaming.typeOf({ block: 'block', elem: 'elem', modName: 'mod' }); // elemMod

### isBlock(str)

Checks whether string `str` is a block.
Checks whether string is a block.

Example:

Expand All @@ -230,7 +230,7 @@ bemNaming.isBlock('block__elem'); // false

### isBlock(obj)

Checks whether BEM-naming `obj` is a block.
Checks whether naming object is a block.

Example:

Expand All @@ -241,7 +241,7 @@ bemNaming.isBlock({ block: 'block', elem: 'elem' }); // false

### isBlockMod(str)

Checks whether string `str` is modifier of a block.
Checks whether string is modifier of a block.

Example:

Expand All @@ -252,7 +252,7 @@ bemNaming.isBlockMod('block__elem_mod'); // false

### isBlockMod(obj)

Checks whether BEM-naming `obj` is modifier of a block.
Checks whether naming object is modifier of a block.

Example:

Expand All @@ -266,7 +266,7 @@ bemNaming.isBlockMod({ block: 'block', elem: 'elem',

### isElem(str)

Checks whether string `str` is element of a block.
Checks whether string is element of a block.

Example:

Expand All @@ -277,7 +277,7 @@ bemNaming.isElem('block-name'); // false

### isElem(obj)

Checks whether BEM-naming `obj` is element of a block.
Checks whether naming object is element of a block.

Example:

Expand All @@ -288,7 +288,7 @@ bemNaming.isElem({ block: 'block-name' }); // false

### isElemMod(str)

Checks whether string `str` is modifier of an element.
Checks whether string is modifier of an element.

Example:

Expand All @@ -299,7 +299,7 @@ bemNaming.isElemMod('block__elem'); // false

### isElemMod(obj)

Checks whether BEM-naming `obj` is modifier of an element.
Checks whether naming object is modifier of an element.

Example:

Expand Down
30 changes: 15 additions & 15 deletions index.js
Expand Up @@ -49,7 +49,7 @@ var cache = {};

/**
* Creates namespace with methods which allows getting information about BEM entity using string as well
* as forming string representation based on BEM-naming object.
* as forming string representation based on naming object.
*
* @param {Object} [options] Options.
* @param {String} [options.elem=__] Separates element's name from block.
Expand All @@ -73,17 +73,17 @@ function createNaming(options) {
/**
* Checks a string to be valid BEM notation.
*
* @param {String} str String representation of BEM entity.
* @param {String} str - String representation of BEM entity.
* @returns {Boolean}
*/
function validate(str) {
return regex.test(str);
}

/**
* Parses string into BEM-naming object.
* Parses string into naming object.
*
* @param {String} str String representation of BEM entity.
* @param {String} str - string representation of BEM entity.
* @returns {Object|undefined}
*/
function parse(str) {
Expand All @@ -110,9 +110,9 @@ function createNaming(options) {
}

/**
* Forms a string according to BEM-naming object.
* Forms a string according to naming object.
*
* @param {Object} obj BEM-naming object
* @param {Object} obj - naming object
* @returns {String}
*/
function stringify(obj) {
Expand Down Expand Up @@ -144,7 +144,7 @@ function createNaming(options) {
/**
* Returns a string indicating type of a BEM entity.
*
* @param {Object|String|undefined} obj BEM-naming object or string representation of BEM entity.
* @param {Object|String|undefined} obj - naming object or string representation of BEM entity.
* @returns {String}
*/
function typeOf(obj) {
Expand All @@ -167,39 +167,39 @@ function createNaming(options) {
}

/**
* Checks whether BEM-naming object or string is a block.
* Checks whether naming object or string is a block.
*
* @param {Object|String} obj BEM-naming object or string representation of BEM entity.
* @param {Object|String} obj - naming object or string representation of BEM entity.
* @returns {Boolean}
*/
function isBlock(obj) {
return typeOf(obj) === TYPES.BLOCK;
}

/**
* Checks whether BEM-naming object or string is modifier of a block.
* Checks whether naming object or string is modifier of a block.
*
* @param {Object|String} obj BEM-naming object or string representation of BEM entity.
* @param {Object|String} obj - naming object or string representation of BEM entity.
* @returns {Boolean}
*/
function isBlockMod(obj) {
return typeOf(obj) === TYPES.BLOCK_MOD;
}

/**
* Checks whether BEM-naming object or string is element of a block.
* Checks whether naming object or string is element of a block.
*
* @param {Object|String} obj BEM-naming object or string representation of BEM entity.
* @param {Object|String} obj - naming object or string representation of BEM entity.
* @returns {Boolean}
*/
function isElem(obj) {
return typeOf(obj) === TYPES.ELEM;
}

/**
* Checks whether BEM-naming object or string is element of a block.
* Checks whether naming object or string is element of a block.
*
* @param {Object|String} obj BEM-naming object or string representation of BEM entity.
* @param {Object|String} obj - naming object or string representation of BEM entity.
* @returns {Boolean}
*/
function isElemMod(obj) {
Expand Down

0 comments on commit 099ee42

Please sign in to comment.