orgast-util-visit-ids
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -1,2 +0,2 @@ | ||
import { OrgNode, OrgData, Headline } from 'uniorg'; | ||
export declare function visitIds(tree: OrgNode, f: (id: string, node: OrgData | Headline) => void): void; | ||
import { OrgNode, OrgData, Section } from 'uniorg'; | ||
export declare function visitIds(tree: OrgNode, f: (id: string, node: OrgData | Section) => void): void; |
@@ -13,3 +13,3 @@ "use strict"; | ||
while (parent && | ||
parent.type !== 'headline' && | ||
parent.type !== 'section' && | ||
parent.type !== 'org-data') { | ||
@@ -16,0 +16,0 @@ parent = ancestors.pop(); |
@@ -38,5 +38,7 @@ "use strict"; | ||
expect(id).toBe('hi-there'); | ||
expect(node.type).toBe('headline'); | ||
expect(node.level).toBe(1); | ||
expect(node.rawValue).toBe('hi, there!'); | ||
expect(node.type).toBe('section'); | ||
const headline = node.children[0]; | ||
expect(headline.type).toBe('headline'); | ||
expect(headline.level).toBe(1); | ||
expect(headline.rawValue).toBe('hi, there!'); | ||
}); | ||
@@ -78,10 +80,14 @@ test('ignores CUSTOM_ID', () => { | ||
expect(id2).toBe('id-headline'); | ||
expect(node2.type).toBe('headline'); | ||
expect(node2.level).toBe(1); | ||
expect(node2.type).toBe('section'); | ||
const headline2 = node2.children[0]; | ||
expect(headline2.type).toBe('headline'); | ||
expect(headline2.level).toBe(1); | ||
const [id3, node3] = f.mock.calls[2]; | ||
expect(id3).toBe('id-headline-2'); | ||
expect(node3.type).toBe('headline'); | ||
expect(node3.level).toBe(2); | ||
expect(node3.type).toBe('section'); | ||
const headline3 = node3.children[0]; | ||
expect(headline3.type).toBe('headline'); | ||
expect(headline3.level).toBe(2); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.spec.js.map |
{ | ||
"name": "orgast-util-visit-ids", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "orgast (uniorg) utility to visit all nodes with ids", | ||
@@ -44,4 +44,4 @@ "keywords": [ | ||
"typescript": "^4.3.2", | ||
"uniorg": "^0.3.0", | ||
"uniorg-parse": "^0.3.1" | ||
"uniorg": "^0.4.0", | ||
"uniorg-parse": "^0.4.0" | ||
}, | ||
@@ -51,3 +51,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "9606f8482e4fd9229e80cafe4d40c9e0ce840a9e" | ||
"gitHead": "1b493e95f00096108fbd2f3e56c739ba0458483d" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
44548
111