This repository was archived by the owner on Feb 4, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ Contents
28
28
* [ API] ( #api )
29
29
* [ TypeScript support] ( #typescript-support )
30
30
* [ Debuggability] ( #debuggability )
31
+ * [ Deprecation] ( #deprecation )
31
32
32
33
Install
33
34
-------
@@ -360,6 +361,19 @@ console.log(JSON.stringify(name));
360
361
// ➜ {"block":"input","mod":{"name":"available","val":true}}
361
362
```
362
363
364
+ Deprecation
365
+ -----------
366
+
367
+ Deprecation is performed with [ depd] ( https://github.com/dougwilson/nodejs-depd ) .
368
+
369
+ To silencing deprecation warnings from being output use the ` NO_DEPRECATION ` environment variable.
370
+
371
+ ```
372
+ NO_DEPRECATION=@bem/entity-name node app.js
373
+ ```
374
+
375
+ > More [ details] ( https://github.com/dougwilson/nodejs-depd#processenvno_deprecation ) in ` depd ` documentation
376
+
363
377
License
364
378
-------
365
379
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const util = require('util');
4
4
5
5
const ExtendableError = require ( 'es6-error' ) ;
6
6
const stringifyEntity = require ( '@bem/naming' ) . stringify ;
7
+ const deprecate = require ( 'depd' ) ( require ( './package.json' ) . name ) ;
7
8
8
9
/**
9
10
* Enum for types of BEM entities.
@@ -114,19 +115,27 @@ class BemEntityName {
114
115
* If entity is not modifier then returns `undefined`.
115
116
*
116
117
* @returns {?string } - entity modifier name.
117
- * @deprecated - use ` mod.name` instead.
118
+ * @deprecated use { @link BemEntityName# mod.name}
118
119
*/
119
- get modName ( ) { return this . mod && this . mod . name ; }
120
+ get modName ( ) {
121
+ deprecate ( `modName is kept just for compatibility and can be dropped in the future. Use mod.name instead in ${ this . inspect ( ) } at` ) ;
122
+
123
+ return this . mod && this . mod . name ;
124
+ }
120
125
121
126
/**
122
127
* Returns the modifier value of this entity.
123
128
*
124
129
* If entity is not modifier then returns `undefined`.
125
130
*
126
131
* @returns {?(string|true) } - entity modifier name.
127
- * @deprecated - use ` mod.val` instead.
132
+ * @deprecated use { @link BemEntityName# mod.val}
128
133
*/
129
- get modVal ( ) { return this . mod && this . mod . val ; }
134
+ get modVal ( ) {
135
+ deprecate ( `modVal is kept just for compatibility and can be dropped in the future. Use mod.val instead in ${ this . inspect ( ) } at` ) ;
136
+
137
+ return this . mod && this . mod . val ;
138
+ }
130
139
131
140
/**
132
141
* Returns id for this entity.
Original file line number Diff line number Diff line change 33
33
},
34
34
"dependencies" : {
35
35
"@bem/naming" : " 2.0.0-5" ,
36
+ "depd" : " 1.1.0" ,
36
37
"es6-error" : " 4.0.2"
37
38
},
38
39
"devDependencies" : {
51
52
},
52
53
"scripts" : {
53
54
"pretest" : " npm run lint" ,
54
- "test" : " nyc ava" ,
55
+ "test" : " NO_DEPRECATION=@bem/entity-name nyc ava" ,
55
56
"lint" : " npm run lint:js && npm run lint:dts" ,
56
57
"lint:js" : " eslint ." ,
57
58
"lint:dts" : " tslint **.d.ts" ,
You can’t perform that action at this time.
0 commit comments