mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-10-21 22:49:51 -04:00
CFI: export collapse function
This commit is contained in:
1 parent
15aa43bd42
commit
f5bf41def6
1 file changed
+1
-1
+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