import { Preconditions } from 'polar-shared/src/Preconditions' ; export class TextNodes { param textNode param offset param length return { Range } public static getRange ( textNode , offset = 0 , length ? ) { Preconditions . assertPresent ( textNode , "textNode" ) ; if ( ! length ) { length = textNode . textContent ! . length ; } const doc = textNode . ownerDocument || document ; const range = doc . createRange ( ) ; range . setStart ( textNode , offset ) ; range . setEnd ( textNode , length ) ; return range ; } }