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

Commit

Permalink
docs(readme): update readme according to output format
Browse files Browse the repository at this point in the history
  • Loading branch information
qfox committed Jan 31, 2017
1 parent 7a1c9f8 commit a74dad1
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Readable stream (`stream.Readable`) that has the following events:

| Event | Description |
|----------|-----|
|'data'|Returns a JavaScript object with information about a found file. </br></br>The example below shows a JSON interface with elements that are in the response for the `walk` method. Objects and keys have sample values.</br></br> **Example** </br></br><code> {</code></br><code>"entity": { "block": "page" },</code></br><code> "level": "libs/bem-core/desktop.blocks",</code></br><code>"tech": "bemhtml",</code></br><code>"path": "libs/bem-core/desktop.blocks/page/page.bemhtml.js"</code></br><code>}</code></br></br>`entity` — BEM entity.</br>`level` — Directory path.</br>`tech` — Implementation technology.</br>`path` — Relative path to the file.|
|'data'|Returns a JavaScript object with information about a found file. </br></br>The example below shows a JSON interface with elements that are in the response for the `walk` method. Objects and keys have sample values.</br></br> **Example** </br></br><code> {</code></br><code>{ "cell": { "entity": { "block": "page" } },</code></br><code> "layer": "libs/bem-core/desktop.blocks",</code></br><code>"tech": "bemhtml" },</code></br><code>"path": "libs/bem-core/desktop.blocks/page/page.bemhtml.js"</code></br><code>}</code></br></br>`entity` — BEM entity.</br>`layer` — Directory path.</br>`tech` — Implementation technology.</br>`path` — Relative path to the file.|
| 'error' | Generated if an error occurred while traversing the levels. Returns an object with the error description.|
| 'end' | Generated when `bem-walk` finishes traversing the levels defined in the `levels` object. |

Expand Down Expand Up @@ -221,11 +221,14 @@ const stream = walk(levels, {

/*
{ button:
[ { entity: { block: 'button', mod: { name: 'togglable', val: 'radio' } },
tech: 'spec.js',
path: 'libs/bem-components/common.blocks/button/_togglable/
button_togglable_radio.spec.js',
level: 'libs/bem-components/common.blocks' } ],
[ BemFile {
cell: BemCell {
entity: BemEntityName { block: 'button', mod: { name: 'togglable', val: 'radio' } },
tech: 'spec.js',
layer: 'libs/bem-components/common.blocks'
},
path: 'libs/bem-components/common.blocks/button/_togglable/
button_togglable_radio.spec.js' } ] },
...
}
*/
Expand Down Expand Up @@ -260,10 +263,14 @@ const stream = walk(levels, {
.on('end', () => console.log(files));

/*
[{ entity: { block: 'popup', mod: { name: 'target', val: true } },
tech: 'js',
path: 'libs/bem-components/common.blocks/popup/_target/popup_target.js',
level: 'libs/bem-components/common.blocks' },
[BemFile {
cell: BemCell {
entity: BemEntityName { block: 'popup', mod: { name: 'target', val: true } },
tech: 'js',
level: 'libs/bem-components/common.blocks'
},
path: 'libs/bem-components/common.blocks/popup/_target/popup_target.js'
},
...
]
*/
Expand Down Expand Up @@ -304,10 +311,12 @@ const stream = walk(levels, {
.pipe(process.stdout);

/*
[{"entity":{"block":"search","elem":"header"},
"tech":"css",
[{"cell":{
"entity":{"block":"search","elem":"header"},
"tech":"css",
"level":"common.blocks"
},
"path":"common.blocks/search/__header/search__header.css",
"level":"common.blocks",
"source":".search__header {\n\tdisplay: block;\n\tfont-size: 20px;\n\tcolor:
rgba(0,0,0,0.84);\n\tmargin: 0;\n\tpadding: 0 0 16px;\n\n}\n\n"},
...
Expand Down

0 comments on commit a74dad1

Please sign in to comment.