1 | 'use strict';
|
2 |
|
3 | var getCurrentItem = require('./getCurrentItem');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function getItemDepth(opts, value, block) {
|
14 | var document = value.document,
|
15 | startBlock = value.startBlock;
|
16 |
|
17 | block = block || startBlock;
|
18 |
|
19 | var currentItem = getCurrentItem(opts, value, block);
|
20 | if (!currentItem) {
|
21 | return 0;
|
22 | }
|
23 |
|
24 | var list = document.getParent(currentItem.key);
|
25 |
|
26 | return 1 + getItemDepth(opts, value, list);
|
27 | }
|
28 |
|
29 | module.exports = getItemDepth; |
\ | No newline at end of file |