This repository was archived by the owner on Feb 4, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ module.exports = class BemEntityName {
47
47
} else if ( modObj || hasModVal ) {
48
48
throw new Error ( 'This is not valid BEM entity: the field `mod.name` is undefined.' ) ;
49
49
}
50
+
51
+ this . __isBemEntityName__ = true ;
50
52
}
51
53
52
54
/**
@@ -256,4 +258,22 @@ module.exports = class BemEntityName {
256
258
isEqual ( entityName ) {
257
259
return entityName && ( this . id === entityName . id ) ;
258
260
}
261
+
262
+ /**
263
+ * Determines whether specified entity is instance of BemEntityName.
264
+ *
265
+ * @param {BemEntityName } entityName - the entity to check.
266
+ *
267
+ * @returns {boolean } A Boolean indicating whether or not specified entity is instance of BemEntityName.
268
+ * @example
269
+ * const BemEntityName = require('@bem/entity-name');
270
+ *
271
+ * const entityName = new BemEntityName({ block: 'input' });
272
+ *
273
+ * BemEntityName.isBemEntityName(entityName); // true
274
+ * BemEntityName.isBemEntityName({}); // false
275
+ */
276
+ static isBemEntityName ( entityName ) {
277
+ return entityName && entityName . __isBemEntityName__ ;
278
+ }
259
279
} ;
You can’t perform that action at this time.
0 commit comments