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

Commit af8e9e1

Browse files
author
blond
committed
refactor(order): reorder methods
1 parent 8c63203 commit af8e9e1

File tree

3 files changed

+145
-145
lines changed

3 files changed

+145
-145
lines changed

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ API
6363
* [block](#block)
6464
* [elem](#elem)
6565
* [mod](#mod)
66-
* [id](#id)
6766
* [type](#type)
67+
* [id](#id)
6868
* [isSimpleMod()](#issimplemod)
6969
* [isEqual(entityName)](#isequalentityname)
7070
* [belongsTo(entityName)](#belongstoentityname)
71-
* [toString()](#tostring)
7271
* [valueOf()](#valueof)
7372
* [toJSON()](#tojson)
74-
* [static isBemEntityName(entityName)](#static-isbementitynameentityname)
73+
* [toString()](#tostring)
7574
* [static create(obj)](#static-createobj)
75+
* [static isBemEntityName(entityName)](#static-isbementitynameentityname)
7676

7777
### constructor({ block, elem, mod })
7878

@@ -162,21 +162,6 @@ modName.mod; // { name: 'disabled', val: true }
162162
blockName.mod; // undefined
163163
```
164164

165-
### id
166-
167-
The id for this entity.
168-
169-
**Important:** should only be used to determine uniqueness of entity.
170-
171-
If you want to get string representation in accordance with the provisions naming convention you should use [@bem/naming](https://github.com/bem-sdk/bem-naming) package.
172-
173-
```js
174-
const BemEntityName = require('@bem/entity-name');
175-
const name = new BemEntityName({ block: 'button', mod: 'disabled' });
176-
177-
name.id; // button_disabled
178-
```
179-
180165
### type
181166

182167
The type for this entity.
@@ -193,6 +178,21 @@ elemName.type; // elem
193178
modName.type; // elemMod
194179
```
195180

181+
### id
182+
183+
The id for this entity.
184+
185+
**Important:** should only be used to determine uniqueness of entity.
186+
187+
If you want to get string representation in accordance with the provisions naming convention you should use [@bem/naming](https://github.com/bem-sdk/bem-naming) package.
188+
189+
```js
190+
const BemEntityName = require('@bem/entity-name');
191+
const name = new BemEntityName({ block: 'button', mod: 'disabled' });
192+
193+
name.id; // button_disabled
194+
```
195+
196196
### isSimpleMod()
197197

198198
Determines whether modifier simple or not.
@@ -249,20 +249,6 @@ buttonTextBoldName.belongsTo(buttonTextName); // true
249249
buttonTextBoldName.belongsTo(buttonName); // false
250250
```
251251

252-
### toString()
253-
254-
Returns string representing the entity name.
255-
256-
**Important:** if you want to get string representation in accordance with the provisions naming convention
257-
you should use [@bem/naming](https://github.com/bem-sdk/bem-naming) package.
258-
259-
```js
260-
const BemEntityName = require('@bem/entity-name');
261-
const name = new BemEntityName({ block: 'button', mod: 'focused' });
262-
263-
name.toString(); // button_focused
264-
```
265-
266252
### valueOf()
267253

268254
Returns object representing the entity name.
@@ -280,21 +266,18 @@ name.valueOf();
280266

281267
Returns object for `JSON.stringify()` purposes.
282268

283-
### static isBemEntityName(entityName)
269+
### toString()
284270

285-
Determines whether specified entity is an instance of BemEntityName.
271+
Returns string representing the entity name.
286272

287-
Parameter | Type | Description
288-
-------------|-----------------|-----------------------
289-
`entityName` | `*` | The entity to check.
273+
**Important:** if you want to get string representation in accordance with the provisions naming convention
274+
you should use [@bem/naming](https://github.com/bem-sdk/bem-naming) package.
290275

291276
```js
292277
const BemEntityName = require('@bem/entity-name');
278+
const name = new BemEntityName({ block: 'button', mod: 'focused' });
293279

294-
const entityName = new BemEntityName({ block: 'input' });
295-
296-
BemEntityName.isBemEntityName(entityName); // true
297-
BemEntityName.isBemEntityName({ block: 'button' }); // false
280+
name.toString(); // button_focused
298281
```
299282

300283
### static create(object)
@@ -335,6 +318,23 @@ BemEntityName.create({ block: 'my-button', mod: 'focused' });
335318
// ➜ BemEntityName { block: 'my-button', mod: { name: 'focused', val: true } }
336319
```
337320

321+
### static isBemEntityName(entityName)
322+
323+
Determines whether specified entity is an instance of BemEntityName.
324+
325+
Parameter | Type | Description
326+
-------------|-----------------|-----------------------
327+
`entityName` | `*` | The entity to check.
328+
329+
```js
330+
const BemEntityName = require('@bem/entity-name');
331+
332+
const entityName = new BemEntityName({ block: 'input' });
333+
334+
BemEntityName.isBemEntityName(entityName); // true
335+
BemEntityName.isBemEntityName({ block: 'button' }); // false
336+
```
337+
338338
TypeScript support
339339
------------------
340340

index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ declare class BemEntityName {
88
readonly mod: BemSDK.EntityName.ModifierRepresentation | undefined;
99
readonly modName: string | undefined;
1010
readonly modVal: string | true | undefined;
11-
readonly id: string;
1211
readonly type: BemSDK.EntityName.TYPE;
12+
readonly id: string;
1313

1414
isSimpleMod(): boolean | null;
15+
isEqual(entityName: BemEntityName): boolean;
1516
belongsTo(entityName: BemEntityName): boolean;
16-
toString(): string;
1717
valueOf(): BemSDK.EntityName.StrictRepresentation;
18-
inspect(depth: number, options: object): string;
1918
toJSON(): BemSDK.EntityName.StrictRepresentation;
20-
isEqual(entityName: BemEntityName): boolean;
19+
toString(): string;
20+
inspect(depth: number, options: object): string;
2121

22-
static isBemEntityName(entityName: any): boolean;
2322
static create(obj: BemSDK.EntityName.NonStrictRepresentation | string): BemEntityName;
23+
static isBemEntityName(entityName: any): boolean;
2424
}
2525

2626
export = BemEntityName;

0 commit comments

Comments
 (0)