mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
CFI: export collapse function
This commit is contained in:
+1
-1
@@ -131,7 +131,7 @@ const toInnerString = parsed => parsed.parent
|
||||
|
||||
const toString = parsed => wrap(toInnerString(parsed))
|
||||
|
||||
const collapse = (x, toEnd) => typeof x === 'string'
|
||||
export const collapse = (x, toEnd) => typeof x === 'string'
|
||||
? toString(collapse(parse(x), toEnd))
|
||||
: x.parent ? concatArrays(x.parent, x[toEnd ? 'end' : 'start']) : x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user