Skip to content

Commit

Permalink
feat: #17 Add 'Deprecated' info wherever used 'modName, modVal'
Browse files Browse the repository at this point in the history
  • Loading branch information
birhoff committed Feb 21, 2017
1 parent 2574028 commit 2620fb2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 11 additions & 5 deletions index.js
Expand Up @@ -3,6 +3,8 @@
const assert = require('assert');
const util = require('util');

const deprecate = require('depd')('bem-cell');

const BemEntityName = require('@bem/entity-name');

module.exports = class BemCell {
Expand Down Expand Up @@ -101,15 +103,21 @@ module.exports = class BemCell {
* @deprecated - just for compatibility and can be dropped in future
* @returns {String|undefined} - modifier name
*/
get modName() { return this._entity.modName; }
get modName() {
deprecate('modName: just for compatibility and can be dropped in future');
return this._entity.modName;
}

/**
* Proxies `modName` field from entity.
* Proxies `modVal` field from entity.
*
* @deprecated - just for compatibility and can be dropped in future
* @returns {String|true|undefined} - modifier value
*/
get modVal() { return this._entity.modVal; }
get modVal() {
deprecate('modVal: just for compatibility and can be dropped in future');
return this._entity.modVal;
}

/**
* Returns the identifier of this cell.
Expand Down Expand Up @@ -274,8 +282,6 @@ module.exports = class BemCell {
* const BemCell = require('@bem/cell');
*
* BemCell.create({ block: 'my-button', mod: 'theme', val: 'red', tech: 'css' });
* BemCell.create({ block: 'my-button', modName: 'theme', modVal: 'red', tech: 'css' });
* BemCell.create({ entity: { block: 'my-button', modName: 'theme', modVal: 'red' }, tech: 'css' });
* // BemCell { block: 'my-button', mod: { name: 'theme', val: 'red' }, tech: 'css' }
*
* @param {Object} obj — representation of cell.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -24,7 +24,8 @@
"node": ">= 4.0"
},
"dependencies": {
"@bem/entity-name": "1.3.1"
"@bem/entity-name": "1.3.1",
"depd": "^1.1.0"
},
"devDependencies": {
"ava": "^0.17.0",
Expand Down

0 comments on commit 2620fb2

Please sign in to comment.