Skip to content
This repository was archived by the owner on Feb 4, 2018. It is now read-only.

Commit d0d9064

Browse files
author
blond
committed
fix(deprecation): deprecate in constructor
1 parent 5eb8a6d commit d0d9064

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/entity-name.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const util = require('util');
44

55
const stringifyEntity = require('@bem/naming').stringify;
6-
const deprecate = require('depd')(require('../package.json').name);
76

7+
const deprecate = require('./deprecate');
88
const EntityTypeError = require('./entity-type-error');
99

1010
/**
@@ -29,6 +29,9 @@ class BemEntityName {
2929
throw new EntityTypeError(obj, 'the field `block` is undefined');
3030
}
3131

32+
obj.modName && deprecate(obj, 'modName', 'mod.name');
33+
obj.modVal && deprecate(obj, 'modVal', 'mod.val');
34+
3235
const data = this._data = { block: obj.block };
3336

3437
obj.elem && (data.elem = obj.elem);
@@ -104,7 +107,7 @@ class BemEntityName {
104107
* @deprecated use {@link BemEntityName#mod.name}
105108
*/
106109
get modName() {
107-
deprecate(`modName is kept just for compatibility and can be dropped in the future. Use mod.name instead in ${this.inspect()} at`);
110+
deprecate(this, 'modName', 'mod.name');
108111

109112
return this.mod && this.mod.name;
110113
}
@@ -118,7 +121,7 @@ class BemEntityName {
118121
* @deprecated use {@link BemEntityName#mod.val}
119122
*/
120123
get modVal() {
121-
deprecate(`modVal is kept just for compatibility and can be dropped in the future. Use mod.val instead in ${this.inspect()} at`);
124+
deprecate(this, 'modVal', 'mod.val');
122125

123126
return this.mod && this.mod.val;
124127
}

0 commit comments

Comments
 (0)