This repository was archived by the owner on Feb 4, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-16
lines changed Expand file tree Collapse file tree 2 files changed +23
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
const util = require ( 'util' ) ;
4
4
5
- const ExtendableError = require ( 'es6-error' ) ;
6
5
const stringifyEntity = require ( '@bem/naming' ) . stringify ;
7
6
const deprecate = require ( 'depd' ) ( require ( './package.json' ) . name ) ;
8
7
8
+ const EntityTypeError = require ( './lib/entity-type-error' ) ;
9
+
9
10
/**
10
11
* Enum for types of BEM entities.
11
12
*
@@ -18,21 +19,6 @@ const TYPES = {
18
19
ELEM : 'elem' ,
19
20
ELEM_MOD : 'elemMod'
20
21
} ;
21
- /**
22
- * The EntityTypeError object represents an error when a value is not valid BEM entity.
23
- */
24
- class EntityTypeError extends ExtendableError {
25
- /**
26
- * @param {object } obj — not valid object
27
- * @param {string } [reason] — human-readable reason why object is not valid
28
- */
29
- constructor ( obj , reason ) {
30
- const str = util . inspect ( obj , { depth : 1 } ) ;
31
- const message = `the object \`${ str } \` is not valid BEM entity` ;
32
-
33
- super ( reason ? `${ message } , ${ reason } ` : message ) ;
34
- }
35
- }
36
22
37
23
class BemEntityName {
38
24
/**
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const util = require ( 'util' ) ;
4
+
5
+ const ExtendableError = require ( 'es6-error' ) ;
6
+
7
+ /**
8
+ * The EntityTypeError object represents an error when a value is not valid BEM entity.
9
+ */
10
+ module . exports = class EntityTypeError extends ExtendableError {
11
+ /**
12
+ * @param {object } obj — not valid object
13
+ * @param {string } [reason] — human-readable reason why object is not valid
14
+ */
15
+ constructor ( obj , reason ) {
16
+ const str = util . inspect ( obj , { depth : 1 } ) ;
17
+ const message = `the object \`${ str } \` is not valid BEM entity` ;
18
+
19
+ super ( reason ? `${ message } , ${ reason } ` : message ) ;
20
+ }
21
+ } ;
You can’t perform that action at this time.
0 commit comments