Created
February 16, 2020 21:04
-
-
Save jsdbroughton/b5fa6ab5fe9dc9af18edcaf4457c0be8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parentItems:TreeItem[] = []; | |
parentKeys.forEach( ( v:string ):void=>{ | |
let parts = v.split( `-` ); | |
while ( uniqueIds.has( lastId ) ) { | |
lastId += 1; | |
} | |
uniqueIds.add( lastId ); | |
let name = parts.pop() || ``; | |
parentItems.push( { | |
id: lastId, | |
key: v, | |
name, | |
parentKey: parts.join( `-` ) | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment